minizlib
A small fast zlib stream built on [minipass](http://npm.im/minipass) and Node.js's zlib binding.

minizlib downloads minizlib version minizlib license

minizlib類似套件:
npm下載趨勢
3 年
🌟 在 minizlib 的 README.md 中顯示即時使用量圖表,只需複製下面的代碼。
## Usage Trend
[![Usage Trend of minizlib](https://npm-compare.com/img/npm-trend/THREE_YEARS/minizlib.png)](https://npm-compare.com/minizlib#timeRange=THREE_YEARS)
Cumulative GitHub Star Trend
🌟 在 minizlib 的 README.md 中顯示 GitHub stars 趨勢圖表,只需複製下面的代碼。
## GitHub Stars Trend
[![GitHub Stars Trend of minizlib](https://npm-compare.com/img/github-trend/minizlib.png)](https://npm-compare.com/minizlib)
統計詳情
套件
下載數
Stars
大小
Issues
發布時間
許可
minizlib45,589,02983118 kB11 個月前MIT
minizlib 的 README

minizlib

A fast zlib stream built on minipass and Node.js's zlib binding.

This module was created to serve the needs of node-tar and minipass-fetch.

Brotli is supported in versions of node with a Brotli binding.

How does this differ from the streams in 'node:zlib'?

First, there are no convenience methods to compress or decompress a buffer. If you want those, use the built-in zlib module. This is only streams. That being said, Minipass streams to make it fairly easy to use as one-liners: new zlib.Deflate().end(data).read() will return the deflate compressed result.

This module compresses and decompresses the data as fast as you feed it in. It is synchronous, and runs on the main process thread. Zlib and Brotli operations can be high CPU, but they're very fast, and doing it this way means much less bookkeeping and artificial deferral.

Node's built in zlib streams are built on top of stream.Transform. They do the maximally safe thing with respect to consistent asynchrony, buffering, and backpressure.

See Minipass for more on the differences between Node.js core streams and Minipass streams, and the convenience methods provided by that class.

Classes

  • Deflate
  • Inflate
  • Gzip
  • Gunzip
  • DeflateRaw
  • InflateRaw
  • Unzip
  • BrotliCompress (Node v10 and higher)
  • BrotliDecompress (Node v10 and higher)
  • ZstdCompress (Node v22.15 and higher)
  • ZstdDecompress (Node v22.15 and higher)

USAGE

import { BrotliDecompress } from 'minizlib'
// or: const BrotliDecompress = require('minizlib')

const input = sourceOfCompressedData()
const decode = new BrotliDecompress()
const output = whereToWriteTheDecodedData()
input.pipe(decode).pipe(output)

REPRODUCIBLE BUILDS

To create reproducible gzip compressed files across different operating systems, set portable: true in the options. This causes minizlib to set the OS indicator in byte 9 of the extended gzip header to 0xFF for 'unknown'.