When I run getAsPDF on the Xero side, I get a buffer output like this. I am trying to convert it to base64 format and send it as pdf, but I could not convert it to pdf format.
CodePudding user response:
you can pass the buffer data to Buffer object to convert data into base64.
Link: https://nodejs.org/api/buffer.html#static-method-bufferfromstring-encoding
Example:
const base64Data = Buffer.from(bufferDataGoesHere).toString("base64");