'Request Attachment is not working with Node Express
So I'm trying to build an endpoint to use in my client app to download a file using express, and here is function:
downloadInvoice: async (req, res) => {
res.attachment(__dirname + '/invoices/a.pdf');
res.send();
},
And yes, when I try to get the file that is on that path, it downloads me a pdf but that is not opening, with the error message: Failed to load PDF document.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
