JSPM

  • Created
  • Published
  • Downloads 3105518
  • Score
    100M100P100Q189121F
  • License MIT

Extracting archives made easy

Package Exports

  • decompress

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (decompress) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

decompress Build Status

Extracting archives made easy

See decompress-cli for the command-line version.

Install

$ npm install --save decompress

Usage

const decompress = require('decompress');

decompress('unicorn.zip', 'dist').then(files => {
    console.log('done!');
});

API

decompress(input, [output], [options])

Returns a Promise for an array of files in the following format:

{
    data: Buffer,
    mode: Number,
    mtime: String,
    path: String,
    type: String
}

input

Type: string Buffer

File to decompress.

output

Type: string

Output directory.

options

filter

Type: Function

Filter out files before extracting. E.g:

decompress('unicorn.zip', 'dist', {
    filter: file => path.extname(file.path) !== '.exe'
}).then(files => {
    console.log('done!');
});
map

Type: Function

Map files before extracting: E.g:

decompress('unicorn.zip', 'dist', {
    map: file => {
        file.path = `unicorn-${file.path}`;
        return file;
    }
}).then(files => {
    console.log('done!');
});
plugins

Type: Array
Default: [decompressTar(), decompressTarbz2(), decompressTargz(), decompressUnzip()]

Array of plugins to use.

strip

Type: number
Default: 0

Remove leading directory components from extracted files.

License

MIT © Kevin Mårtensson