Skip to content

Commit

Permalink
Update content/techniques/compression.md
Browse files Browse the repository at this point in the history
Co-authored-by: Antonio Tripodi <[email protected]>
  • Loading branch information
eugleenyc and Tony133 authored Oct 21, 2023
1 parent f0622a7 commit 126705d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion content/techniques/compression.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ await app.register(compression);

By default, `@fastify/compress` will use Brotli compression (on Node >= 11.7.0) when browsers indicate support for the encoding. While Brotli can be quite efficient in terms of compression ratio, it can also be quite slow. By default, Brotli sets a maximum compression quality of 11, although it can be adjusted to reduce compression time in lieu of compression quality by adjusting the `BROTLI_PARAM_QUALITY` between 0 min and 11 max. This will require fine tuning to optimize space/time performance. An example with quality 4:

```Typescript
```typescript
import { constants } from 'zlib';
// somewhere in your initialization file
await app.register(compression, { brotliOptions: { params: { [constants.BROTLI_PARAM_QUALITY]: 4 } } });
Expand Down

0 comments on commit 126705d

Please sign in to comment.