# compress-buffer

> Synchronous Buffer compression library for Node.js

Latest version **1.2.2** (published 2014-05-08) · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install compress-buffer
pnpm add compress-buffer
yarn add compress-buffer
bun add compress-buffer
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.2.2 |
| Published | 2014-05-08 |
| First published | 2011-05-10 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | yes |
| GitHub stars | 32 |
| Author | Egor Egorov |
| Maintainers | egorfine |

## Links

- npm: https://www.npmjs.com/package/compress-buffer
- Repository: http://github.com/egorfine/node-compress-buffer
- Homepage: http://egorfine.github.com/node-compress-buffer
- Issues: http://github.com/egorFiNE/node-compress-buffer/issues
- npm.io page: https://npm.io/package/compress-buffer

## Dependencies (1)

- [bindings](https://npm.io/package/bindings.md) ~1.2.0

## Recent versions

- 1.2.2 (latest) — 2014-05-08
- 1.2.1 — 2013-11-03
- 1.2.0 — 2013-03-22
- 1.1.0 — 2012-07-01
- 1.0.0 — 2012-05-27
- 0.5.1 — 2011-11-07
- 0.5.0 — 2011-11-06
- 0.4.2 — 2011-10-31
- 0.4.1 — 2011-09-21
- 0.4.0 — 2011-09-17
- 0.3.2 — 2011-09-16
- 0.3.1 — 2011-09-16
- 0.3.0 — 2011-05-10

## README

# node-compress-buffer 

Synchronous zlib Buffer compression library for Node.js.


## Synopsis

```javascript
compress = require('compress-buffer').compress;
uncompress = require('compress-buffer').uncompress;

var rawData = fs.readFileSync("/etc/passwd");

var compressed   = compress(rawData);
var uncompressed = uncompress(compressed);

uncompressed == rawData // true!
```


## Why? 

For the sake of the KISS principle. Most of the time you don't need a streaming compression, you need to compress an existing and already complete data. 


## Options 

<code>compress()</code> takes two arguments: the data (must be a <code>Buffer()</code>) and optional compression level which must be within 1..9. It returns compressed <code>Buffer()</code> or <code>undefined</code> on error.

<code>uncompress()</code> takes a single argument: the data (must be a <code>Buffer()</code>) and returns uncompressed <code>Buffer()</code> or <code>undefined</code> on error.

Both functions could throw exceptions in the following cases:

* zlib initialisation fails;
* first argument is not a <code>Buffer</code> instance.


## Installation

	npm install compress-buffer

or

	npm install .


## License

See LICENSE file. Basically, it's a kind of "do-whatever-you-want-for-free" license.


## Thanks to 

* A lot of thanks for important suggestions goes to Konstantin Käfer who implemented a nice similar module node-zlib (https://github.com/kkaefer/node-zlib) earlier than me;
* Oleg Kertanov, pccowboy, addisonj, David Swift

## Author

Egor Egorov <me@egorfine.com>.

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