Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mafintosh/gunzip-maybe
Transform stream that gunzips its input if it is gzipped and just echoes it if not
https://github.com/mafintosh/gunzip-maybe
Last synced: about 16 hours ago
JSON representation
Transform stream that gunzips its input if it is gzipped and just echoes it if not
- Host: GitHub
- URL: https://github.com/mafintosh/gunzip-maybe
- Owner: mafintosh
- License: mit
- Created: 2014-05-07T16:23:54.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2020-06-01T14:16:54.000Z (over 4 years ago)
- Last Synced: 2024-10-30T09:18:08.528Z (14 days ago)
- Language: JavaScript
- Homepage:
- Size: 16.6 KB
- Stars: 106
- Watchers: 3
- Forks: 16
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# gunzip-maybe
Transform stream that gunzips its input if it is gzipped and just echoes it if not.
```
npm install gunzip-maybe
```[![build status](http://img.shields.io/travis/mafintosh/gunzip-maybe.svg?style=flat)](http://travis-ci.org/mafintosh/gunzip-maybe)
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](https://github.com/feross/standard)## Usage
Simply pipe a gzipped (or not gzipped) stream to `gunzip([maxRecursion = 3])` and read the unzipped content.
`maxRecursion` protects the unzip mechanism from an infinite recursion in case of a malicious archive.``` js
// this will gunzip gzippedStream
gzippedStream.pipe(gunzip()).pipe(process.stdout);// this will just echo plainTextStream
plainTextStream.pipe(gunzip()).pipe(process.stdout);
```## CLI usage
```
npm install -g gunzip-maybe
gunzip-maybe --help # will print out usage
```## License
MIT