José Quiñones Flores 4564da0130 Added Laravel project and removed sensitive data | 4 jaren geleden | |
---|---|---|
.. | ||
cli.js | 4 jaren geleden | |
index.js | 4 jaren geleden | |
package.json | 4 jaren geleden | |
readme.md | 4 jaren geleden |
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
Required
Type: String
|Buffer
Returns: size
You can also use it as a CLI app by installing it globally:
$ npm install --global gzip-size
$ gzip-size --help
gzip-size <input-file>
or
cat <input-file> | gzip-size
$ gzip-size jquery.min.js
29344
or with pretty-bytes:
$ pretty-bytes $(gzip-size jquery.min.js)
29.34 kB