Available on crate feature
plugins only.Expand description
DEFLATE compression streaming utilities for efficient HTTP response compression.
This module provides streaming DEFLATE compression for HTTP response bodies using the flate2 crate. DEFLATE compression offers good compression ratios with fast processing speeds, making it suitable for real-time web content compression. The streaming implementation enables memory-efficient compression of large responses without buffering entire content in memory.
§Examples
use tako::plugins::compression::deflate_stream::stream_deflate;
use http_body_util::Full;
use bytes::Bytes;
// Compress a response body with DEFLATE level 6
let body = Full::from(Bytes::from("Hello, World! This is test content."));
let compressed = stream_deflate(body, 6);
// Fast compression for dynamic content
let dynamic_content = Full::from(Bytes::from("API response data..."));
let fast_compressed = stream_deflate(dynamic_content, 1);Structs§
- Deflate
Stream - Streaming DEFLATE compressor that wraps an inner data stream.
Functions§
- stream_
deflate - Compresses an HTTP body stream using the DEFLATE compression algorithm.