admin管理员组

文章数量:1323738

I found a javascript plugin that could generate zip files, its called jszip.

I tried it, but I think it could only generate the files that will be piled in a zip file.

What I want is to be able to add existing files to the zip file that it will generate. Is it possible in JavaScript?

I found a javascript plugin that could generate zip files, its called jszip.

I tried it, but I think it could only generate the files that will be piled in a zip file.

What I want is to be able to add existing files to the zip file that it will generate. Is it possible in JavaScript?

Share Improve this question edited Aug 3, 2019 at 1:08 Emma 27.8k11 gold badges48 silver badges71 bronze badges asked Nov 2, 2011 at 4:52 user225269user225269 10.9k70 gold badges178 silver badges254 bronze badges 0
Add a ment  | 

1 Answer 1

Reset to default 6

Scroll down to the Documentation section on the page you linked to. It describes plainly how to add files to the zip file. For binary files you'll end up using base64, it looks like. For text files you can pass them straight in as strings. Of course you'll need access to the file data in order to add it to the zip file, which is easy enough if you're, say, retrieving said data in an Ajax request, but an uphill battle if you want the user to be able to zip files from his or her local storage.

本文标签: How to create zip files using javascriptStack Overflow