Get the gzipped size of a string or buffer
npm install gzip-size
import {gzipSize, gzipSizeSync} from '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(gzipSizeSync(text));
//=> 78
Returns a Promise<number> with the size.
Returns the size.
Type: string | Buffer
Type: object
Any zlib option.
Returns a Promise<number> with the size of the file.
Type: string
Returns the size of the file.
Returns a stream.PassThrough. The stream emits a gzip-size event and has a gzipSize property.
Overall
Maintained
Code review
npm
Latest release
Releases this year
691 followers · starred Feb 2021
82 followers · starred Apr 2021
Get the gzipped size of a string or buffer
npm install gzip-size
import {gzipSize, gzipSizeSync} from '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(gzipSizeSync(text));
//=> 78
Returns a Promise<number> with the size.
Returns the size.
Type: string | Buffer
Type: object
Any zlib option.
Returns a Promise<number> with the size of the file.
Type: string
Returns the size of the file.
Returns a stream.PassThrough. The stream emits a gzip-size event and has a gzipSize property.
Overall
Maintained
Code review
npm
Latest release
Releases this year
691 followers · starred Feb 2021
82 followers · starred Apr 2021