admin管理员组

文章数量:1323035

I'm quite JS newbie and I'm wondering about some idea.

Can javascript be used to download file/multiple files from given url/s on the client side and zip "the stream" on the fly?

I don't want this server side, because I don't want to download files to my server and zip then.

I'm quite JS newbie and I'm wondering about some idea.

Can javascript be used to download file/multiple files from given url/s on the client side and zip "the stream" on the fly?

I don't want this server side, because I don't want to download files to my server and zip then.

Share Improve this question asked Oct 4, 2014 at 10:10 web_newbieweb_newbie 511 silver badge2 bronze badges 2
  • by download do you mean upload, as in the user drags and drops a bunch of files and then they get zipped on the fly in the browser? – Hayko Koryun Commented Oct 4, 2014 at 10:21
  • No, my specific case is like this: I want to keep list of links to external resources on my server. Then the served should generate the webpage with js which will download those resources on the client side and zip them on the fly allowing to download dynamicaly created zip file on the client side. Is this somehow possible without using server bandwidth to download those resources but do it by browser? – web_newbie Commented Oct 4, 2014 at 10:26
Add a ment  | 

2 Answers 2

Reset to default 3

If the following use case is correct: user selects a bunch of files to zip and the browser zips them up and serves them back to the user.

Then you can use the following library: zip.js

You can check out the demo here

To solve this exact problem, I created a library to stream multiple files directly into a zip on the client-side. The main unique feature is that it has no size limits from memory (everything is streamed) nor zip format (it uses zip64 if the contents are more than 4GB).

Since it doesn't do pression, it is also very performant.

Find "downzip" it on npm or github!

本文标签: javascriptDownload and zip files client sideStack Overflow