# @litejs/zip

> Lightweight (~1.3KB) ZIP file creator for Browser and Node.js. No dependencies

Latest version **26.8.0** (published 2026-08-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install @litejs/zip
pnpm add @litejs/zip
yarn add @litejs/zip
bun add @litejs/zip
```

## Health

**Score 70/100 (B)** — status: active.

Positive: has types; no vulnerabilities; has provenance; recently updated; high maintenance score; high quality score.

Warnings: low downloads; no esm support.

## Facts

| | |
|---|---|
| Version | 26.8.0 |
| Published | 2026-08-11 |
| First published | 2023-12-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 6.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 4 |
| Author | Lauri Rooden |
| Maintainers | lauriro |
| Keywords | zip, litejs |

## Links

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

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

- 26.8.0 (latest) — 2026-08-11
- 26.4.0 — 2026-04-14
- 25.12.0 — 2025-12-14
- 25.10.2 — 2025-10-10
- 25.10.1 — 2025-10-06
- 25.10.0 — 2025-10-01
- 23.12.0 — 2023-12-07

## README

[1]: https://badgen.net/coveralls/c/github/litejs/zip
[2]: https://coveralls.io/r/litejs/zip
[3]: https://badgen.net/packagephobia/install/@litejs/zip
[4]: https://packagephobia.now.sh/result?p=@litejs/zip
[5]: https://badgen.net/badge/icon/Buy%20Me%20A%20Tea/orange?icon=kofi&label
[6]: https://www.buymeacoffee.com/lauriro


LiteJS Zip &ndash; [![Coverage][1]][2] [![Size][3]][4] [![Buy Me A Tea][5]][6]
==========

Lightweight (~1.3KB) ZIP file creator for Browser and Node.js. No dependencies.  
Uses the CompressionStream API if available; otherwise uses provided deflater or creates an uncompressed ZIP.


createZip(files [, options] [, callback])

 - files: Array of `{name, content[, time]}`
 - options: `{ deflate: deflateRawSync, comment: 'Comment for a file' }` (optional custom deflater makes ZIP creation synchronous)
 - callback: Optional `(err, zip)` callback

Returns a `Promise<Uint8Array>`, or invokes provided `callback`, or the ZIP synchronously when using a custom deflater.


Examples
--------

```javascript
const { createZip } = require("@litejs/zip")

// Async usage
const zipUint8Array = await createZip([
    { name: "file-a.txt", content: "Some content" },
    { name: "dir/file-b.txt", content: Uint8Array.from("012"), time: new Date(2020, 1, 21) },
])

// Callback style
createZip(files, { comment: "Some comment for a zip file" }, (err, zipUint8Array) => {
    // Handle ZIP file content
})

// With custom deflate runs synchronously
const zlib = require("zlib")
const zipInSync = createZip(files, { deflate: zlib.deflateRawSync })
```

## Contributing

Follow [Coding Style Guide](https://github.com/litejs/litejs/wiki/Style-Guide),
run tests `npm install; npm test`.


> Copyright (c) 2023-2025 Lauri Rooden &lt;lauri@rooden.ee&gt;  
[MIT License](https://litejs.com/MIT-LICENSE.txt) |
[GitHub repo](https://github.com/litejs/zip) |
[npm package](https://npmjs.org/package/@litejs/zip) |
[Buy Me A Tea][6]

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