Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

149
Vistas
Question regarding FileReader.readAsArrayBuffer()

If I have a big file (e.g. hundreds of MB) does FileReader.readAsArrayBuffer() read the entire file data into an ArrayBuffer?
According to [here[(https://developer.mozilla.org/en-US/docs/Web/API/FileReader/readAsArrayBuffer) this is what happens.

I have a big .zip file with multiple GB.
I'm concerned of taking the entire RAM when working e.g. on a mobile device.
Is there an alternative approach where a file handle is returned and a portion of the file is read as needed?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You can use Blob.stream() for this:

const bigBlob = new Blob(["somedata".repeat(10e5)]);
console.log("Will read a %sbytes Blob", bigBlob.size)
const reader = bigBlob.stream().getReader();
let chunks = 0;
reader.read().then(function processChunk({ done, value }) {
  if (done) {
    console.log("Stream complete. Read in %s chunks", chunks);
    return;
  }
  // do whatever with the chunk
  // 'value' is an ArrayBuffer here
  chunks++;
  return reader.read().then(processChunk);
}).catch(console.error);

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda