JSPM

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

Easily extract archives

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

Easily extract archives

Install

$ npm install --save decompress

Usage

var Decompress = require('decompress');

var decompress = new Decompress({ mode: 755 })
    .src('foo.zip')
    .dest('destFolder')
    .use(Decompress.zip({ strip: 1 }));

decompress.run(function (err) {
    if (err) {
        throw err;
    }

    console.log('Archive extracted successfully!');
});

API

new Decompress(opts)

Creates a new Decompress instance.

.src(files)

Set the files to be decompress. Takes a buffer, glob string or an array of glob strings as argument.

.dest(path)

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

.use(plugin)

Add a plugin to the middleware stack.

.run(cb)

Extract your file with the given settings.

Options

mode

Type: Number
Default: null

Set mode on the extracted files.

Plugins

The following plugins are bundled with decompress:

  • tar — Extract TAR files.
  • tar.bz — Extract TAR.BZ files.
  • tar.gz — Extract TAR.GZ files.
  • zip — Extract ZIP files.

.tar()

Extract TAR files.

var Decompress = require('decompress');

var decompress = new Decompress()
    .use(Decompress.tar({ strip: 1 }));

.tarbz()

Extract TAR.BZ files.

var Decompress = require('decompress');

var decompress = new Decompress()
    .use(Decompress.tarbz({ strip: 1 }));

.targz()

Extract TAR.GZ files.

var Decompress = require('decompress');

var decompress = new Decompress()
    .use(Decompress.targz({ strip: 1 }));

.zip()

Extract ZIP files.

var Decompress = require('decompress');

var decompress = new Decompress()
    .use(Decompress.zip({ strip: 1 }));

CLI

$ npm install --global decompress
$ decompress --help

Usage
  $ decompress <file> [directory]

Example
  $ decompress --strip 1 file.zip out

Options
  -m, --mode     Set mode on the extracted files
  -s, --strip    Equivalent to --strip-components for tar

License

MIT © Kevin Mårtensson