caterva2.File#

class caterva2.File(name, root, host)#

A file is either a Blosc2 dataset or a regular file on a root repository.

Parameters:
  • name (str) – The name of the file.

  • root (str) – The name of the root.

  • host (str) – The host to query.

Examples

>>> root = cat2.Root('foo')
>>> file = root['README.md']
>>> file.name
'README.md'
>>> file.host
'localhost:8002'
>>> file.path
PosixPath('foo/README.md')
>>> file.meta['cparams']
{'codec': 5, 'typesize': 1, 'blocksize': 32768}
>>> file[:25]
b'This is a simple example,'
>>> file[0]
b'T'
Attributes:
vlmeta

Access variable-length metalayers (i.e. user attributes) for a file.

>>> root = cat2.Root('foo')
>>> file = root['ds-sc-attr.b2nd']
>>> file.vlmeta
{'a': 1, 'b': 'foo', 'c': 123.456}
dict

The mapping of metalayer names to their respective values.

Methods

download()

Download a file.

fetch([slice_, prefer_schunk])

Fetch a slice of a dataset.

get_download_url()

Get the download URL for a file.

__init__(name, root, host)#

Methods

__init__(name, root, host)

download()

Download a file.

fetch([slice_, prefer_schunk])

Fetch a slice of a dataset.

get_download_url()

Get the download URL for a file.

Attributes

vlmeta

Access variable-length metalayers (i.e. user attributes) for a file.