file-zip-s
v2.0.4
Published
The file folder compression, decompression of the compressed package
Downloads
13
Maintainers
Readme
file-zip
The file folder compression, decompression of the compressed package
Installation:
npm install file-zip --save
Usage:
var zip = require('file-zip');
/*compressed folder*/
zip.zipFolder(['./folder1','./folder2'],'out.zip',function(err){
if(err){
console.log('zip error',err)
}else{
console.log('zip success');
}
})
/*compressed file*/
zip.zipFile(['./file1.txt','./file2.txt'],'out.zip',function(err){
if(err){
console.log('zip error',err)
}else{
console.log('zip success');
}
})
/*decompression*/
zip.unzip('out.zip','dist',function(err){
if(err){
console.log('unzip error',err)
}else{
console.log('unzip success');
}
})
API:
zipFolder(path,name,callback)
path
string or array, compressed folder pathname
string,output compressed file pathcallback
function,callback function after completion of the event
zipFile(path,name,callback)
path
string or array, compressed file pathname
string,output compressed file pathcallback
function,callback function after completion of the event
unzip(name,dist,callback)
name
string, file path to be unzippeddist
string,output file pathcallback
function,callback function after completion of the event