How to use the browserify-zlib.gzipSync function in browserify-zlib

To help you get started, we’ve selected a few browserify-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 UWNetworksLab / uProxy-p2p / src / lib / bridge / onetime.ts View on Github external
public addToBatch = (message:T) : void => {
    if (this.isTerminating_(message)) {
      let batchAsJson = JSON.stringify(this.batch_);
      let buffer = new Buffer(batchAsJson);
      let encoded :string;
      if (this.compress_) {
        let compressedBuffer = zlib.gzipSync(buffer);
        encoded = compressedBuffer.toString('base64');
        log.info('%1: batch ready (raw/compressed/base64: %2/%3/%4)', this.name_,
            batchAsJson.length, compressedBuffer.length, encoded.length);
      } else {
        encoded = buffer.toString('base64');
        log.info('%1: batch ready (raw/base64: %2/%3)', this.name_,
            batchAsJson.length, encoded.length);
      }

      this.emitBatch_(encoded);

      // Prepare for the next batch if it happens, e.g. due to renegotiation.
      this.batch_ = [];
    } else {
      this.batch_.push(message);
    }
github ethers-io / ethers.js / packages / testcases / src.ts / index.ts View on Github external
export function saveTests(tag: string, data: any) {
   //let filename = path.resolve(__dirname, 'testcases', tag + '.json.gz');
   let filename = path.resolve('../testcases', tag + '.json.gz');

   fs.writeFileSync(filename, zlib.gzipSync(JSON.stringify(data, undefined, ' ') + '\n'));

   console.log('Save testcase: ' + filename);
}
github ethers-io / ethers.js / packages / testcases / lib.esm / index.js View on Github external
export function saveTests(tag, data) {
    //let filename = path.resolve(__dirname, 'testcases', tag + '.json.gz');
    let filename = path.resolve('../testcases', tag + '.json.gz');
    fs.writeFileSync(filename, zlib.gzipSync(JSON.stringify(data, undefined, ' ') + '\n'));
    console.log('Save testcase: ' + filename);
}
export function loadTests(tag) {
github Bobris / Bobril / gulpfile.js View on Github external
return str;
    }
	function logInfo(name,tslines,jssize,minsize,gzipsize) {
	    console.log(padString(12,name)+' '+padString(5,tslines,true)+' '+padString(6,jssize,true)+' '+padString(6,minsize,true)+' '+padString(6,gzipsize,true));
    }
	logInfo('Name','Lines','Orig','Minif','Gzip');
	var totaltslines=0,totaljssize=0,totalminsize=0,totalgzipsize=0;
	distList.forEach(function(o) {
	    totaltslines+=o.tslines;
	    totaljssize+=o.jssize;
	    totalminsize+=o.minsize;
	    totalgzipsize+=o.gzipsize;
	    logInfo(o.name,o.tslines,o.jssize,o.minsize,o.gzipsize);
	});
	logInfo('Total Sum',totaltslines,totaljssize,totalminsize,totalgzipsize);
	var concatgzip = gzipSync(wholebuf).length;
	logInfo('Concat','','','',concatgzip);
	var data = {
        parts: distList.map(function(item) { return { name: item.name, tslines: item.tslines, jssize: item.jssize, minsize: item.minsize, gzipsize: item.gzipsize }; }),
		total: { tslines: totaltslines, jssize: totaljssize, minsize: totalminsize, gzipsize: totalgzipsize },
		concatgzipsize: concatgzip
		};
	fs.writeFileSync("examples/libsize/data.js","var libSizeData="+JSON.stringify(data));
});
github Bobris / Bobril / gulpfile.js View on Github external
distList = distList.map(function(name,i) {
       var buf = fs.readFileSync("dist/"+name);
	   var plname=extractPluginName(name.substr(0,name.length-7));
	   wholebuf+=buf.toString();
	   name2idx[plname]=i;
	   return { name:plname, minname: name, minsize: buf.length, gzipsize:gzipSync(buf.toString()).length };
    });
    var srcList = fs.readdirSync('src/');

browserify-zlib

Full zlib module for the browser

MIT
Latest version published 7 years ago

Package Health Score

71 / 100
Full package analysis

Popular browserify-zlib functions