node.jspdfbufferbackblaze

How can get Buffer from already saved PDF in NodeJs?


I have to upload the pdf file to Backblaze bucket. which accepts Buffer only. PDF file is already stored in one of my directory. i can access that pdf through fs.

while uploading i have to give buffer. Which is the best way to get buffer?


Solution

  • I found simple way without using Buffer.. I can pass the file path to readFileSync() in fs

    Example const buff = fs.readFileSync("pdfs/abcd.pdf")