|
9 years ago | |
---|---|---|
.. | ||
bin | 9 years ago | |
lib | 9 years ago | |
node_modules | 9 years ago | |
test | 9 years ago | |
.editorconfig | 9 years ago | |
.jshintrc | 9 years ago | |
.npmignore | 9 years ago | |
.travis.yml | 9 years ago | |
Gruntfile.js | 9 years ago | |
README.md | 9 years ago | |
download-test-assets.js | 9 years ago | |
package.json | 9 years ago |
Extract files from a ZIP archive
Extracts the contents of the ZIP archive file
.
Returns an EventEmitter with two possible events - error
on an error, and extract
when the extraction has completed. The value passed to the extract
event is a basic log of each file and how it was compressed.
Options
.
)false
)null
)strip Number - Remove leading folders in the path structure. Equivalent to --strip-components
for tar.
var DecompressZip = require('decompress-zip');
var unzipper = new DecompressZip(filename)
unzipper.on('error', function (err) {
console.log('Caught an error');
});
unzipper.on('extract', function (log) {
console.log('Finished extracting');
});
unzipper.extract({
path: 'some/path',
filter: function (file) {
return file.type !== "SymbolicLink";
}
});
If path
does not exist, decompress-zip will attempt to create it first.
Much like extract, except:
list
there are no options
var DecompressZip = require('decompress-zip');
var unzipper = new DecompressZip(filename)
unzipper.on('error', function (err) {
console.log('Caught an error');
});
unzipper.on('list', function (files) {
console.log('The archive contains:');
console.log(files);
});
unzipper.list();
Released under the MIT License.