新增: - backend/venv/ - Python 虚拟环境 - backend/start.sh - 启动脚本(使用虚拟环境) - backend/requirements.txt - 依赖列表 - .gitignore - 忽略虚拟环境和缓存文件 说明: - 每个项目使用独立虚拟环境 - 避免依赖冲突 - 启动脚本自动创建和激活虚拟环境
1.8 KiB
1.8 KiB
gzip-size 
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<number> with 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<number> with the size of the file.
path
Type: string
gzipSize.fileSync(path, options?)
Returns the size of the file.
Related
- gzip-size-cli - CLI for this module
Get professional support for this package with a Tidelift subscription
Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies.
Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies.