Liking cljdoc? Tell your friends :D

ring.middleware.content-encoding

Middleware for adding Content-Encoding to a response.

Middleware for adding Content-Encoding to a response.
raw docstring

brotli-encoderclj

(brotli-encoder)
(brotli-encoder options)

Returns a function that adds Brotli compression to an OutputStream. Accepts the following options:

  • :quality - compression quality
  • :window - log2(LZ window size)
Returns a function that adds [Brotli][] compression to an OutputStream.
Accepts the following options:

- `:quality` - compression quality
- `:window` - log2(LZ window size)

[brotli]: https://brotli.org/
sourceraw docstring

content-encoding-responseclj

(content-encoding-response response request)
(content-encoding-response response request options)

Add Content-Encoding to a response, based on the types included in the Accept-Encoding header on the request. See wrap-content-encoding for information on the supported options.

Add Content-Encoding to a response, based on the types included in the
Accept-Encoding header on the request. See [[wrap-content-encoding]] for
information on the supported options.
sourceraw docstring

default-encoder-minimumsclj

The minimum size in bytes at which to apply the compression. Bodies that are too small typically don't benefit from compression.

The minimum size in bytes at which to apply the compression. Bodies that
are too small typically don't benefit from compression.
sourceraw docstring

default-encoder-weightsclj

Weightings for which encoder to favor when the client has no preference. Higher values win out over lower ones.

Weightings for which encoder to favor when the client has no preference.
Higher values win out over lower ones.
sourceraw docstring

default-encodersclj

A map of encoder names to their respective default functions.

A map of encoder names to their respective default functions.
sourceraw docstring

default-media-typesclj

A set of default media types that will get content encoding. Media types that already have compression (such as images) should not be included in this set.

A set of default media types that will get content encoding. Media types that
already have compression (such as images) should not be included in this set.
sourceraw docstring

default-status-codesclj

A set of default status codes that will get content encoding.

A set of default status codes that will get content encoding.
sourceraw docstring

deflate-encoderclj

(deflate-encoder)
(deflate-encoder options)

Returns a function that adds DEFLATE compression to an OutputStream. Accepts the following options:

  • :level - the compression level
Returns a function that adds DEFLATE compression to an OutputStream.
Accepts the following options:

- `:level` - the compression level
sourceraw docstring

gzip-encoderclj

(gzip-encoder)
(gzip-encoder options)

Returns a function that adds GZip compression to an OutputStream. Accepts the following options:

  • :level - the compression level
Returns a function that adds GZip compression to an OutputStream.
Accepts the following options:

- `:level` - the compression level
sourceraw docstring

wrap-content-encodingclj

(wrap-content-encoding handler)
(wrap-content-encoding handler options)

Wrap a Ring handler to apply appropriate Content-Encoding to a response, based on the types included in the Accept-Encoding header on the request. Accepts the following options:

  • :encoders - a map of encoder names to functions that add encoding to OutputStreams.
  • :encoder-weights - a map of encoder names to numerial weights. When the client doesn't favor an encoder, the highest weighted encoder is used.
  • :encoder-minimums - a map of encoder names to the minimum size in bytes of the body (as set by the Content-Length header) at which that encoder is applied
  • :media-types - a set of media types that are allowed to have content encoding
  • :status-codes - a set of HTTP response status codes that are allowed to have content encoding
Wrap a Ring handler to apply appropriate Content-Encoding to a response,
based on the types included in the Accept-Encoding header on the request.
Accepts the following options:

- `:encoders` - a map of encoder names to functions that add encoding to
  OutputStreams.
- `:encoder-weights` - a map of encoder names to numerial weights. When the
  client doesn't favor an encoder, the highest weighted encoder is used.
- `:encoder-minimums` - a map of encoder names to the minimum size in bytes
  of the body (as set by the Content-Length header) at which that encoder is
  applied
- `:media-types` - a set of media types that are allowed to have content
  encoding
- `:status-codes` - a set of HTTP response status codes that are allowed to
  have content encoding
sourceraw docstring

zstandard-encoderclj

(zstandard-encoder)
(zstandard-encoder options)

Returns a function that adds ZStandard compression to an OutputStream. Accepts the following basic options:

  • :level - the compression level

And the following advanced options:

  • :chain-log - log2(multi-probe search table size)
  • :hash-log - log2(initial probe table size)
  • :job-size - size of compression job when workers > 1
  • :long - enable long distance matching
  • :min-match - min match size for long distance matcher
  • :overlap-log - overlap size as fraction of window size
  • :search-log - log2(number search attempts)
  • :strategy - see ZSTD_strategy enum definition
  • :target-length - depends on strategy
  • :window-log - log2(max allowed back-reference distance)
  • :workers - number of worker threads
Returns a function that adds [ZStandard][] compression to an OutputStream.
Accepts the following basic options:

- `:level` - the compression level

And the following advanced options:

- `:chain-log` - log2(multi-probe search table size)
- `:hash-log` - log2(initial probe table size)
- `:job-size` - size of compression job when workers > 1
- `:long` - enable long distance matching
- `:min-match` - min match size for long distance matcher
- `:overlap-log` - overlap size as fraction of window size
- `:search-log` - log2(number search attempts)
- `:strategy` - see ZSTD_strategy enum definition
- `:target-length` - depends on strategy
- `:window-log` - log2(max allowed back-reference distance) 
- `:workers` - number of worker threads

[zstandard]: https://facebook.github.io/zstd/
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close