blosc2.decompress2#

blosc2.decompress2(src: object, dst: object | bytearray = None, **kwargs: dict) str | bytes#

Compress src with the given compression params (if given)

Parameters:
  • src (bytes-like object) – The data to be decompressed. Must be a bytes-like object that supports the Python Buffer Protocol, like bytes, bytearray, memoryview, or numpy.ndarray.

  • dst (NumPy object or bytearray) – The destination NumPy object or bytearray to fill, the length of which must be greater than 0. The user must make sure that it has enough capacity for hosting the decompressed data. Default is None, meaning that a new bytes object is created, filled and returned.

  • kwargs (dict, optional) –

    Decompression parameters. The default values are in blosc2.DParams. Keyword arguments supported:

    dparams: blosc2.DParams or dict

    All the decompression parameters that you want to use as a blosc2.DParams or dict instance.

    others: Any

    If dparams is not passed, all the parameters of a blosc2.DParams can be passed as keyword arguments.

Returns:

out – The decompressed data in form of a Python str or bytes object if dst is None. Otherwise, it will return None because the result will already be in dst.

Return type:

str or bytes

Raises:
  • RuntimeError – If the data cannot be compressed into dst. If an internal error occurred, probably because some parameter is not a valid one. If dst is None and could not create a bytes object to store the result.

  • TypeError – If src does not support the Buffer Protocol.

  • ValueError – If the length of src is smaller than the minimum. If dst is not None and its length is 0.