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

286
Vistas
Workaround to download files larger than 50MB using Google Script

in a Google Script I have to download files larger than 50MB. Server that serve files support range command, so I can download chunks of files but I have problems during the merge process.

Following an example of the code I tried to use and the problem I faced (RangeError: Invalid array length)

let pieceSize = 52428800;
let steps = Math.ceil(fileSize / pieceSize);
let blobs = [];
let datas = null;
for (let i = 0; i < steps; i++){
   let b = "bytes=" +(i*pieceSize)+ "-"+Math.min((i+1)*pieceSize-1, fileSize);
   let params = {method: "get",    headers: {  Range: b, }, };
   Logger.log("Gettinng piece "+i+" : "+b);
   blobs.push(UrlFetchApp.fetch(url, params).getBlob());
   if (datas == null){
     datas = blobs[i].getBytes();
   } else {
     datas = datas.concat(blobs[i].getBytes()); // RangeError: Invalid array length
   }
}
let blob = Utilities.newBlob(datas);
let file = DriveApp.createFile(blob)

I looked for other solutions to merge downlaoded data (maybe as files, or as blobs?) but I can't find functions to reach my goal without moving to Byte[].

Thanks

about 4 years ago · Santiago Trujillo
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