- awswrangler.s3.download(path: str, local_file: Union[str, Any], version_id: Optional[str] = None, use_threads: bool = True, boto3_session: Optional[boto3.session.Session] = None, s3_additional_kwargs: Optional[Dict[str, Any]] = None) None ¶
Download file from from a received S3 path to local file.
In case of use_threads=True the number of threads that will be spawned will be gotten from os.cpu_count().
path (str) – S3 path (e.g.
local_file (Union[str, Any]) – A file-like object in binary mode or a path to local file (e.g.
version_id (Optional[str]) – Version id of the object.
use_threads (bool) – True to enable concurrent requests, False to disable multiple threads. If enabled os.cpu_count() will be used as the max number of threads.
s3_additional_kwargs (Optional[Dict[str, Any]]) – Forward to botocore requests, only “SSECustomerAlgorithm”, “SSECustomerKey” and “RequestPayer” arguments will be considered.
- Return type
Downloading a file using a path to local file
>>> import awswrangler as wr >>> wr.s3.download(path='s3://bucket/key', local_file='./key')
Downloading a file using a file-like object
>>> import awswrangler as wr >>> with open(file='./key', mode='wb') as local_f: >>> wr.s3.download(path='s3://bucket/key', local_file=local_f)