SChunk.append_data#

SChunk.append_data(data: object) int#

Append a data buffer to the SChunk.

The data buffer must be of size chunksize specified in SChunk.__init__.

Parameters:

data (bytes-like object) – The data to be compressed and added as a chunk.

Returns:

out – The number of chunks in the SChunk.

Return type:

int

Raises:

RunTimeError – If the data could not be appended.

Examples

>>> import blosc2
>>> import numpy as np
>>> schunk = blosc2.SChunk(chunksize=200*1000*4)
>>> data = np.arange(200 * 1000, dtype='int32')
>>> schunk.append_data(data)
1