# zlib-sync

> Synchronous zlib bindings for NodeJS

Latest version **0.1.10** (published 2025-05-01) · MIT license · 0 weekly downloads

## Install

```sh
npm install zlib-sync
pnpm add zlib-sync
yarn add zlib-sync
bun add zlib-sync
```

## Health

**Score 35/100 (D)** — status: maintenance-mode.

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

Warnings: low downloads; no esm support; pre 1.0.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.10 |
| Published | 2025-05-01 |
| First published | 2011-09-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 1.1 MB |
| Known vulnerabilities | 0 |
| Install scripts | yes |
| GitHub stars | 37 |
| Author | abalabahaha |
| Maintainers | abalabahaha |
| Keywords | zlib, sync |

## Links

- npm: https://www.npmjs.com/package/zlib-sync
- Repository: https://github.com/abalabahaha/zlib-sync
- Homepage: https://github.com/abalabahaha/zlib-sync#readme
- Issues: https://github.com/abalabahaha/zlib-sync/issues
- npm.io page: https://npm.io/package/zlib-sync

## Dependencies (1)

- [nan](https://npm.io/package/nan.md) ^2.18.0

## 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) — 2025-05-01
- 0.1.9 — 2023-10-28
- 0.1.8 — 2023-02-02
- 0.1.7 — 2020-06-10
- 0.1.6 — 2019-10-31
- 0.1.5 — 2019-08-02
- 0.1.4 — 2017-12-07
- 0.1.3 — 2017-10-24
- 0.1.2 — 2017-10-23
- 0.0.1 — 2011-09-22

## README

zlib-sync
=========

Synchronous zlib bindings for NodeJS

Originally made for JS libraries interacting with the Discord gateway, where compression requires a shared zlib context in a synchronous fashion.

Features
--------

* Synchronous, [Pako](https://github.com/nodeca/pako)-like API

* Near-native performance and efficiency

Installing
----------

`zlib-sync` is a native module, so it requires `node-gyp` to be installed, which requires Python 2.7 and a C++ compiler on your system. See [the node-gyp documentation](https://github.com/nodejs/node-gyp#installation) for more info. A pre-built module is planned for a future update.

After getting `node-gyp` set up, install `zlib-sync` like a normal NPM package:

```
npm install zlib-sync
```

Usage
-------

Documentation can be found [here](https://github.com/abalabahaha/zlib-sync/wiki/Documentation).

```js
var ZlibSync = require("zlib-sync");

var inflate = new ZlibSync.Inflate();

inflate.push(compressedChunk1);
inflate.push(compressedChunk2, ZlibSync.Z_SYNC_FLUSH);

if(inflate.err < 0) {
    throw new Error("zlib error: " + inflate.msg);
}

var result = inflate.result;

console.log(result.toString());
```

To-Do
-----

* Deflate stream support
* One-time deflate/inflate support

License
-------

Refer to the [LICENSE](LICENSE) file.

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