In my Node/Express app I have the following code, which suppose to read a PDF document from a file, and send it to the browser:
var file = fs.createReadStrea
Best way to download a PDF on REST API call.
var path = require('path'); var file = path.join(__dirname, 'file.pdf'); res.download(file, function (err) { if (err) { console.log("Error"); console.log(err); } else { console.log("Success"); } });