2

I'm trying to create an excel file with 100+ MB data using exceljs. Everything is fine from processing the data, creating columns and sheets, but the problem comes when writing the file using workbook.xlsx.writeFile(filepath) which the error was javascript heap out of memory coming from the library. I have already increase the max-old-space-size to 16384 and it still crashing. I wonder if there are any solid solutions or workarounds to make this issue resolved.

DMDJ
  • 357
  • 1
  • 6
  • 13

1 Answers1

2

I suppose you should use streams instead of trying to save the whole content at once:

const fileStream = fs.createWriteStream(filePath);
await workbook.xlsx.write(fileStream);
Anatoly
  • 20,799
  • 3
  • 28
  • 42