1 | brotli-size
|
2 |
|
3 | > Get the brotli compressed size of a string or buffer.
|
4 |
|
5 | ## Install
|
6 |
|
7 | ```
|
8 | $ npm install --save brotli-size
|
9 | ```
|
10 |
|
11 | ## Usage
|
12 |
|
13 | ```js
|
14 | var brotliSize = require('brotli-size');
|
15 | var str = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam feugiat, mauris non aliquam pretium, libero nulla ultrices lacus, nec varius est purus sit amet dolor.';
|
16 |
|
17 | console.log(str.length); // 165
|
18 |
|
19 | console.log(brotliSize.sync(str)); // 118
|
20 | ```
|
21 |
|
22 | ## API
|
23 |
|
24 | ### brotliSize.sync(input)
|
25 |
|
26 | #### input
|
27 |
|
28 | Type: `string`, `buffer`
|
29 |
|
30 | ### brotliSize.stream()
|
31 |
|
32 | Returns a passthrough stream. The stream emits a `brotli-size` event and
|
33 | has a `brotliSize` property.
|
34 | ## Related
|
35 |
|
36 | - [gzip-size](https://github.com/sindresorhus/gzip-size) - Heavily inspired by
|
37 | this module. Thank you for the inspiration!
|