How to use the zlib.createGunzip 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 alanhoff / node-tar.gz / index.js View on Github external
TarGz.prototype.createParseStream = function() {
  var stream1 = zlib.createGunzip(this._options.zlib);
  var stream2 = tar.Parse();

  this._bubble(stream1, stream2);

  // Capture the entry event
  stream2.on('entry', function(entry) {
    stream1.emit('entry', entry);
  });

  stream1.pipe(stream2);
  return stream1;
};
github facebook / react-360 / Examples / DashSample / downloadAssets.js View on Github external
var fs = require('fs');
var tar = require('tar-fs')
var request = require('request');
var zlib = require('zlib');

request('https://www.dropbox.com/s/4h5iuryd3myfha8/asset.tar.gz?dl=1')
  .pipe(zlib.createGunzip())
  .pipe(tar.extract('./static_assets'));
github angular / angular.js / i18n / ucd / src / extract.js View on Github external
function main() {
  extractValues(
    fs.createReadStream(__dirname + '/ucd.all.flat.xml.gz').pipe(zlib.createGunzip()),
    propertiesToExtract,
    writeFile);

  function writeFile(validRanges) {
    var code = generateCode(validRanges);
    try {
      fs.lstatSync(__dirname + '/../../../src/ngParseExt');
    } catch (e) {
      fs.mkdirSync(__dirname + '/../../../src/ngParseExt');
    }
    fs.writeFile(__dirname + '/../../../src/ngParseExt/ucd.js', code);
  }
}
github AuspeXeu / openvpn-status / utils.js View on Github external
req.on('response', resp => {
          if (resp.statusCode === 200)
            req.pipe(zlib.createGunzip()).pipe(fs.createWriteStream(ipFile))
              .on('finish', () => {
                loadFile(resolve)
              })
          else
            loadFile(resolve)
        })
      } else
github fergiemcdowall / search-index / lib / indexing / replicator.js View on Github external
replicator.replicateFromSnapShotStream = function (readStream, indexes, callback) {
    var indexesws = levelws(indexes);
    readStream.pipe(zlib.createGunzip())
      .pipe(JSONStream.parse())
      .pipe(indexesws.createWriteStream())
      .on('close', callback);
  };
github mnutt / hummingbird / lib / metrics / locations.js View on Github external
http.get(url, function(res) {
    if(res.statusCode != "200") {
      return callback(new Error("HTTP error: " + res.statusCode));
    }

    var gunzip = zlib.createGunzip();
    var out = fs.createWriteStream(path);

    res.pipe(gunzip).pipe(out);

    gunzip.on('end', function(err) {
      callback(err);
    });
  });
};
github alanhoff / node-tar.gz / index.js View on Github external
TarGz.prototype.createWriteStream = function(directory) {
  var stream1 = zlib.createGunzip(this._options.zlib);
  var stream2 = tar.Extract({
    path: directory,
    strip: this._options.tar.strip || 0
  });

  this._bubble(stream1, stream2);
  stream1.pipe(stream2);

  return stream1;
};
github SumoLogic / sumologic-aws-lambda / cloudwatchlogs-with-dlq / sumo-dlq-function-utils / lib / utils.js View on Github external
return new Promise(function (resolve, reject) {
        var uncompressed_bytes = [];
        var gunzip = zlib.createGunzip();
        gunzip.on('data', function (data) {
            uncompressed_bytes.push(data.toString());
        }).on("end", function () {
            resolve(uncompressed_bytes.join(""));
        }).on("error", function (e) {
            reject(e);
        });
        var bufferStream = new stream.PassThrough();
        bufferStream.end(buffer);
        bufferStream.pipe(gunzip);
    });
};
github Canop / miaou / plugins / stackoverflow / se-boxer.js View on Github external
http.get(url, function(res){
		var gunzip = zlib.createGunzip();
		res.pipe(gunzip);
		gunzip.on('data', function(data){
			buffer.push(data.toString())
		}).on("end", function(){
			try {
				callback(null, JSON.parse(buffer.join('')));
			} catch (e) {
				callback(e);
			}
		}).on("error", function(e){
			callback(e);
		});
	}).on('error', function(e){
		callback(e)

zlib

Simple, synchronous deflate/inflate for buffers

Unrecognized
Latest version published 13 years ago

Package Health Score

56 / 100
Full package analysis