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
Type: string
, buffer
Type: function
Returns a passthrough stream. The stream emits a gzip-size
event and has a gzipSize
property.
MIT © Sindre Sorhus
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.