zipacker
v0.3.0
Published
Zip and download files in client side.
Downloads
5
Readme
zipacker
Zip and download files in client side.
Demo
Download
Installation
You can also install zipacker by using Bower.
bower install zipacker
Requirements
Usage
var zip = new Zipacker({
// download zip file name, default is 'download.zip'
zipFile: 'download.zip',
// password of zip
// password: '1234'
// events
onProgress: function (progress, total) {},
onDone: function () {},
onError: function (e) {}
});
// add file or files to root
zip.add(['http://host/file1.jpg', 'rel/path/file2.jpg']); // put in root
zip.add(['http://host/file1.jpg', 'rel/path/file2.jpg'], 'dir'); // put in 'dir' folder
zip.add('file3.jpg'); // file3.jpg in root
// add file or files to folder
zip.add('file4.jpg', 'folder/in/zip/'); // folder/in/zip/file4.jpg
zip.add('file4.jpg', 'path/to/new.jpg'); // path/to/new.jpg
// add files and rename
zip.add({
'http://host/file5.jpg': 'new.jpg', // new.jpg in root
'file6.jpg': 'folder/in/zip/new2.jpg', // folder/in/zip/new2.jpg
'file7.jpg': 'folder/in/zip/' // folder/in/zip/file7.jpg
});
// add blob
zip.add(blob, 'file.bin');
zip.addBlob(blob, 'file.bin');
// add text
zip.addText('Hello zip', 'file.txt');
// add addData64URI
zip.addData64URI('data:image/png;base64,...', 'file.png');
zip.download();
License
The project is released under the MIT license.
Contact
The project's website is located at https://github.com/emn178/zipacker
Author: Chen, Yi-Cyuan ([email protected])