#tide #middleware #brotli #gzip #compression

tide-compress

Outgoing compression middleware for the Tide server framework

11 releases (breaking)

0.9.0 Jan 29, 2021
0.8.1 Nov 20, 2020
0.7.0 Oct 17, 2020
0.4.0 Jul 19, 2020

#237 in HTTP server

Download history 65/week @ 2021-06-01 62/week @ 2021-06-08 232/week @ 2021-06-15 36/week @ 2021-06-22 68/week @ 2021-06-29 71/week @ 2021-07-06 51/week @ 2021-07-13 100/week @ 2021-07-20 147/week @ 2021-07-27 123/week @ 2021-08-03 72/week @ 2021-08-10 96/week @ 2021-08-17 109/week @ 2021-08-24 93/week @ 2021-08-31 93/week @ 2021-09-07 81/week @ 2021-09-14

219 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

~7–10MB
~222K SLoC