get_file#
- composer.utils.get_file(path, destination, object_store=None, overwrite=False, progress_bar=True)[source]#
Get a file from a local folder, URL, or object store.
- Parameters
path (str) โ
The path to the file to retrieve.
If
object_storeis specified, then thepathshould be the object name for the file to get. Do not include the the cloud provider or bucket name.If
object_storeis not specified but thepathbegins withhttp://orhttps://, the object at this URL will be downloaded.If
object_storeis not specified, but thepathbegins withs3://, or another backend supported bycomposer.utils.maybe_create_object_store_from_uri()an appropriate object store will be created and used.Otherwise,
pathis presumed to be a local filepath.
destination (str) โ
The destination filepath.
If
pathis a local filepath, then a symlink topathatdestinationwill be created. Otherwise,pathwill be downloaded to a file atdestination.object_store (ObjectStore, optional) โ
An
ObjectStore, ifpathis located inside an object store (i.e. AWS S3 or Google Cloud Storage). (default:None)This
ObjectStoreinstance will be used to retrieve the file. Thepathparameter should be set to the object name within the object store.Set this parameter to
None(the default) ifpathis a URL or a local file.overwrite (bool) โ Whether to overwrite an existing file at
destination. (default:False)progress_bar (bool, optional) โ Whether to show a progress bar. Ignored if
pathis a local file. (default:True)
- Raises
FileNotFoundError โ If the
pathdoes not exist.