download_or_copy#
- download_or_copy(uri: str, target_dir: str, fs: rastervision.pipeline.file_system.file_system.FileSystem | None = None) str [source]#
Download or copy a file to a directory and return the local file path.
If the file already exists in
target_dir
, nothing is done. If the file is elsewhere but still local, it is copied totarget_dir
. If it is remote, it is downloaded to the cache dir and then moved totarget_dir
.- Parameters:
uri (str) – URI of file.
target_dir (str) – Local directory to download or copy file to.
fs (rastervision.pipeline.file_system.file_system.FileSystem | None) – If supplied, use fs instead of automatically chosen
FileSystem
foruri
.
- Returns:
Local path to file.
- Return type: