Decompress
Extracting archives made easy
Install / Use
/learn @kevva/DecompressREADME
decompress 
Extracting archives made easy
See decompress-cli for the command-line version.
Install
$ npm install 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!');
});
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<br>
Default: [decompressTar(), decompressTarbz2(), decompressTargz(), decompressUnzip()]
Array of plugins to use.
strip
Type: number<br>
Default: 0
Remove leading directory components from extracted files.
License
MIT © Kevin Mårtensson
Related Skills
node-connect
344.4kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
99.2kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
344.4kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
344.4kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
