@xhmikosr/decompress
Extracting archives made easy
Last updated 3 years ago by xhmikosr .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install @xhmikosr/decompress 
SYNC missed versions from official npm registry.

decompress CI

Extracting archives made easy

See decompress-cli for the command-line version.

Install

npm install @xhmikosr/decompress

Usage

import decompress from '@xhmikosr/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!');
});

Note that in the current implementation, filter is only applied after fully reading all files from the archive in memory. Do not rely on this option to limit the amount of memory used by decompress to the size of the files included by filter. decompress will read the entire compressed file into memory regardless.

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

Current Tags

  • 11.1.4                                ...           latest (4 months ago)
  • 10.2.2                                ...           release-v10 (4 months ago)

20 Versions

  • 10.2.2                                ...           4 months ago
  • 11.1.4                                ...           4 months ago
  • 10.2.1                                ...           6 months ago
  • 11.1.3                                ...           6 months ago
  • 11.1.2                                ...           7 months ago
  • 11.1.1                                ...           9 months ago
  • 11.1.0                                ...           9 months ago
  • 11.0.2                                ...           9 months ago
  • 11.0.1                                ...           9 months ago
  • 11.0.0                                ...           9 months ago
  • 10.2.0                                ...           a year ago
  • 10.1.0                                ...           a year ago
  • 10.0.1                                ...           3 years ago
  • 10.0.0                                ...           3 years ago
  • 9.0.1                                ...           3 years ago
  • 9.0.0                                ...           3 years ago
  • 8.0.0                                ...           3 years ago
  • 7.0.0                                ...           3 years ago
  • 6.0.0                                ...           4 years ago
  • 5.0.0                                ...           4 years ago
Maintainers (1)
Downloads
Total 53
Today 0
This Week 1
This Month 41
Last Day 0
Last Week 20
Last Month 2
Dev Dependencies (5)
Dependents (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE