pyvista_zstd.read_buffer

Contents

pyvista_zstd.read_buffer#

pyvista_zstd.read_buffer(data: bytes | bytearray | memoryview | NDArray[Any], n_threads: int | None = None) DataSet#

Decompress a pyvista-zstd container already held in memory.

read() for bytes rather than a path – an archive member, a response body, or a build with no filesystem to open a path on. The bytes are borrowed, not copied, and must not be modified while the read is running: a write into them is not detected, so the dataset comes back with undefined contents and no error to say so. A resize is detected, and raises BufferError rather than corrupting anything.

This is a convenience function that uses Reader. Use that class to finely tune reading.

Parameters:
databytes | bytearray | memoryview | numpy.ndarray

A whole .pv or .zvtk container, contiguous.

n_threadsNone | int, optional

Workers to spread the frames over, exactly as in read().

Returns:
pyvista.DataSet

Examples

>>> from pathlib import Path
>>> import pyvista_zstd
>>> ds = pyvista_zstd.read_buffer(Path("dataset.pv").read_bytes())