LZ4#
- class numcodecs.lz4.LZ4(acceleration=1)#
Codec providing compression using LZ4.
- Parameters:
- accelerationint
Acceleration level. The larger the acceleration value, the faster the algorithm, but also the lesser the compression.
See also
- codec_id: str | None = 'lz4'#
Codec identifier.
- 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.
- classmethod from_config(config)#
Instantiate codec from a configuration object.
Helper functions#
- numcodecs.lz4.compress(source, int acceleration=DEFAULT_ACCELERATION)#
Compress data.
- Parameters:
- sourcebytes-like
Data to be compressed. Can be any object supporting the buffer protocol.
- accelerationint
Acceleration level. The larger the acceleration value, the faster the algorithm, but also the lesser the compression.
- Returns:
- destbytes
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:
- sourcebytes-like
Compressed data. Can be any object supporting the buffer protocol.
- destarray-like, optional
Object to decompress into.
- Returns:
- destbytes
Object containing decompressed data.