Skip to content

Compression

1 min read

Import: import system.compress;

Read the usage guide for examples and common tasks. This reference lists the public declarations for this part of the library. See Reading API signatures for parameter and result notation.

Compression

Streaming gzip/zlib factories; wrappers borrow their underlying stream.

public static class Compression

writer

Creates an encoder; max_output_bytes bounds compressed output across every write and finish.

public static fun writer(
    destination: Writer,
    format: CompressionFormat = CompressionFormat.Gzip,
    max_output_bytes: long = 67108864L
): Result<CompressionWriter, IoError>

reader

Creates a strict single-stream decoder; the output limit prevents unbounded expansion.

public static fun reader(
    source: Reader,
    format: CompressionFormat = CompressionFormat.Gzip,
    max_output_bytes: long = 67108864L
): Result<CompressionReader, IoError>