Skip to content Skip to sidebar Skip to footer

Firefox Downloading Multiple Files At Once Not Possible?

Downloading multiple blobs in chrome, edge and IE doesn't seem to be a problem, but on Firefox I'm having the problem that most of the time only the last file or max. 2 of them wil

Solution 1:

What you are trying to do is called a "carpet-bomb".

It consists in flooding the user's disk with a lot of files until it runs out of space. In itself, the security risk is quite low even though it may lead to a system crash, it's more boring than any dangerous. But still, there might be some situations where it can lead to unexpected flaw, like it was the case with the "Safari carpet-bomb" attack. And maybe more importantly, that's rarely a good UX to have loads of files piling up in the downloads folder along with other unrelated files.

So browsers are actually quite open to tamper this issue, and most have some system in place to avoid this.


Now, there are probably a lot of workarounds to these tamper-systems, but I don't feel it's what you need.

You asked "if there is a better solution than [your] current approach", and the answer is a big YES.

If all your files are available to download in a single click, then pack them in a single file to download.

You can do so by generating a zip file from all your Blobs using one of the many zipping library, or even other compression algorithm depending on your target-clients.

const blobs = "This is a sample text that will get split in chunks of separate text files"
  .split(' ')
  .map((txt) =>newBlob([txt])); 

const zip = newJSZip();
const folder = zip.folder('some-words');

blobs.forEach((blob, i) =>
  folder.file(`a-word_${i}.txt`, blob)
);

zip.generateAsync({type : "blob"})
  .then(zip_blob => {
    dl.href = URL.createObjectURL(zip_blob);
    dl.download = "myfiles.zip";
  });
<!-- using JSZip library https://stuk.github.io/jszip/ --><scriptsrc="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.2.0/jszip.min.js"></script><aid="dl">download</a>

Post a Comment for "Firefox Downloading Multiple Files At Once Not Possible?"