You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
rdrew
1440706ce3
|
6 years ago | |
---|---|---|
.. | ||
node_modules | 6 years ago | |
index.js | 6 years ago | |
license | 6 years ago | |
package.json | 6 years ago | |
readme.md | 6 years ago |
readme.md
decompress
Extracting archives made easy
See decompress-cli for the command-line version.
Install
$ npm install --save decompress
Usage
const Decompress = require('decompress');
new Decompress({mode: '755'})
.src('foo.zip')
.dest('dest')
.use(Decompress.zip({strip: 1}))
.run();
API
new Decompress(options)
Creates a new Decompress
instance.
options.mode
Type: string
Set mode on the extracted files, i.e { mode: '755' }
.
options.strip
Type: number
Equivalent to --strip-components
for tar.
.src(files)
files
Type: array
, buffer
or string
Set the files to be extracted.
.dest(path)
path
Type: string
Set the destination to where your file will be extracted to.
.use(plugin)
plugin
Type: function
Add a plugin
to the middleware stack.
.run(callback)
Extract your file with the given settings.
callback(err, files)
Type: function
The callback will return an array of vinyl files in files
.
Plugins
The following plugins are bundled with decompress:
- tar — Extract TAR files.
- tar.bz2 — Extract TAR.BZ files.
- tar.gz — Extract TAR.GZ files.
- zip — Extract ZIP files.
.tar(options)
Extract TAR files.
const Decompress = require('decompress');
new Decompress()
.use(Decompress.tar({strip: 1}));
.tarbz2(options)
Extract TAR.BZ files.
const Decompress = require('decompress');
new Decompress()
.use(Decompress.tarbz2({strip: 1}));
.targz(options)
Extract TAR.GZ files.
const Decompress = require('decompress');
new Decompress()
.use(Decompress.targz({strip: 1}));
.zip(options)
Extract ZIP files.
const Decompress = require('decompress');
new Decompress()
.use(Decompress.zip({strip: 1}));
License
MIT © Kevin Mårtensson