javascript - expoting big data to csv file - carshes -


im trying export big data csv files. (above 20000 lines... can on 100000 lines easily). after try download file, crashes - download failed due network failures. (managed download 18000 lines file, weighs 1.7mb, code worked perfectly. above 20000 download crashes)

heres code... thanks!

edit- works on ie, doesnt work in chrome

var data2 =     [[data12]]; var csvcontent2 = ""; data2.foreach(function (infoarray, index) {      datastring = array.prototype.join.call(infoarray, "");     csvcontent2 += index < data2.length ? datastring + '\n' : datastring;  });  var download = function(content, filename, mimetype) { var = document.createelement('a');     mimetype = mimetype || 'application/octet-stream';      if (navigator.mssaveblob) { // ie10         return navigator.mssaveblob(new blob([content], { type: mimetype }), filename);     } else if ('download' in a) { //html5 a[download]         a.href = 'data:' + mimetype + ',' + encodeuricomponent(content);         a.setattribute('download', filename);         document.body.appendchild(a);         settimeout(function() {         a.click();         document.body.removechild(a);         }, 66);     return true; } else { //do iframe dataurl download (old ch+ff):     var f = document.createelement('iframe');     document.body.appendchild(f);     f.src = 'data:' + mimetype + ',' + encodeuricomponent(content);      settimeout(function() {         document.body.removechild(f);     }, 333);     return true;     } }      download(csvcontent2, 'groupb.csv', 'text/csv'); 

warning, there limits url, example total length of url including get, must not exceed 2000+ characters on ie, maybe you'll hit maximum size large csv file ?
how long uri ? see this link ie uri limit.

edit : maybe can try createobjecturl(blob), not stabilized feature :x


Comments

Popular posts from this blog

angular - Is it possible to get native element for formControl? -

unity3d - Rotate an object to face an opposite direction -

javascript - Why jQuery Select box change event is now working? -