gzlib

Values

pub fn compress(data: BitArray) -> Result(BitArray, Nil)

Compress (deflate) data with the default compression level of the platform - typically level 6 (out of a maximum of 9)

Returns an error if the data is not byte-aligned.

pub fn compress_custom(
  data: BitArray,
  level level: Int,
) -> Result(BitArray, Nil)

Compress (deflate) data with a custom compression level.

Compression level should be between 0 (no compression) and 9 (maximum compression).

Returns an error if the data is not byte-aligned or the compression level is out of range.

pub fn crc32(data: BitArray) -> Result(Int, Nil)

Calculate the CRC checksum for the given data.

Returns an error if the data is not byte-aligned.

pub fn crc32_continue(
  crc: Int,
  data: BitArray,
) -> Result(Int, Nil)

Combine an existing CRC checksum with the checksum of the given data.

Returns an error if the existing CRC is not in the range 0 to 2^32 or if the data is not byte-aligned.

pub fn uncompress(data: BitArray) -> Result(BitArray, Nil)

Uncompress (inflate) data.

Returns an error if the data does not contain the necessary zlib headers or if the data is not byte-aligned.

Search Document