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

192
Views
Cambiar el nombre de los archivos antes de comprimirlos y descargarlos con JSZip

Pude integrar la descarga de archivos JSzip en mi sitio web copiando y modificando su descargador de ejemplo en este enlace: https://stuk.github.io/jszip/documentation/examples/downloader.html

El código js principal que se usa a continuación se usa para iniciar la descarga

 var $form = $("#download_form").on("submit", function () { resetMessage(); var zip = new JSZip(); // find every checked item $(this).find(":checked").each(function () { var $this = $(this); var url = $this.data("url"); var filename = url.replace(/.*\//g, ""); zip.file(filename, urlToPromise(url), {binary:true}); }); // when everything has been downloaded, we can trigger the dl zip.generateAsync({type:"blob"}, function updateCallback(metadata) { var msg = "progression : " + metadata.percent.toFixed(2) + " %"; if(metadata.currentFile) { msg += ", current file = " + metadata.currentFile; } showMessage(msg); updatePercent(metadata.percent|0); }) .then(function callback(blob) { // see FileSaver.js saveAs(blob, "example.zip"); showMessage("done !"); }, function (e) { showError(e); }); return false; });

Sin embargo, quiero poder cambiar el nombre de los archivos descargados antes de que el script los empaquete para que chair.jpg, table.jpg, etc. se empaqueten como funiture01.jpg, funiture02.jpg, etc.

Leí en alguna parte que tengo que crear un nuevo archivo a partir de los archivos marcados y cambiar el nombre con javascript, pero no estoy seguro de cómo proceder en este momento.

about 4 years ago · Juan Pablo Isaza
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!