最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Download and zip files client side - Stack Overflow

programmeradmin4浏览0评论

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!

发布评论

评论列表(0)

  1. 暂无评论