Skip to content

Latest commit

 

History

History
111 lines (63 loc) · 2.13 KB

AsyncZlib.md

File metadata and controls

111 lines (63 loc) · 2.13 KB

Class: AsyncZlib

Asynchronous streaming Zlib compression

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new AsyncZlib(opts, cb?)

Creates an asynchronous Zlib stream

Parameters

Name Type Description
opts ZlibOptions The compression options
cb? AsyncFlateStreamHandler The callback to call whenever data is deflated

new AsyncZlib(cb?)

Creates an asynchronous Zlib stream

Parameters

Name Type Description
cb? AsyncFlateStreamHandler The callback to call whenever data is deflated

Properties

ondata

ondata: AsyncFlateStreamHandler

The handler to call whenever data is available


ondrain

Optional ondrain: AsyncFlateDrainHandler

The handler to call whenever buffered source data is processed (i.e. queuedSize updates)


queuedSize

queuedSize: number

The number of uncompressed bytes buffered in the stream


terminate

terminate: AsyncTerminable

A method to terminate the stream's internal worker. Subsequent calls to push() will silently fail.

Methods

flush

flush(): void

Flushes buffered uncompressed data. Useful to immediately retrieve the zlibbed output for small inputs.

Returns

void


push

push(chunk, final?): void

Pushes a chunk to be deflated

Parameters

Name Type Description
chunk Uint8Array The chunk to push
final? boolean Whether this is the last chunk

Returns

void