Skip to content

Get the gzipped size of a string or buffer using Zopfli.

License

Notifications You must be signed in to change notification settings

ngryman/zopfli-size

Repository files navigation

zopfli-size

Get the gzipped size of a string or buffer using Zopfli.

travis codecov

Usage

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

API

zopfliSize(input)

Return a Promise that is resolved with the gzip size of input. inputcan be astringorBuffer`.

zopfliSize.sync(input)

Return the gzip of input size synchronously. input can be a string or Buffer.

zopfliSize.strean()

Return a passthrough stream. The stream emits a gzip-size event and has a gzipSize property.

Related

License

MIT © Nicolas Gryman

About

Get the gzipped size of a string or buffer using Zopfli.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published