Lyricdev
GitHub

struct Zlib

pub struct Zlib

The zlib format over bytes in memory.

Methods

pub static fn compress(bytes: Slice<uint8>, level: int = 6): uint8[] throws CompressError

Compresses bytes into a zlib stream at level (0 to 9, -1 for the default 6).

Errors

Throws CompressError for a level outside -1 to 9.

pub static fn decompress(bytes: Slice<uint8>): uint8[] throws IoError

Decompresses a zlib stream.

Errors

Throws IoError { kind = .InvalidData } with a CompressError inside for data that is not zlib, or whose Adler-32 does not match.