caterva2.File#
- class caterva2.File(root, path)#
- Attributes:
- client
- cookie
- urlbase
- vlmeta
Returns a mapping of metalayer names to their respective values.
This is used to access variable-length metalayers (user attributes) associated with the file.
>>> import caterva2 as cat2 >>> client = cat2.Client('https://demo.caterva2.net') >>> root = client.get('example') >>> file = root['ds-sc-attr.b2nd'] >>> file.vlmeta {'a': 1, 'b': 'foo', 'c': 123.456}
Methods
copy
(dst)Copies the file to a new location.
download
([localpath])Downloads the file to storage.
Retrieves the download URL for the file.
move
(dst)Moves the file to a new location.
remove
()Removes the file from the remote repository.
slice
(key[, as_blosc2])Get a slice of a File/Dataset.
- __init__(root, path)#
Represents a file, which can be a Blosc2 dataset or a regular file on a root repository.
This class is not intended for direct instantiation; it should be accessed through a
Root
instance.Examples
>>> import caterva2 as cat2 >>> client = cat2.Client('https://demo.caterva2.net') >>> root = client.get('example') >>> file = root['README.md'] >>> file <File: example/README.md> >>> file.name 'README.md' >>> file.urlbase 'https://demo.caterva2.net' >>> file.path PurePosixPath('example/README.md') >>> file.meta['contiguous'] True
Methods
__init__
(root, path)Represents a file, which can be a Blosc2 dataset or a regular file on a root repository.
copy
(dst)Copies the file to a new location.
download
([localpath])Downloads the file to storage.
Retrieves the download URL for the file.
move
(dst)Moves the file to a new location.
remove
()Removes the file from the remote repository.
Attributes
Returns a mapping of metalayer names to their respective values.