opts() :: #{ compress_buffering => boolean(), compress_threshold => non_neg_integer() }
cowboy_compress_h - Compress stream handler
The module cowboy_compress_h
compresses response bodies automatically when the client supports it. It will not try to compress responses that already have a content encoding.
Normal responses will only be compressed when their size is lower than the configured threshold. Streamed responses are always compressed, including when the sendfile command is used. Because the file must be read in memory to be compressed, this module is not suitable for automatically compressing large files.
opts() :: #{ compress_buffering => boolean(), compress_threshold => non_neg_integer() }
Configuration for the default stream handler.
The default value is given next to the option name:
Whether the output will be buffered. By default no buffering is done to provide maximum compatibility at the cost of a lower compression rate.
How large the response body must be to be compressed when the response isn't streamed.
The compress stream handler does not produce any event.
compress_buffering
and compress_threshold
were added.
Donate to Loïc Hoguin because his work on Cowboy, Ranch, Gun and Erlang.mk is fantastic:
Recurring payment options are also available via BountySource. These funds are used to cover the recurring expenses like dedicated servers or domain names.