View Source NimbleLZ4 (NimbleLZ4 v0.1.4)
LZ4 compression and decompression.
This functionality is built on top of native (Rust) NIFs. There is no streaming functionality, everything is done in memory.
uncompressed-size
Uncompressed Size
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
Functions
Compresses the given binary.
Decompresses the given binary using the size of the uncompressed binary.
Link to this section Functions
Compresses the given binary.
@spec decompress(binary(), non_neg_integer()) :: {:ok, binary()} | {:error, term()}
Decompresses the given binary using the size of the uncompressed binary.