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

147
Vistas
FileSaver.js saving zip in Firefox not working

I'm trying to create a file selection / download.

I use JSZip for creating the .zip file and Filesaver.js for the download part.

It works fine with 'text/plain' MIME type on both Firefox and Chrome but not working with the blob returned by JSZip which is an 'application/zip' MIME on Firefox.

Here are both blob console.log results on Firefox :

console.logs

Here is the code:

function handleDownloadRequest(ids){

  //Define files urls
  //Some code to fill the fileUrls array
  var fileUrls = []
  ...

  //Download & zip
  const zip = new JSZip();
  let count = 0;
  const zipFilename = 'Files_Archive' + new Date().toLocaleDateString() +'.zip'
  fileUrls.forEach(async function (url) {
    console.log(url)
    const urlArr = url.split('/');
    const filename = urlArr[urlArr.length - 1];

    try {
      const file = await JSZipUtils.getBinaryContent(url)
      zip.file(filename, file, { binary: true });
      count++;

      if (count === fileUrls.length) {
        zip.generateAsync({ type: 'blob' })
        .then(function (content) {

          //Working
          /*let blob = new Blob(["Hello, world!"], { type: "text/plain;charset=utf-8" });
          console.log(blob)
          FileSaver.saveAs(blob, "hello world.txt");*/

          //Not working on Firefox
          console.log(content)
          FileSaver.saveAs(content, zipFilename);

        });
      }
    } catch (err) {
      console.log(err);
    }
  });

}

In JSZip's documentation there's a part where they talk about a different behavior of the saveAs function on Firefox but that didn't help me :

Under the hood, the polyfill uses the native saveAs from the FileSaver API (on Chrome and IE10+) or use a Blob URL (on Firefox).

Any clue will be much appreciated

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