zlib-transform

0.0.4 • Public • Published

Zlib Transform (BOB)

A zlib transform for the BOB streaming protocol.

Usage

Note: This currently requires the --expose-internals Node.js flag & Node.js built from master.

const ZlibTransform = require('zlib-transform')
new ZlibTransform(options, mode)

Implements a BOB transform for doing zlib compression / decompression.

Example

const zlib = require('zlib')
const ZlibTransform = require('zlib-transform')
 
const transform = new ZlibTransform({}, zlib.constants.GZIP)
const source = new MyBOBSource()
const sink = new MyBOBSink()
 
sink.bindSource(transform.bindSource(source), error => {
  if (error)
    console.error('Stream returned error ->', error.stack)
  else {
    console.log('ok')
  }
})

See test-basic for a good working example.

License

MIT LicensedContributions via DCO 1.1

Package Sidebar

Install

npm i zlib-transform

Weekly Downloads

1

Version

0.0.4

License

MIT

Unpacked Size

18.6 kB

Total Files

10

Last publish

Collaborators

  • fishrock123