MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / uncompressed_size

Function uncompressed_size

nodedb-codec/src/zstd_codec.rs:72–80  ·  view source on GitHub ↗

Get the uncompressed size from the header without decompressing.

(data: &[u8])

Source from the content-addressed store, hash-verified

70
71/// Get the uncompressed size from the header without decompressing.
72pub fn uncompressed_size(data: &[u8]) -> Result<usize, CodecError> {
73 if data.len() < HEADER_SIZE {
74 return Err(CodecError::Truncated {
75 expected: HEADER_SIZE,
76 actual: data.len(),
77 });
78 }
79 Ok(u32::from_le_bytes([data[0], data[1], data[2], data[3]]) as usize)
80}
81
82/// Get the compression level from the header.
83pub fn compression_level(data: &[u8]) -> Result<i32, CodecError> {

Callers 1

uncompressed_sizeMethod · 0.85

Calls 1

lenMethod · 0.45

Tested by

no test coverage detected