View Source NimbleLZ4 (NimbleLZ4 v1.1.0)
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
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)
Summary
Functions
Compresses the given binary.
Compresses the given binary using the LZ4 frame format into a frame.
Decompresses the given binary using the size of the uncompressed binary.
Decompresses the given frame binary using the LZ4 frame format.
Functions
Compresses the given binary.
Compresses the given binary using the LZ4 frame format into a frame.
@spec decompress(binary(), non_neg_integer()) :: {:ok, binary()} | {:error, term()}
Decompresses the given binary using the size of the uncompressed binary.
Decompresses the given frame binary using the LZ4 frame format.