Varun Deva
Varun Deva

Reputation: 51

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?

Upvotes: 1

Views: 7093

Answers (1)

Varun Deva
Varun Deva

Reputation: 51

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")

Upvotes: 3

Related Questions