I'm using the following to download a file created with JavaScript in a vue
project on the client side that also uses json2csv
.
// console.log('wtf all 200 rows are here!', modifiedData);
const csv = json2csvParser.parse(modifiedData);
let content = 'data:text/csv;charset=utf-8,';
content += csv;
const data = encodeURI(content);
const link = document.createElement('a');
link.setAttribute('href', data);
link.setAttribute('download', 'errors_totalcost.csv');
link.click();
But for some reason the file only has 29 rows instead of all 200. The above code doesn't work at all in firefox, but use to work in chrome, now it's broken in chrome and truncates the file.
Can anybody explain what is wrong and how to resolve it while still creating file on client side?