Name |
Date |
Size |
#Lines |
LOC |
||
---|---|---|---|---|---|---|
.. | - | - | ||||
node_modules/minipass/ | 12-May-2024 | - | 1,232 | 1,014 | ||
LICENSE | D | 12-May-2024 | 1.3 KiB | 27 | 22 | |
README.md | D | 12-May-2024 | 1.6 KiB | 54 | 41 | |
constants.js | D | 12-May-2024 | 3.7 KiB | 116 | 110 | |
index.js | D | 12-May-2024 | 8.4 KiB | 321 | 239 | |
package.json | D | 12-May-2024 | 1.8 KiB | 75 | 74 |
README.md
1# minizlib 2 3A fast zlib stream built on [minipass](http://npm.im/minipass) and 4Node.js's zlib binding. 5 6This module was created to serve the needs of 7[node-tar](http://npm.im/tar) and 8[minipass-fetch](http://npm.im/minipass-fetch). 9 10Brotli is supported in versions of node with a Brotli binding. 11 12## How does this differ from the streams in `require('zlib')`? 13 14First, there are no convenience methods to compress or decompress a 15buffer. If you want those, use the built-in `zlib` module. This is 16only streams. That being said, Minipass streams to make it fairly easy to 17use as one-liners: `new zlib.Deflate().end(data).read()` will return the 18deflate compressed result. 19 20This module compresses and decompresses the data as fast as you feed 21it in. It is synchronous, and runs on the main process thread. Zlib 22and Brotli operations can be high CPU, but they're very fast, and doing it 23this way means much less bookkeeping and artificial deferral. 24 25Node's built in zlib streams are built on top of `stream.Transform`. 26They do the maximally safe thing with respect to consistent 27asynchrony, buffering, and backpressure. 28 29See [Minipass](http://npm.im/minipass) for more on the differences between 30Node.js core streams and Minipass streams, and the convenience methods 31provided by that class. 32 33## Classes 34 35- Deflate 36- Inflate 37- Gzip 38- Gunzip 39- DeflateRaw 40- InflateRaw 41- Unzip 42- BrotliCompress (Node v10 and higher) 43- BrotliDecompress (Node v10 and higher) 44 45## USAGE 46 47```js 48const zlib = require('minizlib') 49const input = sourceOfCompressedData() 50const decode = new zlib.BrotliDecompress() 51const output = whereToWriteTheDecodedData() 52input.pipe(decode).pipe(output) 53``` 54