Module streaming

Module streaming 

Source
Expand description

Streaming utilities for large content transfers.

This module provides efficient streaming capabilities for transferring large content without loading everything into memory at once.

§Features

  • Chunk-based streaming with configurable buffer sizes
  • Async I/O support with backpressure handling
  • Progress tracking and bandwidth estimation
  • Automatic retry on transient failures
  • Memory-efficient design for large files

§Example

use chie_core::streaming::{ContentStream, StreamConfig};
use std::path::PathBuf;

let config = StreamConfig::default();
let mut stream = ContentStream::from_file(PathBuf::from("large_file.bin"), config).await?;

while let Some(chunk) = stream.next_chunk().await? {
    println!("Received {} bytes, progress: {:.1}%",
        chunk.len(), stream.progress() * 100.0);
    // Process chunk...
}

Structs§

ChunkWriter
Chunk writer for streaming writes.
ContentStream
Content stream for efficient data transfer.
StreamConfig
Configuration for content streaming.

Enums§

StreamError
Streaming error types.

Functions§

stream_copy
Stream content from source to destination.