Reputation: 4341
I am working on a web app that amongst other things, does a first conversion reading a .csv file and converting to a .xml file.
I have a file of 20 mb, which is well processed (so the code is ok).
But I have a file of 80 mb, and the process stops with the message in the Error Console
Error: allocation size overflow
And it points to the last line of an object that stores a large xml string.
The code basically splits the .csv file, for each line splits again the line, and then re-builds the content with xml tags which are added to the variable.
Then I assume that with 80 mb (.csv file) the size of the string is just too big for Firefox.
My question is, is there anything that I can do about it, like splitting the variable or similar workarounds? Or this would be a loss of time?
Thanks
Upvotes: 5
Views: 9082
Reputation: 45
this question looks very old but I have found some solution for this. You can use the URL API's for modern browsers.
var file = document.getElementById('video').files[0];
window.URL = window.URL || window.webkitURL;
var video = document.querySelector("#vid");
video.preload = 'metadata';
video.onloadedmetadata = function() {
window.URL.revokeObjectURL(this.src);
let time = video.duration;
console.log(video.duration);
}
video.src = URL.createObjectURL(file);
Upvotes: 0