gzip-size
    Overview
    Documentation
    Tutorials
    Insights
    Code
    Dependencies
    Contributors
    Jobs

gzip-size

Get the gzipped size of a string or buffer

5.1.1  •  Updated 10 months ago  •  by Sindre Sorhus  •  MIT License

Get the gzipped size of a string or buffer

Install

$ npm install gzip-size

Usage

const gzipSize = require('gzip-size');

const text = '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(text.length);
//=> 191

console.log(gzipSize.sync(text));
//=> 78

API

gzipSize(input, [options])

Returns a Promise for the size.

gzipSize.sync(input, [options])

Returns the size.

input

Type: string Buffer

options

Type: Object

Any zlib option.

gzipSize.stream([options])

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

gzipSize.file(path, [options])

Returns a Promise for the size of the file.

path

Type: string

gzipSize.fileSync(path, [options])

Returns the size of the file.

Related

License

MIT © Sindre Sorhus

Popularity

Weekly Downloads
4.4M
Stars
115

Maintenance

Development

Last ver 10 months ago
Created 6 years ago
Last commit 10 months ago
1 month between commits

Technology

Node version: 8.16.0
7.5K unpacked

Compliance

MIT License
OSI Approved
0 vulnerabilities

Contributors

13 contributors
Sindre Sorhus
Maintainer, 41 commits, 9 merges
Arthur Verschaeve
Maintainer, 1 commits, 1 merges
Andres Suarez
Maintainer, 2 commits, 1 PRs
Works at facebook
Tobias Bieniek
2 commits, 2 PRs
Works at simplabs
Kevin Martensson
Maintainer, 1 commits
Works at imagemin yeoman
Sam Verschueren
Maintainer, 1 merges

Tags

app
tool
zlib
gzip
compressed
size
string
buffer
Openbase helps developers choose among and use millions of open-source packages, so they can build amazing products faster.
FacebookTwitterLinkedIn
© 2020 Devstore, Inc.