View Source NimbleLZ4 (NimbleLZ4 v0.1.2)
LZ4 compression and decompression.
This functionality is built on top of native (Rust) NIFs. There is no streaming functionality, everything is done in memory.
decompress/2 takes the original uncompressed size as a parameter. For this
reason, it's common to store compressed binaries prefixed by their uncompressed
length. For example, you could store the compressed binary as:
my_binary = <<...>> store(<<byte_size(my_binary)::32>> <> NimbleLZ4.compress(my_binary))
When decompressing, you can extract the uncompressed length:
<<uncompressed_size::32, compressed_binary::binary>> = retrieve_binary() uncompressed_binary = NimbleLZ4.decompress(compressed_binary, uncompressed_size)
Link to this section Summary
Link to this section Functions
Compresses the given binary.
Decompresses the given binary using the size of the uncompressed binary.