jack e1a2621c78 update | há 2 anos atrás | |
---|---|---|
.. | ||
cli.js | há 2 anos atrás | |
index.js | há 2 anos atrás | |
package.json | há 2 anos atrás | |
readme.md | há 2 anos atrás |
Get the gzipped size of a string or buffer
$ npm install --save gzip-size
var gzipSize = require('gzip-size');
var string = 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.';
console.log(string.length);
//=> 191
console.log(gzipSize.sync(string));
//=> 78
Required
Type: string
, buffer
Required
Type: function
Returns the size.
Required
Type: string
, buffer
$ npm install --global gzip-size
$ gzip-size --help
Usage
gzip-size <file>
cat <file> | gzip-size
Example
gzip-size index.js
211
Combine it with pretty-bytes to get a human readable output:
$ pretty-bytes $(gzip-size jquery.min.js)
29.34 kB
MIT © Sindre Sorhus