How to use gzip-js - 10 common examples

To help you get started, we’ve selected a few gzip-js 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 sindresorhus / grunt-sizediff / tasks / sizediff.js View on Github external
// use second file if defined, otherwise the first
			var min = results[1] || results[0];

			if (err) {
				grunt.warn(err);
				cb();
				return;
			}

			console.log('\nPath %s', results[0].path.cyan);

			// add gzip version to the collection
			results.push({
				filename: min.filename + '.gz',
				current: gzipjs.zip(min.current, {}),
				target: gzipjs.zip(min.target, {})
			});

			grunt.log.writeln('\nSize diff between current branch and ' + target.bold);

			results.forEach(function (item) {
				var current = item.current.length;
				var target = item.target.length;
				var diff = current - target;
				var percent = ((diff / current) * 100).toFixed();
				var color = 'gray';

				if (diff > 0) {
					color = 'red';
					diff = '+' + prettyBytes(diff);
				} else if (diff < 0) {
					color = 'green';
github sindresorhus / grunt-sizediff / tasks / sizediff.js View on Github external
async.parallel(parallelFns, function (err, results) {
			// use second file if defined, otherwise the first
			var min = results[1] || results[0];

			if (err) {
				grunt.warn(err);
				cb();
				return;
			}

			console.log('\nPath %s', results[0].path.cyan);

			// add gzip version to the collection
			results.push({
				filename: min.filename + '.gz',
				current: gzipjs.zip(min.current, {}),
				target: gzipjs.zip(min.target, {})
			});

			grunt.log.writeln('\nSize diff between current branch and ' + target.bold);

			results.forEach(function (item) {
				var current = item.current.length;
				var target = item.target.length;
				var diff = current - target;
				var percent = ((diff / current) * 100).toFixed();
				var color = 'gray';

				if (diff > 0) {
					color = 'red';
					diff = '+' + prettyBytes(diff);
				} else if (diff < 0) {
github lrsjng / fquery / lib / wepp / wepp.js View on Github external
gzip = function (content) {

		// returns an array of bytes
		return gzipjs.zip(content, {level: 5});
	},
github jzaefferer / grunt-css / tasks / grunt-css.js View on Github external
function min_max(min, max) {
    var gzip = require('gzip-js');
    var gzipSize = String(gzip.zip(min, {}).length);
    grunt.log.writeln('Uncompressed size: ' + String(max.length).green + ' bytes.');
    grunt.log.writeln('Compressed size: ' + gzipSize.green + ' bytes gzipped (' + String(min.length).green + ' bytes minified).');
  }
github nbproject / nbproject / lib / grunt-css.js View on Github external
function min_max(min, max) {
    var gzip = require('gzip-js');
    var gzipSize = String(gzip.zip(min, {}).length);
    grunt.log.writeln('Uncompressed size: ' + String(max.length).green + ' bytes.');
    grunt.log.writeln('Compressed size: ' + gzipSize.green + ' bytes gzipped (' + String(min.length).green + ' bytes minified).');
  }
github vmware / vsphere-automation-sdk-rest / samples / javascript / tagging / login.js View on Github external
function makeLoginOptions(endpointConnectionInfo, token) {
   return {
      host: endpointConnectionInfo.host,
      port: endpointConnectionInfo.port || 443,
      path: (endpointConnectionInfo.path || '/') + "rest/com/vmware/cis/session",
      method: "POST",
      rejectUnauthorized: false,
      requestCert: true,
      agent: false,
      headers: {
         'Authorization': makeAuthHeaderValues(base64Encode(gzip.zip(token)))
      }
   }
}
github Krinkle / mw-gadget-rtrc / Gruntfile.js View on Github external
gz: function (fileContents) {
						return require('gzip-js').zip(fileContents, {}).length;
					}
				}
github globalizejs / globalize / Gruntfile.js View on Github external
gz: function( fileContents ) {
						return require( "gzip-js" ).zip( fileContents, {}).length;
					}
				}
github SimonWaldherr / micromarkdown.js / Gruntfile.js View on Github external
gz: function( contents ) {
            return gzip.zip(contents, {}).length;
          }
        },
github facebook / react / grunt / config / compare_size.js View on Github external
gz: function(contents) {
        return gzip.zip(contents, {}).length;
      }
    },

gzip-js

GZIP in pure JavaScript (works in the browser)

GPL
Latest version published 12 years ago

Package Health Score

50 / 100
Full package analysis

Popular gzip-js functions

Similar packages