# but-unzip

> tiny (

Latest version **0.1.10** (published 2026-03-02) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install but-unzip
pnpm add but-unzip
yarn add but-unzip
bun add but-unzip
```

## Health

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

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

## Facts

| | |
|---|---|
| Version | 0.1.10 |
| Published | 2026-03-02 |
| First published | 2022-03-06 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | ESM |
| Dependencies | 0 |
| Unpacked size | 27.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Sam Thorogood |
| Maintainers | samthor |
| Keywords | unzip |

## Links

- npm: https://www.npmjs.com/package/but-unzip
- Homepage: https://github.com/samthor/but-unzip#readme
- Issues: https://github.com/samthor/but-unzip/issues
- npm.io page: https://npm.io/package/but-unzip

## 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

- 0.1.10 (latest) — 2026-03-02
- 0.1.9 — 2026-03-02
- 0.1.8 — 2026-03-02
- 0.1.7 — 2025-06-17
- 0.1.6 — 2025-05-22
- 0.1.5 — 2025-05-22
- 0.1.4 — 2024-01-26
- 0.1.3 — 2024-01-25
- 0.1.2 — 2023-04-20
- 0.1.1 — 2023-04-20
- 0.1.0 — 2022-03-06

## README

# but-unzip

small unzip library.
~666 bytes for Node 😈,
and ~755^ bytes for browsers, _before_ gzip.

^95% of browsers support [the decompression API](https://caniuse.com/mdn-api_decompressionstream), which in 2026, is effectively all your users.
<small>
For niche use cases, you should import `pako`.
</small>

## Usage

Install via your favorite package manager and import `but-unzip`.
Has zero dependencies.

```bash
$ npm install but-unzip
```

This library returns zip entries synchronously, but only returns an entry's uncompressed bytes after calling `.read()`, which'll give `Uint8Array` _or_ `Promise<Uint8Array>`.

### Naïve use

If there's a built-in function to inflate compressed files (like in Node or most browsers), you can use the code like:

```js
import { iter } from 'but-unzip';

// in node, get bytes like this (or get a Uint8Array some other way)
import * as fs from 'fs';
const bytes = fs.readFileSync('somezip.zip');

// iterate through all entries
for (const entry of iter(bytes)) {
  console.info(entry.name, entry.comment);
  const bytes = await entry.read();
  // do something with bytes
}
```

Just like that!

#### Provide inflate function

If you're worried about maximum compatibility, add `pako` as a dependency and include its `inflateRaw` method:

```js
import { unzip, inflateRaw as platformInflateRaw } from 'but-unzip';
import { inflateRaw as pakoInflateRaw } from 'pako/lib/inflate.js';

async function decompressUint8Array(zipBytes) {
  const allEntries = unzip(zipBytes, platformInflateRaw || pakoInflateRaw);
  // do something with entries
}
```

Again, this is for a tiny minority of users who can't practically use the modern web _anyway_.

## Notes

* This library doesn't support ZIP64.
  However, your browser (and Node) will likely not be happy to work with 4gb+ files, especially as this is not a streaming library (it just gives everything at once).

* Like literally every zip library that exists, this only supports compression types 0 (store) and 8 (deflate).

* If you're handling user data and it could be really big, use a `Worker`.
  But also, the compression API is `async` and doesn't block your main thread.
  YMMV!

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