app.get('/downloadFile', function (req, res) { var file = path.join(__dirname, '/pdfs/'); res.download(file, function (err) { if (err) { console.log('Error'); console.log(err); } else { console.log('Success'); } }); });
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter