Get the gzipped size of a string or buffer
JavaScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.editorconfig add XO Aug 14, 2015
.gitattributes
.gitignore
.travis.yml
index.js split the CLI into a separate module Aug 17, 2015
license
package.json
readme.md
test.js update tests for latest AVA version Jan 1, 2016

readme.md

gzip-size Build Status

Get the gzipped size of a string or buffer

Install

$ npm install --save gzip-size

Usage

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

API

gzipSize(input, callback)

gzipSize.sync(input)

input

Type: string, buffer

callback(error, size)

Type: function

gzipSize.stream()

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

Related

License

MIT © Sindre Sorhus