Skip to content

compress.zlib #

Description

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

Examples

import compress.zlib

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

fn compress #

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

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

Example

compressed := zlib.compress(b)!

fn decompress #

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

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

Example

decompressed := zlib.decompress(b)!