brotli-fsize
Get the brotli-compressed size of a string or buffer
Last updated 2 years ago by mannil .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install brotli-fsize 
SYNC missed versions from official npm registry.

brotli-fsize Build Status

Get the brotli-compressed size of a string or buffer

Install

Attention: This module is based on the native Brotli support, starting with Node version 11.7.0. Therefore it will only work with Node version equal to or higher.

$ npm install brotli-fsize

Usage

const brotliSize = require('brotli-fsize');
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(brotliSize.sync(text));
//=> 134

API

brotliSize(input, [options])

Returns a Promise for the size.

brotliSize.sync(input, [options])

Returns the size.

input

Type: string Buffer

options

Type: Object

Any brotli option.

brotliSize.stream([options])

Returns a stream.PassThrough. The stream emits a brotli-fsize event and has a brotliSize property.

brotliSize.file(path, [options])

Returns a Promise for the size of the file.

path

Type: string

brotliSize.fileSync(path, [options])

Returns the size of the file.

License

Inspired by gzip-size

MIT © Developmint (Alexander Lichter)

Current Tags

  • 1.0.3                                ...           latest (2 years ago)

4 Versions

  • 1.0.3                                ...           2 years ago
  • 1.0.2                                ...           2 years ago
  • 1.0.1                                ...           2 years ago
  • 1.0.0                                ...           2 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 9
Last Day 0
Last Week 8
Last Month 14
Dependencies (2)

Copyright 2014 - 2017 © taobao.org |