Skip to content
Closed
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
5bdbb9e
Added support for brotli ('br') content-encoding
danielgindi Jul 10, 2020
6ef8cef
Update README.md
danielgindi Jul 12, 2020
02c06c2
Update README.md
danielgindi Jul 13, 2020
4df713b
Update README.md
danielgindi Jul 13, 2020
87076af
Apply default value also when params is specified
danielgindi Jul 13, 2020
fffe4c7
Increase coverage for specifying params
danielgindi Jul 14, 2020
9145a55
Updated brotli detection method
danielgindi Aug 25, 2020
0bb402e
Prefer br over gzip and deflate
danielgindi Aug 30, 2020
bbcd9c4
feat: use "koa-compress" logic to determine the preferred encoding
nicksrandall Sep 14, 2020
767c62a
test: adding one more test case br/gzip with quality params
nicksrandall Sep 14, 2020
78ad84a
chore: fix linting errors
nicksrandall Sep 14, 2020
4c359b8
fix: hand write encodings lib to be compatible with node 0.8
nicksrandall Sep 14, 2020
8340cde
Fix: fixing lint errors in new lib
nicksrandall Sep 14, 2020
04ab713
Fix: fixing lint errors in new lib
nicksrandall Sep 14, 2020
b024cce
implemented required encoding negotiator without 3rd party dependency
danielgindi Dec 19, 2020
9af45dd
Merge branch 'master' into feature/brotli
bjohansebas Oct 19, 2024
25b68b8
fix
bjohansebas Oct 19, 2024
3d30ab0
use negotiator
bjohansebas Oct 19, 2024
2cabcc3
Merge branch 'master' into feature/brotli
UlisesGascon Oct 20, 2024
662c09d
improve negotiateEnconding
bjohansebas Oct 24, 2024
0ecf49f
Merge branch 'feature/brotli' of github.com:bjohansebas/compression i…
bjohansebas Oct 24, 2024
395ead9
Merge branch 'master' of github.com:expressjs/compression into featur…
bjohansebas Oct 25, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update README.md
  • Loading branch information
danielgindi committed Jul 12, 2020
commit 6ef8cef9be7e9199abe5a5111ac5983e1b1f4402
21 changes: 17 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ The following compression codings are supported:
- gzip
- br (brotli)

**Note** Brotli provides better and faster compression then gzip or deflate, but is supported only since Node.js versions v11.7.0 and v10.16.0.
**Note** Brotli provides [better and faster compression then gzip or deflate](https://expeditedsecurity.com/blog/nginx-brotli/), but is supported only since Node.js versions v11.7.0 and v10.16.0.

## Install

Expand Down Expand Up @@ -47,10 +47,12 @@ as compressing will transform the body.

`compression()` accepts these properties in the options object. In addition to
those listed below, [zlib](http://nodejs.org/api/zlib.html) options may be
passed in to the options object.
passed in to the options object or
[brotli](https://nodejs.org/api/zlib.html#zlib_class_brotlioptions) options.

As for *brotli*, a default is set to compression level 4, unless
[anything else is specified](https://nodejs.org/api/zlib.html#zlib_class_brotlioptions).
As for *brotli*, a default is set to compression level 4, unless anything else
is specified. This is a balanced setting with [a very good speed and a very good
compression ratio](https://expeditedsecurity.com/blog/nginx-brotli/).

##### chunkSize

Expand Down Expand Up @@ -147,6 +149,17 @@ The default value is `zlib.Z_DEFAULT_WINDOWBITS`, or `15`.
See [Node.js documentation](http://nodejs.org/api/zlib.html#zlib_memory_usage_tuning)
regarding the usage.

##### params [*(brotli only)*](https://nodejs.org/api/zlib.html#zlib_brotli_constants)

- `zlib.constants.BROTLI_PARAM_MODE`
- `zlib.constants.BROTLI_MODE_GENERIC` (default)
- `zlib.constants.BROTLI_MODE_TEXT`, adjusted for UTF-8 text
- `zlib.constants.BROTLI_MODE_FONT`, adjusted for WOFF 2.0 fonts
- `zlib.constants.BROTLI_PARAM_QUALITY`
- Ranges from `zlib.constants.BROTLI_MIN_QUALITY` to
`zlib.constants.BROTLI_MAX_QUALITY`, with a default of
`4` (which is not node's default but the most optimal).

#### .filter

The default `filter` function. This is used to construct a custom filter
Expand Down