Zstd#
- class numcodecs.zstd.Zstd(level=0, checksum=False)#
Codec providing compression using Zstandard.
- Parameters:
- levelint
Compression level (-131072 to 22).
- checksumbool
Flag to enable checksums. The default is False.
See also
- codec_id: str | None = 'zstd'#
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.zstd.compress(source, int level=DEFAULT_CLEVEL, bool checksum=False)#
Compress data.
- Parameters:
- sourcebytes-like
Data to be compressed. Can be any object supporting the buffer protocol.
- levelint
Compression level (-131072 to 22).
- checksumbool
Flag to enable checksums. The default is False.
- Returns:
- destbytes
Compressed data.
- numcodecs.zstd.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.