compress-buffer

Single-step Buffer compression library for Node.js

this has been created when no compression library existed for Node.js. This isn't the case for years
Last updated 15 years ago .
Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install compress-buffer 
SYNC missed versions from official npm registry.

node-compress-buffer

Synchronous zlib Buffer compression library for Node.js.

Synopsis

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

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

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

Both functions could throw exceptions in the following cases:

  • zlib initialisation fails;
  • first argument is not a Buffer 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.

Current Tags

  • 1.2.2                                ...           latest (12 years ago)

13 Versions

  • 1.2.2 [deprecated]           ...           12 years ago
  • 1.2.1 [deprecated]           ...           12 years ago
  • 1.2.0 [deprecated]           ...           13 years ago
  • 1.1.0 [deprecated]           ...           14 years ago
  • 1.0.0 [deprecated]           ...           14 years ago
  • 0.5.1 [deprecated]           ...           14 years ago
  • 0.5.0 [deprecated]           ...           14 years ago
  • 0.4.2 [deprecated]           ...           14 years ago
  • 0.4.1 [deprecated]           ...           15 years ago
  • 0.4.0 [deprecated]           ...           15 years ago
  • 0.3.2 [deprecated]           ...           15 years ago
  • 0.3.1 [deprecated]           ...           15 years ago
  • 0.3.0 [deprecated]           ...           15 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (0)
None
Dev Dependencies (1)
Dependents (3)

Copyright 2013 - present © cnpmjs.org | Home |