How to use the pako/lib/zlib/inflate.inflateInit2 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 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

    do {
github Peergos / Peergos / ui / doppio / natives / java_util.js View on Github external
java_util_zip_Inflater['init(Z)J'] = function (thread, nowrap) {
        var strm = new ZStreamCons();
        var ret = inflate.inflateInit2(strm, nowrap ? -MAX_WBITS : MAX_WBITS);
        switch (ret) {
        case 0:
            var num = OpenZStream(strm);
            return Long.fromNumber(num);
        default:
            var msg = strm.msg ? strm.msg : ret == -2 ? 'inflateInit2 returned Z_STREAM_ERROR' : 'unknown error initializing zlib library';
            thread.throwNewException('Ljava/lang/InternalError;', msg);
            break;
        }
    };
    java_util_zip_Inflater['setDictionary(J[BII)V'] = function (thread, arg0, arg1, arg2, arg3) {
github Peergos / Peergos / ui / doppio / natives / java_util.js View on Github external
java_util_zip_Inflater['reset(J)V'] = function (thread, addr) {
        var addrNum = addr.toNumber();
        var strm = GetZStream(thread, addrNum);
        if (strm) {
            var newStrm = new ZStreamCons();
            var ret = inflate.inflateInit2(newStrm, strm.state.wrap ? MAX_WBITS : -MAX_WBITS);
            ZStreams[addrNum] = newStrm;
        }
    };
    java_util_zip_Inflater['end(J)V'] = function (thread, addr) {