ngryman / zopfli-size

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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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.

License:MIT License


Languages

Language:JavaScript 100.0%