Noah's Pairwise Manifest

    gzip-size
    TypeScript icon, indicating that this package has built-in type declarations

    5.0.0 • Public • Published

    gzip-size Build Status

    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

    Install

    npm i gzip-size@5.0.0

    Version

    5.0.0

    License

    MIT

    Unpacked Size

    4.6 kB

    Total Files

    4

    Last publish

    Collaborators

    • sindresorhus