LZ4¶
-
class
numcodecs.lz4.
LZ4
¶ Codec providing compression using LZ4.
Parameters: acceleration : int
Acceleration level. The larger the acceleration value, the faster the algorithm, but also the lesser the compression.
See also
-
codec_id
= 'lz4'¶
-
encode
(self, buf)¶
-
decode
(self, buf, out=None)¶
-
get_config
()¶ Return a dictionary holding configuration parameters for this codec. Must include an ‘id’ field with the codec identifier. All values must be compatible with JSON encoding.
-
from_config
(config)¶ Instantiate codec from a configuration object.
-
Helper functions¶
-
numcodecs.lz4.
compress
(source, int acceleration=DEFAULT_ACCELERATION)¶ Compress data.
Parameters: source : bytes-like
Data to be compressed. Can be any object supporting the buffer protocol.
acceleration : int
Acceleration level. The larger the acceleration value, the faster the algorithm, but also the lesser the compression.
Returns: dest : bytes
Compressed data.
Notes
The compressed output includes a 4-byte header storing the original size of the decompressed data as a little-endian 32-bit integer.
-
numcodecs.lz4.
decompress
(source, dest=None)¶ Decompress data.
Parameters: source : bytes-like
Compressed data. Can be any object supporting the buffer protocol.
dest : array-like, optional
Object to decompress into.
Returns: dest : bytes
Object containing decompressed data.