caterva2.download#
- caterva2.download(dataset, localpath=None, urlbase=None, auth_cookie=None)#
Download a dataset to storage.
Note: If the dataset is a regular file, it will be downloaded and decompressed if Blosc2 is installed. Otherwise, it will be downloaded as-is (i.e. compressed with Blosc2, and with the .b2 extension).
- Parameters:
dataset¶ (Path) – The path of the dataset.
localpath¶ (Path) – The path to download the dataset to. If not provided, the dataset will be downloaded to the current working directory.
urlbase¶ (str) – The base of URLs of the subscriber to query. Default is
caterva2.sub_urlbase_default
.auth_cookie¶ (str) – An optional HTTP cookie for authorizing access.
- Returns:
The path to the downloaded file.
- Return type:
Path
Examples
>>> import caterva2 as cat2 >>> import pathlib >>> urlbase = 'https://demo.caterva2.net' >>> path = 'example/ds-2d-fields.b2nd' >>> cat2.subscribe('example', urlbase) 'Ok' >>> cat2.download(pathlib.Path(path), urlbase=urlbase) PosixPath('example/ds-2d-fields.b2nd')