decompress-targz

decompress tar.gz plugin

decompress-targz

tar.gz decompress plugin

$ npm install --save decompress-targz
var Decompress = require('decompress');
var targz = require('decompress-targz');
 
var decompress = new Decompress()
    .src('foo.tar.gz')
    .dest('dest')
    .use(targz({ strip: 1 }));
 
decompress.run(function (errfiles) {
    if (err) {
        throw err;
    }
 
    console.log('Files extracted successfully!'); 
});

You can also use this plugin with gulp:

var gulp = require('gulp');
var targz = require('decompress-targz');
 
gulp.task('default', function () {
    return gulp.src('foo.tar.gz')
        .pipe(targz({ strip: 1 }))
        .pipe(gulp.dest('dest'));
});

Type: Number
Default: 0

Equivalent to --strip-components for tar.

MIT © Kevin Mårtensson