/node_modules/minizlib/README.md

https://bitbucket.org/coleman333/smartsite · Markdown · 44 lines · 33 code · 11 blank · 0 comment · 0 complexity · 6034f1ac4d34f662e6a274cac72ad6af MD5 · raw file

  1. # minizlib
  2. A tiny fast zlib stream built on [minipass](http://npm.im/minipass)
  3. and Node.js's zlib binding.
  4. This module was created to serve the needs of
  5. [node-tar](http://npm.im/tar) v2. If your needs are different, then
  6. it may not be for you.
  7. ## How does this differ from the streams in `require('zlib')`?
  8. First, there are no convenience methods to compress or decompress a
  9. buffer. If you want those, use the built-in `zlib` module. This is
  10. only streams.
  11. This module compresses and decompresses the data as fast as you feed
  12. it in. It is synchronous, and runs on the main process thread. Zlib
  13. operations can be high CPU, but they're very fast, and doing it this
  14. way means much less bookkeeping and artificial deferral.
  15. Node's built in zlib streams are built on top of `stream.Transform`.
  16. They do the maximally safe thing with respect to consistent
  17. asynchrony, buffering, and backpressure.
  18. This module _does_ support backpressure, and will buffer output chunks
  19. that are not consumed, but is less of a mediator between the input and
  20. output. There is no high or low watermarks, no state objects, and so
  21. artificial async deferrals. It will not protect you from Zalgo.
  22. If you write, data will be emitted right away. If you write
  23. everything synchronously in one tick, and you are listening to the
  24. `data` event to consume it, then it'll all be emitted right away in
  25. that same tick. If you want data to be emitted in the next tick, then
  26. write it in the next tick.
  27. It is thus the responsibility of the reader and writer to manage their
  28. own consumption and process execution flow.
  29. The goal is to compress and decompress as fast as possible, even for
  30. files that are too large to store all in one buffer.
  31. The API is very similar to the built-in zlib module. There are
  32. classes that you instantiate with `new` and they are streams that can
  33. be piped together.