Suppose I want to use exceljs to serve excel to web clients. Also, suppose that I am using streaming (due to the files being potentially large and not wanted to keep them in memory).
Is it possible to find out what the Content-Length header should be? Because without this, I can't see the download progress spinner from chrome.
Example code:
app.get('/some/route', function(req, res) {
res.writeHead(200, {
'Content-Disposition': 'attachment; filename="file.xlsx"',
'Content-Type': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
"Content-Length" : inf //this is what I want!!
})
var workbook = new Excel.stream.xlsx.WorkbookWriter({ stream: res })
var worksheet = workbook.addWorksheet('some-worksheet')
worksheet.addRow(['foo', 'bar']).commit()
worksheet.commit()
workbook.commit()
}