Get the gzipped size of a string or buffer using Zopfli.
var zopfliSize = require('zopfli-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(zopfliSize.sync(string));
//=> 148
Return a Promise
that is resolved with the gzip size of input.
inputcan be a
stringor
Buffer`.
Return the gzip of input
size synchronously. input
can be a string
or Buffer
.
Return a passthrough stream. The stream emits a gzip-size
event and has a gzipSize
property.
- zopfli-size-cli CLI for this module.
MIT © Nicolas Gryman