Function nintendo_lz::compress [−][src]
pub fn compress(
inp: &[u8],
out: &mut Write,
level: CompressionLevel
) -> Result<(), Box<Error>>
Compresses data to LZ10/LZ11. It returns an error when:
- The input is too large for the selected LZ version (LZ10 supports at most 16MiB)
- The maximum repeat length is out of range (for LZ11, has to be in the range (0..65810)
- Writing to the output file failed
Example
let mut f = File::create("Archive.bin.cmp"); let data = b"This is an example text. This is an example text"; nintendo_lz::compress(&data, &mut f, nintendo_lz::CompressionLevel::LZ11(65809)).unwrap();