Skip to main content

total_decompressed_size

Function total_decompressed_size 

Source
fn total_decompressed_size(data: &[u8]) -> Option<u64>
Expand description

Adds up the decompressed size of every frame in data.

This is what ZSTD_findDecompressedSize() does, except that one is part of zstd’s experimental API - and we have the whole input in hand anyway, so walking it is a few lines.

Returns None if data is not a clean sequence of frames, or if any of them does not record its decompressed size.

Skippable frames are handled: zstd reports their full length and a content size of zero, so they are stepped over without affecting the total.