Mrunall Veer
Mrunall Veer

Reputation: 111

how to convert pdf array buffer to pdf file using nodejs

Following is the pdf buffer. I want convert buffer to pdf file.

data = {
    "file": {
        "type": "Buffer",
        "data": [
            102,
            24,
            62
        ]
    },
}
res.send( data );

Upvotes: 1

Views: 4487

Answers (1)

You can use res.sendFile and use the header to send some data along.

// res.sendFile(path [, options] [, fn])

let options = {
  headers: {
      'TheDataYouWantToSend': Date.now() // for example a timestamp
  }
}

req.sendFile(absolutePathToFile, options)

I hope this helps

Upvotes: 2

Related Questions