Skip to content

compress.gzip #

Description:

compress.gzip is a module that assists in the compression and decompression of binary data using gzip compression

Examples:

import compress.gzip

fn main() {
    uncompressed := 'Hello world!'
    compressed := gzip.compress(uncompressed.bytes())!
    decompressed := gzip.decompress(compressed)!
    assert decompressed == uncompressed.bytes()
}

fn compress #

fn compress(data []u8) ![]u8

compresses an array of bytes using gzip and returns the compressed bytes in a new array

Example

compressed := gzip.compress(b)?

fn decompress #

fn decompress(data []u8, params DecompressParams) ![]u8

decompresses an array of bytes using zlib and returns the decompressed bytes in a new array

Example

decompressed := gzip.decompress(b)?

struct DecompressParams #

struct DecompressParams {
	verify_header_checksum bool = true
	verify_length          bool = true
	verify_checksum        bool = true
}