A compression plugin for Fastify. Supports
const fastify = ;const fastifyCompression = ;const app = ;app;
compression(fastify, options, next)
Compresses the payload with
deflate if the payload length is above the threshold and a
Accept-Encoding header is send with the request. In case of an asterisk
* in the
gzip will be chosen.
number that specifies the threshold used to determine if compression should be applied. Defaults to
To enable Brotli compression pass the iltorb module with the
Note: Since version
11.7.0 brotli is being supported by Node.js itself. Therefore the
brotli option is no longer necessary.