How to use the zlib.gunzip function in zlib

To help you get started, we’ve selected a few zlib 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 advanced-rest-client / arc-electron / scripts / renderer / socket-request.js View on Github external
return new Promise((resolve, reject) => {
      zlib.gunzip(body, (err, buffer) => {
        if (err) {
          reject(new Error(err.message || err));
        } else {
          resolve(buffer);
        }
      });
    });
  }
github Deathspike / mangarack / lib / nodejs / request.js View on Github external
res.on('end', function() {
      var buffer = Buffer.concat(chunks);
      var compression = res.headers['content-encoding'];
      var callback = _createRequestCallback(address, encoding, done);
      var location = res.headers.location;
      if (location) return _request(location, encoding, done, n + 1 || 1);
      if (compression === 'gzip') {
        return zlib.gunzip(buffer, callback);
      } else if (compression === 'deflate') {
        return zlib.inflateRaw(buffer, callback);
      } else {
        callback(undefined, buffer);
      }
    });
  }).on('error', function(err) {

zlib

Simple, synchronous deflate/inflate for buffers

Unrecognized
Latest version published 13 years ago

Package Health Score

56 / 100
Full package analysis