Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tootallnate/node-gzip-stack
A `StreamStack` implementation for encoding and decoding `Gzip` content.
https://github.com/tootallnate/node-gzip-stack
Last synced: 5 days ago
JSON representation
A `StreamStack` implementation for encoding and decoding `Gzip` content.
- Host: GitHub
- URL: https://github.com/tootallnate/node-gzip-stack
- Owner: TooTallNate
- License: mit
- Created: 2010-11-02T06:56:21.000Z (about 14 years ago)
- Default Branch: master
- Last Pushed: 2011-01-01T00:46:33.000Z (almost 14 years ago)
- Last Synced: 2024-10-24T02:46:29.312Z (2 months ago)
- Language: JavaScript
- Homepage:
- Size: 351 KB
- Stars: 4
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
node-gzip-stack
===============
### A [StreamStack][] implementation for encoding and decoding [Gzip][] content.This module exposes a gzipping and gunzipping `StreamStack` interface. Two
classes are exposed: `GzipEncoderStack` and `GzipDecoderStack`.There are currently no configuration options, but configuration for
compression level (on the encoder, at least) could come in a later version.Encoding Example
----------------To encode data going into a writable stream, use the `GzipEncoderStack` class:
var fs = require('fs');
var GzipEncoderStack = require('gzip-stack').GzipEncoderStack;
var file = new GzipEncoderStack(fs.createWriteStream('hello.gz'));
file.write("hello world!\n");
file.end();
// Hint: now try running `cat hello.gz | gunzip` to verify that it works!Decoding Example
----------------To decode data coming from a readable stream, use the `GzipDecoderStack` class:
var fs = require('fs');
var GzipDecoderStack = require('gzip-stack').GzipDecoderStack;// Create a fs.ReadStream of the kernel config gzip file, and
// then wrap it in a `GzipDecoderStack` instance.
var config = new GzipDecoderStack(fs.createReadStream('/proc/config.gz'));// Use the standard `Stream#pipe()` to print the decoded contents to 'stdout'.
config.pipe(process.stdout);Installation
------------npm install gzip-stack
TODO
----* Detect `node-compress`, and write a version that uses that by default.
[StreamStack]: http://github.com/TooTallNate/node-stream-stack
[Gzip]: http://www.gzip.org/