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

146
Views
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
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!