ZipZipTop is a nodejs modules which relies on jszip. It allows to simply add files & recursive folder in a zip.
Installation
$ npm install zip-zip-top
Examples
var ZipZipTop = require("zip-zip-top");
var zip = new ZipZipTop();
zip.file("hello.txt","Hello World!");
zip.writeToFile("text.zip");
var zip2 = new ZipZipTop();
var jsFolder = zip2.folder("js");
jsFolder.file("hello.js","alert("hello world")");
zip2.writeToFile("folder.zip");
var zip3 = new ZipZipTop();
zip3.addFile("main.js","easyzip.js",function(err){
if(err) {
console.log(err);
}
zip3.writeToFile("file.zip");
});
var zip4 = new ZipZipTop();
zip4.zipFolder("../myfolder",function(err){
if(err) {
console.log(err);
}
zip4.writeToFile("folder.zip", function(err) {
if(err) {
return console.log(err);
}
console.log("Done");
});
});
var zip6 = new ZipZipTop();
zip6.zipFolder("../myfolder",function(){
if(err) {
console.log(err);
}
zip6.writeToFile("myfolder.zip", function(err) {
if(err) {
return console.log(err);
}
console.log("Done");
});
}, {rootFolder: "newRootFolder"});
License
MIT