Closed ghost closed 5 years ago
Hi,
I am using json2csv lib to generate file on the server and then using res.download prompting user to download it.
I see file downloaded as blob and without file extension.
https://user-images.githubusercontent.com/1841956/53301009-d0622c00-3873-11e9-9997-f235996f6342.png
Here is my code:
res.setHeader('Content-type', 'text/csv'); res.download(filepath, filename, function () { fs.unlinkSync(filepath); });
filename - download.pdf filepath - full path with filename
Issue fixed.
Used ngx-filesaver in angular front and save file. https://www.npmjs.com/package/ngx-filesaver
Hi,
I am using json2csv lib to generate file on the server and then using res.download prompting user to download it.
I see file downloaded as blob and without file extension.
https://user-images.githubusercontent.com/1841956/53301009-d0622c00-3873-11e9-9997-f235996f6342.png
Here is my code:
res.setHeader('Content-type', 'text/csv'); res.download(filepath, filename, function () { fs.unlinkSync(filepath); });
filename - download.pdf filepath - full path with filename