download_file: Download an S3 object to a file

Description Usage Arguments References Examples

View source: R/download-file.R

Description

Download an S3 object to a file

Usage

1
2
3
4
5
6
download_file(bucket, key, filename, extra_args = NULL,
  transfer_config = list(multipart_threshold = 8388608L, max_concurrency =
  10L, multipart_chunksize = 8388608L, num_download_attempts = 5L, max_io_queue
  = 100L, io_chunksize = 262144L, use_threads = TRUE),
  aws_access_key_id = NULL, aws_secret_access_key = NULL,
  aws_session_token = NULL, region_name = NULL, profile_name = NULL)

Arguments

bucket

name of the bucket to download from.

key

name of the key to download from.

filename

path to the file to download to.

extra_args

arguments that may be passed to the client operation.

transfer_config

transfer configuration to be used when performing the transfer. Pre-defined, default values are provided for the following settings:

  • multipart_threshold: The transfer size threshold for which multipart uploads, downloads, and copies will automatically be triggered.

  • max_concurrency: The maximum number of threads that will be making requests to perform a transfer. If use_threads is set to False, the value provided is ignored as the transfer will only ever use the main thread.

  • multipart_chunksize: The partition size of each part for a multipart transfer.

  • num_download_attempts: The number of download attempts that will be retried upon errors with downloading an object in S3. Note that these retries account for errors that occur when streaming down the data from s3 (i.e. socket errors and read timeouts that occur after recieving an OK response from s3). Other retryable exceptions such as throttling errors and 5xx errors are already retried by botocore (this default is 5). This does not take into account the number of exceptions retried by botocore.

  • max_io_queue: The maximum amount of read parts that can be queued in memory to be written for a download. The size of each of these read parts is at most the size of io_chunksize.

  • io_chunksize: The max size of each chunk in the io queue. Currently, this is size used when read is called on the downloaded stream as well.

  • use_threads: If TRUE, threads will be used when performing S3 transfers. If FALSE, no threads will be used in performing transfers: all logic will be ran in the main thread.

aws_access_key_id

AWS access key id

aws_secret_access_key

AWS secret access key

aws_session_token

AWS session token

region_name

region name

profile_name

profile name

References

https://boto3.readthedocs.io/en/latest/reference/services/s3.html#S3.Client.download_file

Examples

1
2
3
4
## Not run: 
download_file("mybucket", "hello.txt", "/tmp/hello.txt")

## End(Not run)

hrbrmstr/roto.s3 documentation built on May 29, 2019, 11:42 a.m.