Skip to main content

decompress

Function decompress 

Source
pub fn decompress(data: &[u8]) -> Result<Vec<u8>, Error>
Expand description

Decompresses a complete gzip or zlib stream, detected from its first bytes, with the default Limits.

§Errors

ErrorKind::InvalidHeader when the data is neither; otherwise as gzip::decompress or zlib::decompress.

§Examples

use compress_lib as compress;

assert_eq!(compress::decompress(&compress::gzip::compress(b"either"))?, b"either");
assert_eq!(compress::decompress(&compress::zlib::compress(b"either"))?, b"either");