Available on crate feature
plugins only.Expand description
Gzip compression streaming utilities for efficient HTTP response compression.
This module provides streaming Gzip compression for HTTP response bodies using the flate2 crate. Gzip is one of the most widely supported compression formats on the web, offering excellent compatibility across all browsers and HTTP clients. The streaming implementation enables memory-efficient compression of large responses without buffering entire content in memory, making it ideal for real-time web applications.
§Examples
use tako::plugins::compression::gzip_stream::stream_gzip;
use http_body_util::Full;
use bytes::Bytes;
// Compress a response body with Gzip level 6
let body = Full::from(Bytes::from("Hello, World! This is test content."));
let compressed = stream_gzip(body, 6);
// Fast compression for dynamic API responses
let api_response = Full::from(Bytes::from("JSON API data..."));
let fast_compressed = stream_gzip(api_response, 1);Structs§
- Gzip
Stream - Streaming Gzip compressor that wraps an inner data stream.
Functions§
- stream_
gzip - Compresses an HTTP body stream using Gzip compression algorithm.