Skip to content

compress.deflate #

Description:

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

Examples:

import compress.deflate

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

fn compress #

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

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

Example

compressed := deflate.compress(b)?

fn decompress #

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

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

Example

decompressed := deflate.decompress(b)?