Skip to content

postwait/node-compress-buffer

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

node-compress-buffer

A single-step Buffer compression library for Node.js.

Synopsis

	compress = require('compress-buffer').compress;
	uncompress = require('compress-buffer').uncompress;
	
	var rawData = fs.readFileSync("/etc/passwd"),
      rawDataLen = rawData.length;

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

	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 (either a String() or 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 (either a String() or a Buffer()) and returns uncompressed Buffer() or undefined on error.

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.

Author

Egor Egorov me@egorfine.com

About

Single-step Buffer compression library for Node.js

Resources

License

Stars

1 star

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • C++ 62.1%
  • JavaScript 36.2%
  • Shell 1.7%