Skip to content Skip to sidebar Skip to footer

Using Javascript FileReader With Huge Files

I have a problem using the Javascript FileRead trying to read huge files. For example, I have a text file of 200mb and everytime I read this file the code stops working. Its possib

Solution 1:

This will only read the first 10 mb:

var file = form.getEl().down('input[type=file]').dom.files[0];
var reader = new FileReader();

reader.onload = function(e) {
    var data = e.target.result;
    form.displayedData = data;
};

reader.readAsText(file.slice(0, 10 * 1024 * 1024));

Post a Comment for "Using Javascript FileReader With Huge Files"