caterva2.Root.upload#
- Root.upload(localpath, remotepath=None)#
Uploads a local file to this root.
- Parameters:
- Returns:
A instance of
File
orDataset
.- Return type:
File
Examples
>>> import caterva2 as cat2 >>> import numpy as np >>> # To upload a file you must be registered as a user. >>> client = cat2.Client("https://cat2.cloud/demo", ("joedoe@example.com", "foobar")) >>> root = client.get('@personal') >>> path = f'@personal/dir{np.random.randint(0, 100)}/ds-4d.b2nd' >>> root.upload('root-example/dir2/ds-4d.b2nd') <Dataset: @personal/root-example/dir2/ds-4d.b2nd> >>> 'root-example/dir2/ds-4d.b2nd' in root True