blosc2.decompress2#

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

Decompress the given src buffer with the specified decompression params.

Parameters:
  • src (bytes-like object) – The data to be decompressed. Must support the buffer interface, such as bytes, bytearray, memoryview, or numpy.ndarray.

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

  • kwargs (dict, optional) –

    Decompression parameters. The default values are in blosc2.DParams. Supported keyword arguments:

    dparams: blosc2.DParams or dict

    All the decompression parameters to use, provided as a blosc2.DParams instance or dict.

    others: Any

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

Returns:

out – The decompressed data as 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 occurs, likely due to an invalid parameter If dst is None and a bytes object could not be created 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.