Closed zlibmaster closed 3 years ago
CSV is a plain text format. XLSX is a binary which is compressed and include optimizations like storing data in a lookup table to avoid repeating data.
So it's perfectly expected that the result is bigger in CSV. On the other hand, CSV is readable without any especial software and XLSX requires Excel or some other to decode the file.
A quick google about this will give you a lot of information. :)
Hi, while debugging #526 I noticed some size differences with using this library. Specificaly a much bigger file downloaded compared to the file downloaded when using ExcelJS. (https://github.com/exceljs/exceljs#writing-xlsx) While the csv is generated much faster (4x faster), it is also 3x larger (12MB .xlsx with ExcelJS, 36MB .csv with json2csv) Both Are being created with stream and piped to express response. The data in the files seems identical when opened with "MS Excel" Can someone help me lower the size of my csv? Is this something to do with encoding? Or gzip in express? I thought csv should be lighter and faster than xlsx...
json2csv version: 5.0.6 exceljs: 4.2.1 node: 14.14.0 code:
json2CSV:
ExcelJS:
Express server configuration:
The request to the route is done from browser with a GET request using fetch, converting the response to blob, and using window.URL.createObjectURL(file);