Forum How do I...?

Output to base64 string only, no output file -- Nodejs

LoveYouFyi
Hello,

Can you tell me how to edit the following to only output base64 string and no PDF file:


const Prince = require("prince")
const util = require("util")

Prince()
.inputs("invoicesample.html")
.output("test.pdf")
.execute()
.then(function () {
}, function (error) {
console.log("ERROR: ", util.inspect(error))
})


Thank you-
mikeday
I'm not sure if the Prince Node.js wrapper supports this, you would need to specify an output of "-" and then check the stdout field returned by the execute() method.
LoveYouFyi
The stdout field returns the buffer. How can I ensure the buffer encoding is base64?
mikeday
Searching for "node base64" should provide various options for doing this.
LoveYouFyi
Sorted it out. Thank you.