
Security News
TypeScript is Porting Its Compiler to Go for 10x Faster Builds
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
@aarnavtale/decompress
Advanced tools
Extracting archives made easy.
package | version | format |
---|---|---|
@xingrz/decompress-tar | *.tar | |
@xingrz/decompress-tarbz2 | *.tar.bz2 | |
@xingrz/decompress-targz | *.tar.gz | |
@xingrz/decompress-tarzst | *.tar.zst | |
@xingrz/decompress-unzip | *.zip |
npm install --save @xingrz/decompress
import decompress from 'decompress';
const files = await decompress('unicorn.zip', 'dist');
console.log('done!');
decompress(input[, output][, options])
Returns a Promise for an array of File
s 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.
MIT © Kevin Mårtensson, XiNGRZ
FAQs
Did you know?
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.
Security News
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
Research
Security News
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.