Module zstd_stream

Module zstd_stream 

Source
Available on crate features plugins and zstd only.
Expand description

Zstandard compression streaming utilities for high-performance HTTP response compression.

This module provides streaming Zstandard (zstd) compression for HTTP response bodies, offering excellent compression ratios with fast decompression speeds. Zstandard is particularly well-suited for modern web applications that require both high compression efficiency and low latency. The streaming implementation enables memory-efficient compression of large responses without buffering entire content in memory.

§Examples

use tako::plugins::compression::zstd_stream::stream_zstd;
use http_body_util::Full;
use bytes::Bytes;

// Compress a response body with Zstandard level 3
let body = Full::from(Bytes::from("Hello, World! This is test content."));
let compressed = stream_zstd(body, 3);

// High compression for static assets
let static_content = Full::from(Bytes::from("Large static file content..."));
let high_compressed = stream_zstd(static_content, 19);

Structs§

ZstdStream
Streaming Zstandard compressor that wraps an inner data stream.

Functions§

stream_zstd
Compresses an HTTP body stream using Zstandard compression algorithm.