Download Multiple Files at Once in the Browser | multi-download

Multi Downloader is a pure JavaScript library that allows the user to download and rename multiple files from the browser at once.

download multiple files from url list, download multiple files at once, download multiple files from website, download all files from a website, download multiple files javascript

How to make use of it:

Install and import the multiple download library.

# NPM
$ npm install multi-download --save
import multiDownload from 'multi-download';

Create a download button and specify file paths in the data files attribute.

<button id="download-rename-button" 
        data-files="1.zip 2.zip 3.zip">
        Download multiple files and rename them
</button>

JavaScript to download multiple files by simply clicking the download button.

// Vanilla JS
document.querySelector('#download-button').addEventListener('click', event => {
  const files = event.target.dataset.files.split(' ');
  multiDownload(files);
});
// With jQuery
$('#download-button').on('click', () => {
  const files = $(this).data('files').split(' ');
  multiDownload(files);
});
// With Blob
const unicorn = URL.createObjectURL(new Blob([blobData], {type: 'text/plain'}));
const goat = URL.createObjectURL(new Blob(['blobData'], {type: 'text/plain'}));
multiDownload([unicorn, goat]);

API

multiDownload(urls, options?)

Returns a Promise that resolves when all the downloads have started.

Note that there’s a delay of 1 second between each download.

urls

Type: string[]

The URLs to files you want to download. Can be absolute or relative, even cross-origin.

options

Type: object

rename

Type: Function

A function that accepts an object containing urlindex, and urls properties and is expected to return the new filename.

Download Mutiple Files From The Browser At Once, multi-download Plugin/Github, download multiple files as zip using javascript


See Demo And Download

Official Website(sindresorhus): Click Here

This superior jQuery/javascript plugin is developed by sindresorhus. For extra Advanced Usage, please go to the official website.

Share