caterva2.File.remove#

File.remove()#

Remove a file from a remote repository.

Returns:

The path of the removed file.

Return type:

str

Examples

>>> import caterva2 as cat2
>>> import numpy as np
>>> # To remove a file you need to be a registered user
>>> urlbase = 'https://cat2.cloud/demo'
>>> root = cat2.Root('@personal', urlbase, dict(username='user@example.com', password='foo'))
>>> path = 'root-example/dir2/ds-4d.b2nd'
>>> root.upload(path)
<Dataset: @personal/root-example/dir2/ds-4d.b2nd>
>>> auth_cookie = cat2.get_auth_cookie(urlbase, dict(username='user@example.com', password='foo'))
>>> file = cat2.File(path, '@personal', urlbase, auth_cookie)
>>> file.remove()
'@personal/root-example/dir2/ds-4d.b2nd'
>>> path in root
False