blosc2.unpack#

blosc2.unpack(packed_object, **kwargs)#

Unpack (decompress) an object.

Parameters:
  • packed_object (str / bytes) – The packed object to be decompressed.

  • **kwargs (fix_imports / encoding / errors) – Optional parameters that can be passed to the pickle.loads API

Returns:

out – The decompressed data in form of the original object.

Return type:

object

Raises:

TypeError – If packed_object is not of type bytes or string.

Examples

>>> import numpy
>>> a = numpy.arange(1e6)
>>> parray = blosc2.pack(a)
>>> len(parray) < a.size*a.itemsize
True
>>> a2 = blosc2.unpack(parray)
>>> numpy.array_equal(a, a2)
True
>>> a = numpy.array(['å', 'ç', 'ø'])
>>> parray = blosc2.pack(a)
>>> a2 = blosc2.unpack(parray)
>>> numpy.array_equal(a, a2)
True