Closed stashev closed 1 year ago
this is fantastic. i shoulda RTFM !
how many lines did u test it with? i think the old code crashes at around 512 MB on Chrome (more on FF)
https://github.com/gabrielsroka/gabrielsroka.github.io/issues/46
i tested it with 1024 MB on Chrome using this. it seems to work!!!
(function () {
function downloadCSV(lines, filename) {
var a = $("<a>").appendTo(document.body);
a.attr("href", URL.createObjectURL(new Blob(lines, {type: 'text/csv'})));
var date = (new Date()).toISOString().replace(/T/, " ").replace(/:/g, "-").substr(0, 19);
a.attr("download", `${filename} ${date}.csv`);
a[0].click();
}
var lines = [];
for (var i = 0; i < (1024 * 1024 * 1024 / 100) - 2; i++) {
lines.push('"00undyz4rptM51rwy0h7","ACTIVE","123","jane.doe@gsroka.local","Jane","Doe","gabriel.sroka@okta.com"\n');
}
downloadCSV(lines, "test");
})();
I tested on 10+ mln of records
Thanks again for the patch. If you don't mind sharing your test code if it's different than mine.
Google has already approved it so you can update to version 26
For a huge amount of exported records doing lines.join("\n") could cause an exception:
This PR removes lines.join and put
\n
on each line duringgetObjects
.