#tide #middleware #brotli #gzip #compression

tide-compress

Outgoing compression middleware for the Tide server framework

10 releases (breaking)

0.8.1 Nov 20, 2020
0.7.0 Oct 17, 2020
0.4.0 Jul 19, 2020

#163 in HTTP server

Download history 38/week @ 2020-10-05 32/week @ 2020-10-12 19/week @ 2020-10-19 27/week @ 2020-10-26 35/week @ 2020-11-02 40/week @ 2020-11-09 66/week @ 2020-11-16 105/week @ 2020-11-23 60/week @ 2020-11-30 135/week @ 2020-12-07 21/week @ 2020-12-14 31/week @ 2020-12-21 93/week @ 2020-12-28 87/week @ 2021-01-04 43/week @ 2021-01-11 52/week @ 2021-01-18

208 downloads per month

BlueOak-1.0.0

9KB
110 lines

tide-compress

Outgoing compression middleware for the Tide server framework.

#[async_std::main]
async fn main() -> tide::Result {
    let mut app = tide::new();
    app.with(tide_compress::CompressMiddleware::new());
}

Features

  • Support for Brotli, Gzip, and Deflate encodings, compile-time configurable through cargo feature flags.
    • Prioritizes Brotli if available.
    • Only pulls in the necessary dependencies for the desired configuration.
    • Defaults to Brotli + Gzip.
  • Accept-Encoding checking including priority.
  • Minimum body size threshold.
    • Configurable when created by CompressMiddleware::with_threshold(usize).
  • Does not compress responses with a Cache-Control: no-transform header.
  • Sets the Vary header.

Caveats

  • Does not do any Content-Type / MIME checking.

License

Licensed under the BlueOak Model License 1.0.0Contributions via DCO 1.1

Dependencies

~6.5–10MB
~210K SLoC