Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

278
Views
jquery fileDownload: descargue varios archivos en fragmentos

Estoy usando https://github.com/johnculviner/jquery.fileDownload para descargar una serie de archivos. Parece funcionar:

 for (var index = 0; index < files.length; ++index) { var file = files[index]; $.fileDownload(file) .done(function() { alert("Done " + file); } ) .fail(function() { alert("Fail " + file); } ); }

¿Cómo puedo descargar los archivos en fragmentos de 5 archivos a la vez? Los archivos se están descargando, pero no se muestra ninguna alerta por el momento. Así que creo que tal vez tengo un problema aquí.

Cuando trato de descargar 100 archivos, por ejemplo, quiero descargar 5, luego otros 5, etc. hasta terminar con todos. es posible?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Descargar primer archivo

 var firstfile = files[0]; //first file id var downloadresult = downloadFileEx(firstfile);

Luego encadene otros archivos con jquery y luego use array.slice para elegir el fragmento

 var begin=1; // start from second file var end=5; do { for (var index = begin; index < files.slice(begin, end).length; i++) { var file = files[index]; (function (index) { downloadresult = downloadresult.then(function() { return downloadFileEx(array[index]); }); }(index)); } index++; } begin = begin +5; end = end + 5; } while (end < files.length);

escribir la función de descarga de archivos

 function downloadFileEx(file) { return $.fileDownload(file) .done(function() { alert("Done " + file); // remove this 100 alerts will be blocked by browser, maintain an array of files } ) .fail(function() { alert("Fail " + file); } ); }
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!