New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@aarnavtale/decompress

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package was removed
Sorry, it seems this package was removed from the registry

@aarnavtale/decompress

Extracting archives made easy

6.1.0
unpublished
Source
npm
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

@xingrz/decompress test

license issues stars commits

Extracting archives made easy.

Plugins

packageversionformat
@xingrz/decompress-tar*.tar
@xingrz/decompress-tarbz2*.tar.bz2
@xingrz/decompress-targz*.tar.gz
@xingrz/decompress-tarzst*.tar.zst
@xingrz/decompress-unzip*.zip
Plugin API

Install

npm install --save @xingrz/decompress

Usage

import decompress from 'decompress';

const files = await decompress('unicorn.zip', 'dist');
console.log('done!');

API

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

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

interface File {
	path: string;
	type: 'file' | 'link' | 'symlink' | 'directory';
	mode: number;
	mtime: Date | string;
	data?: Buffer;
}

If output is not presented, data will be populated with the content of the file. Otherwise the file will be written to disk and the data will be undefined.

input

Type: string | Buffer

Path of file or Buffer to decompress.

output

Type: string (optional)

Path to output directory.

options
filter

Type: (file: File) => boolean

Filter out files before extracting. E.g:

const files = await decompress('unicorn.zip', 'dist', {
	filter: file => path.extname(file.path) !== '.exe'
});
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: (file: File) => File

Map files before extracting: E.g:

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

Type: DecompressPlugin[]

Array of plugins to use. See @xingrz/decompress-types for full definitions.

strip

Type: number (default: 0)

Remove leading directory components from extracted files.

License

MIT © Kevin Mårtensson, XiNGRZ

Keywords

bz2

FAQs

Package last updated on 20 Feb 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts