How to use the pako/lib/zlib/zstream function in pako

To help you get started, we’ve selected a few pako examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github emailjs / emailjs-imap-client / src / compression.js View on Github external
function deflater (emit) {
  const stream = new ZStream()
  let status = deflateInit2(stream, Z_DEFAULT_COMPRESSION, Z_DEFLATED, WINDOW_BITS, 8, Z_DEFAULT_STRATEGY)
  if (status !== Z_OK) {
    throw new Error('Problem initializing deflate stream: ' + messages[status])
  }

  return function (data) {
    if (data === undefined) return emit()

    // Attach the input data
    stream.input = data
    stream.next_in = 0
    stream.avail_in = stream.input.length

    let status
    let output
    let start
github emailjs / emailjs-imap-client / src / compression.js View on Github external
function inflater (emit) {
  let stream = new ZStream()

  const status = inflateInit2(stream, WINDOW_BITS)
  if (status !== Z_OK) {
    throw new Error('Problem initializing inflate stream: ' + messages[status])
  }

  return function (data) {
    if (data === undefined) return emit()

    let start
    stream.input = data
    stream.next_in = 0
    stream.avail_in = stream.input.length

    let status, output
    let ret = true