decompress

Extracting archives made easy

decompress

Extracting archives made easy

See decompress-cli for the command-line version.

$ npm install --save decompress
const Decompress = require('decompress');
 
new Decompress({mode: '755'})
.src('foo.zip')
.dest('dest')
.use(Decompress.zip({strip: 1}))
.run();

Creates a new Decompress instance.

Type: string

Set mode on the extracted files, i.e { mode: '755' }.

Type: number

Equivalent to --strip-components for tar.

Type: array, buffer or string

Set the files to be extracted.

Type: string

Set the destination to where your file will be extracted to.

Type: function

Add a plugin to the middleware stack.

Extract your file with the given settings.

Type: function

The callback will return an array of vinyl files in files.

The following plugins are bundled with decompress:

Extract TAR files.

const Decompress = require('decompress');
 
new Decompress()
.use(Decompress.tar({strip: 1}));

Extract TAR.BZ files.

const Decompress = require('decompress');
 
new Decompress()
.use(Decompress.tarbz2({strip: 1}));

Extract TAR.GZ files.

const Decompress = require('decompress');
 
new Decompress()
.use(Decompress.targz({strip: 1}));

Extract ZIP files.

const Decompress = require('decompress');
 
new Decompress()
.use(Decompress.zip({strip: 1}));

MIT © Kevin Mårtensson