Reputation: 11
I have an array of files and I want to create a zip file out of this array.
Is there a way to create zip files using jQuery?
Upvotes: 1
Views: 7284
Reputation: 43253
You can use the JSZip library mentioned by several people to create the zip. However, forcing a download from javascript and having it use a custom filename is a different matter.
HTML5 introduces a download
attribute on <a>
s. You could use it like this:
<a href="your_zip_data_uri_here" download="something.zip">download</a>
Which would force the download as "something.zip" in browsers supporting the download attribute. However, besides this, there is no way to do it from JavaScript.
Upvotes: 5