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

182
Vistas
Big size file download

On my web page I have the following JS code to download file from server on user click:

var oReq = new XMLHttpRequest();
oReq.open("POST", otherUrl, true);
oReq.responseType = "arraybuffer";

oReq.onload = function(oEvent) {
    var blob = new Blob([oReq.response], 
                        {type: oReq.getResponseHeader('Content-Type')});
    var objectURL = URL.createObjectURL(blob);
    downloadLink.href = objectURL;
    downloadLink.click();
};
oReq.onprogress = function(oEvent) {
    var percentage = Math.round(oEvent.loaded/oEvent.total*100);
    
    downloadProgressDiv.innerHTML = "Progress: " + percentage + " % (" + oEvent.loaded 
                                    + " from " + oEvent.total + " )";
};
oReq.send(this.path);

It works for files below 1GB size. The issue I came across happens when file size I'm trying to download is about 3GB. In this case onprogress method works as with other files, onload method is invoked once download is completed, but oReq.response=null. Also I'm able to save the file, but its size is 1KB.

Could you, please, give me any tips why does this happens? Any alternative ways of doing this?

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

0

any tips why does this happens?

Probably because the browser runs out of memory, when you ask it to create an object URL for an object of such size.

Any alternative ways of doing this?

Don't use AJAX, but instead submit a form with method="post" to send whatever parameters you need for this.

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