1

I have an end point which should respond back with an excel file. Right Now I'm able to write the file to a write stream,pipe it to the disk and respond with the downloadable file.

var fs = require('fs');
const writeStream = fs.createWriteStream('abc.xlsx');
//stream is the stream object
stream.pipe(writeStream);
res.download('abc.xlsx')

This works fine and the browser downloads abc.xlsx file. Is there anyway I could do this without storing the file to the disk just by using the stream object?

Anand Srinivasan
  • 450
  • 5
  • 20

0 Answers0