Skip to main content

decompress_payload

Function decompress_payload 

Source
pub fn decompress_payload(
    payload: Payload,
    max_decompressed_bytes: usize,
) -> CompressionReadResult
Expand description

Reverse of compress_payload, applied to every read.

Text payloads and empty binary payloads pass through. An escape prefix is removed only when the next byte is one the writer escapes; other 0x00 leads and unknown markers pass through unchanged. A marked payload decodes only its first zstd frame and ignores trailing bytes, like Node’s synchronous decoder. Malformed or truncated zstd data keeps the original marked bytes with fallback_raw; output beyond max_decompressed_bytes (or a frame demanding more decoder memory than allowed) keeps them with read_over_limit. Successful 0x01 output receives replacement UTF-8 conversion; 0x02 output is exact bytes. The input is never mutated, so repeated loads of a retained payload are independent.