datalad_next.url_operations.FileUrlOperations
- class datalad_next.url_operations.FileUrlOperations(*, cfg: ConfigManager | None = None)[source]
Bases:
UrlOperations
Handler for operations on file:// URLs
Access to local data via file-scheme URLs is supported with the same API and feature set as other URL-schemes (simultaneous content hashing and progress reporting.
- delete(url: str, *, credential: str | None = None, timeout: float | None = None) Dict [source]
Delete the target of a file:// URL
The target can be a file or a directory. delete will attempt to delete write protected targets (by setting write permissions). If the target is a directory, the complete directory and all its content will be deleted. delete will not modify the permissions of the parent of the target. That means, it will not delete a target in a write protected directory, but it will empty target, if target is a directory.
See
datalad_next.url_operations.UrlOperations.delete()
for parameter documentation and exception behavior.- Raises:
UrlOperationsResourceUnknown -- For deletion targets found absent.
- download(from_url: str, to_path: Path | None, *, credential: str | None = None, hash: list[str] | None = None, timeout: float | None = None) Dict [source]
Copy a file:// URL target to a local path
See
datalad_next.url_operations.UrlOperations.download()
for parameter documentation and exception behavior.- Raises:
UrlOperationsResourceUnknown -- For download targets found absent.
- stat(url: str, *, credential: str | None = None, timeout: float | None = None) Dict [source]
Gather information on a URL target, without downloading it
See
datalad_next.url_operations.UrlOperations.stat()
for parameter documentation and exception behavior.- Raises:
UrlOperationsResourceUnknown -- For access targets found absent.
- upload(from_path: Path | None, to_url: str, *, credential: str | None = None, hash: list[str] | None = None, timeout: float | None = None) Dict [source]
Copy a local file to a file:// URL target
Any missing parent directories of the URL target are created as necessary.
See
datalad_next.url_operations.UrlOperations.upload()
for parameter documentation and exception behavior.- Raises:
FileNotFoundError -- If the source file cannot be found.