compress #
Description
compress is a namespace for (multiple) compression algorithms supported by V.
At the moment, the following compression algorithms are implemented:
compress.bzip2compress.brotlicompress.deflatecompress.gzipcompress.lzsupporting the following variations:- lz4
- lz77
- lz78
- lzjb
- lzma
- lzma2
- lzss
- lzw
compress.snappycompress.zlibcompress.zstd
Constants #
const max_size = u64(1 << 31)
fn compress #
fn compress(data []u8, flags int) ![]u8
compresses an array of bytes based on providing flags and returns the compressed bytes in a new array NB: this is a low level api, a high level implementation like zlib/gzip should be preferred
fn decompress #
fn decompress(data []u8, flags int) ![]u8
decompresses an array of bytes based on providing flags and returns the decompressed bytes in a new array NB: this is a low level api, a high level implementation like zlib/gzip should be preferred
fn decompress_with_callback #
fn decompress_with_callback(data []u8, cb ChunkCallback, userdata voidptr, flags int) !u64
decompress_with_callback decompresses an array of bytes, based on the provided flags, and a V fn callback to receive decompressed chunks, of at most 32 kilobytes each. It returns the total decompressed length, or a decompression error. NB: this is a low level api, a high level implementation like zlib/gzip should be preferred.
type ChunkCallback #
type ChunkCallback = fn (chunk []u8, userdata voidptr) int