I created an excel file using using excel4node library, it is saved in the server side. Does anybody know how can I simulate a client download in the browser for it? I saw that there are some libraries 'download', 'file-saver', none of them work server side. Thank you!
Asked
Active
Viewed 187 times
0
-
Take a look at [this](https://stackoverflow.com/questions/7288814/download-a-file-from-nodejs-server-using-express), assuming your using expressjs. – ChicoDelaBarrio Aug 27 '18 at 08:27
-
Can you post your server code – Janith Aug 27 '18 at 08:59
1 Answers
0
I managed to solve the issue by using
res.setHeader('Content-disposition', 'attachment; filename=' + fileName);
res.setHeader('Content-type', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
res.sendFile(path);

Alina C
- 1
- 1