1
0
Fork 0
management/front/dkha-web-sz-main/node_modules/gzip-size
詹力 1a19ec897f 删除无关模块 2024-01-16 21:26:16 +08:00
..
node_modules/pify 删除无关模块 2024-01-16 21:26:16 +08:00
index.d.ts i4 2023-12-18 13:12:25 +08:00
index.js i4 2023-12-18 13:12:25 +08:00
license i4 2023-12-18 13:12:25 +08:00
package.json 删除无关模块 2024-01-16 21:26:16 +08:00
readme.md i4 2023-12-18 13:12:25 +08:00

readme.md

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.

License

MIT © Sindre Sorhus