{"id":13447480,"url":"https://github.com/sindresorhus/multi-download","last_synced_at":"2025-05-16T01:06:58.851Z","repository":{"id":16627926,"uuid":"19383004","full_name":"sindresorhus/multi-download","owner":"sindresorhus","description":"Download multiple files at once in the browser","archived":false,"fork":false,"pushed_at":"2023-09-21T03:42:26.000Z","size":327,"stargazers_count":568,"open_issues_count":5,"forks_count":49,"subscribers_count":13,"default_branch":"main","last_synced_at":"2025-05-03T07:27:22.964Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://sindresorhus.com/multi-download/","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"tomjohnson1492/documentation-theme-jekyll","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sindresorhus.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null},"funding":{"github":"sindresorhus","open_collective":"sindresorhus","custom":"https://sindresorhus.com/donate"}},"created_at":"2014-05-02T17:38:13.000Z","updated_at":"2025-03-05T21:45:33.000Z","dependencies_parsed_at":"2023-09-24T07:15:37.280Z","dependency_job_id":null,"html_url":"https://github.com/sindresorhus/multi-download","commit_stats":{"total_commits":32,"total_committers":9,"mean_commits":"3.5555555555555554","dds":0.25,"last_synced_commit":"523045871dcc6de0d3661b5aff09e7a9dfc6d8fd"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Fmulti-download","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Fmulti-download/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Fmulti-download/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Fmulti-download/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sindresorhus","download_url":"https://codeload.github.com/sindresorhus/multi-download/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252923692,"owners_count":21825910,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T05:01:18.945Z","updated_at":"2025-05-16T01:06:53.833Z","avatar_url":"https://github.com/sindresorhus.png","language":"HTML","funding_links":["https://github.com/sponsors/sindresorhus","https://opencollective.com/sindresorhus","https://sindresorhus.com/donate"],"categories":["JavaScript","HTML","others"],"sub_categories":[],"readme":"# multi-download\n\n\u003e Download multiple files at once in the browser\n\n![](screenshot.gif)\n\nIt works by abusing the `a`-tag [`download` attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#attr-download).\n\n## [Demo](https://sindresorhus.com/multi-download/)\n\n## Install\n\n```sh\nnpm install multi-download\n```\n\n*Note: This package targets the latest versions of Chrome, Firefox, and Safari.*\n\n## Usage\n\n```html\n\u003cbutton id=\"download-button\" data-files=\"unicorn.jpg rainbow.jpg\"\u003eDownload\u003c/button\u003e\n```\n\n```js\nimport multiDownload from 'multi-download';\n\ndocument.querySelector('#download-button').addEventListener('click', event =\u003e {\n\tconst files = event.target.dataset.files.split(' ');\n\tmultiDownload(files);\n});\n```\n\n```js\nimport multiDownload from 'multi-download';\n\n// With jQuery\n$('#download-button').on('click', () =\u003e {\n\tconst files = $(this).data('files').split(' ');\n\tmultiDownload(files);\n});\n```\n\n```js\nimport multiDownload from 'multi-download';\n\n// With Blob\nconst unicorn = URL.createObjectURL(new Blob(['🦄'], {type: 'text/plain'}));\nconst goat = URL.createObjectURL(new Blob(['🐐'], {type: 'text/plain'}));\nmultiDownload([unicorn, goat]);\n```\n\n## API\n\n### multiDownload(urls, options?)\n\nReturns a `Promise` that resolves when all the downloads have started.\n\nNote that there's a delay of 1 second between each download.\n\n#### urls\n\nType: `string[]`\n\nThe URLs to files you want to download. Can be absolute or relative, even cross-origin.\n\n#### options\n\nType: `object`\n\n##### rename\n\nType: `Function`\n\nA function that accepts an object containing `url`, `index`, and `urls` properties and is expected to return the new filename.\n\n```html\n\u003cbutton id=\"download-button\" data-files=\"unicorn.jpg rainbow.jpg\"\u003eDownload\u003c/button\u003e\n```\n\n```js\nimport multiDownload from 'multi-download';\n\ndocument.querySelector('#download-button').addEventListener('click', event =\u003e {\n\tconst files = event.target.dataset.files.split(' ');\n\tmultiDownload(files, {\n\t\trename: ({url, index, urls}) =\u003e 'New name.pdf'\n\t});\n});\n```\n\n## Caveats\n\nIf the user has enabled \"Ask where to save each file before downloading\" in Chrome, it will only download the first file.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsindresorhus%2Fmulti-download","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsindresorhus%2Fmulti-download","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsindresorhus%2Fmulti-download/lists"}