# @xhmikosr/decompress

> Extracting archives made easy

Latest version **11.1.4** (published 2026-08-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install @xhmikosr/decompress
pnpm add @xhmikosr/decompress
yarn add @xhmikosr/decompress
bun add @xhmikosr/decompress
```

## Health

**Score 60/100 (C)** — status: active.

Positive: esm support; no vulnerabilities; recently updated; high maintenance score.

Warnings: low downloads; no types.

## Facts

| | |
|---|---|
| Version | 11.1.4 |
| Published | 2026-08-05 |
| First published | 2023-03-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | >=20 |
| Dependencies | 6 |
| Unpacked size | 14.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 10 |
| Author | Kevin Mårtensson |
| Maintainers | xhmikosr |
| Keywords | bz2, bzip2, decompress, extract, tar, tar.bz, tar.gz, zip, unzip |

## Links

- npm: https://www.npmjs.com/package/@xhmikosr/decompress
- Repository: https://github.com/XhmikosR/decompress
- Homepage: https://github.com/XhmikosR/decompress#readme
- Issues: https://github.com/XhmikosR/decompress/issues
- npm.io page: https://npm.io/package/@xhmikosr/decompress

## Dependencies (6)

- [strip-dirs](https://npm.io/package/strip-dirs.md) ^3.0.0
- [graceful-fs](https://npm.io/package/graceful-fs.md) ^4.2.11
- [@xhmikosr/decompress-tar](https://npm.io/package/@xhmikosr/decompress-tar.md) ^9.0.2
- [@xhmikosr/decompress-targz](https://npm.io/package/@xhmikosr/decompress-targz.md) ^9.0.1
- [@xhmikosr/decompress-unzip](https://npm.io/package/@xhmikosr/decompress-unzip.md) ^8.2.1
- [@xhmikosr/decompress-tarbz2](https://npm.io/package/@xhmikosr/decompress-tarbz2.md) ^9.0.2

## Alternatives

- [lodash.startswith](https://npm.io/package/lodash.startswith.md) — 769.7K weekly downloads
- [@tarojs/service](https://npm.io/package/@tarojs/service.md) — 33.9K weekly downloads
- [io.extendreality.tilia.indicators.spatialtargets.unity](https://npm.io/package/io.extendreality.tilia.indicators.spatialtargets.unity.md) — 131 weekly downloads
- [@rtarojs/taro](https://npm.io/package/@rtarojs/taro.md) — 90 weekly downloads
- [node-branch-io](https://npm.io/package/node-branch-io.md) — 50 weekly downloads

## Recent versions

- 11.1.4 (latest) — 2026-08-05
- 10.2.2 (release-v10) — 2026-08-05
- 10.2.1 — 2026-05-30
- 11.1.3 — 2026-05-30
- 11.1.2 — 2026-04-17
- 11.1.1 — 2026-03-06
- 11.1.0 — 2026-02-28
- 11.0.2 — 2026-02-24
- 11.0.1 — 2026-02-24
- 11.0.0 — 2026-02-24
- 10.2.0 — 2025-07-28
- 10.1.0 — 2025-07-22
- 10.0.1 — 2024-04-02
- 10.0.0 — 2024-04-01
- 9.0.1 — 2023-06-23
- … 5 more at https://npm.io/package/@xhmikosr/decompress/versions

## README

# @xhmikosr/decompress [![npm version](https://img.shields.io/npm/v/@xhmikosr/decompress?logo=npm&logoColor=fff)](https://www.npmjs.com/package/@xhmikosr/decompress) [![CI Status](https://img.shields.io/github/actions/workflow/status/XhmikosR/decompress/ci.yml?branch=master&label=CI&logo=github)](https://github.com/XhmikosR/decompress/actions/workflows/ci.yml?query=branch%3Amaster)

> Extracting archives made easy

*See [decompress-cli](https://github.com/kevva/decompress-cli) for the command-line version.*

## Install

```sh
npm install @xhmikosr/decompress
```


## Usage

```js
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:

```js
{
	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:

```js
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:

```js
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](https://www.npmjs.com/browse/keyword/decompressplugin) to use.

##### strip

* Type: `number`
* Default: `0`

Remove leading directory components from extracted files.


## License

MIT © [Kevin Mårtensson](https://github.com/kevva)

---
_Source: https://npm.io/package/@xhmikosr/decompress · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
