0

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!

Alina C
  • 1
  • 1

1 Answers1

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