Module decompression

Module decompression 

Source
Expand description

Transparent and deep recursive decompression inspection for format detection.

Provides bounded stream decompression across all supported compression formats, enabling inspection of inner payloads, identification of compound formats (e.g. TarGz), format chains (@chain(f... > f...)), and UNIX file compatibility mode (-z / -Z).

Structs§

BoundedWriter
A writer that collects up to limit bytes into an in-memory buffer, aborting with an error when the limit is exceeded to stop unbounded decompression.
DetectionSourceReader
Wraps a DetectionSource to implement std::io::Read by reading sequentially from offset 0.

Constants§

DEFAULT_DECOMPRESS_BYTE_LIMIT
Default byte limit (1 MiB) for bounded decompression probes during file inspection.
DEFAULT_MAX_DECOMPRESSION_DEPTH
Default maximum recursion depth allowed during recursive decompression inspection.

Functions§

build_compat_candidate
Builds a DetectionCandidate adhering to UNIX file compatibility mode conventions.
build_compound_candidate
Builds a DetectionCandidate representing a compound format (e.g. TarGz).
build_format_chain_candidate
Builds a DetectionCandidate representing an arbitrary format chain (@chain(f_a > f_b > ...)) with layers ordered innermost → outermost.
decompress_bounded
Decompresses up to limit bytes from source using the specified compression format.
format_chain_directive
Formats a canonical Document Character format chain directive @chain(f_a > f_b > ...) for layers ordered innermost → outermost.
format_chain_layer_annotation
Formats a single chain layer as [fN Ident "label"] for rich rendering.
format_chain_pretty
Formats a human-readable pretty-printed format chain description, including format shorthands and full format titles/descriptions, for layers ordered innermost → outermost.
probe_decompression_candidates
Probes a compressed source, decompressing up to the configured limit and recursively identifying the inner payload format.
resolve_compound_format
Resolves an inner and outer format pair to a single compound FormatId if one is registered.