Red de conocimiento informático - Aprendizaje de programación - ¿Cómo lee html5 FileaReader archivos en segmentos?

¿Cómo lee html5 FileaReader archivos en segmentos?

/*

* ArrayBuffer a cadena

* var str=Uint8ToString(new Uint8Array(arrayBufferData));

* */

function Uint8ToString(u8a){

var CHUNK_SZ = 0x8000;

var c = [];

for (var i= 0; i < u8a.length; i+=CHUNK_SZ) {

c.push(String.fromCharCode.apply(null, u8a.subarray(i, i+CHUNK_SZ)));

}

return c.join("");

}

//fReader.readAsBinaryString(dstring);

//str=fReader.result;

fReader.readAsArrayBuffer(dstring);

var arrayBufferData=fReader.result;

str=Uint8ToString(new Uint8Array( arrayBufferData));

Finalmente está hecho perfectamente. Debes agradecerme si es útil. No es fácil

Cortar por carácter y enviar resolverá tu problema