Skip to contents

Download an S3 bucket

Usage

aws_bucket_download(bucket, dest_path, ...)

Arguments

bucket

(character) bucket name. required

dest_path

(character) destination directory to store files. required

...

named parameters passed on to s3fs::s3_dir_download()

Value

path (character) to downloaded file(s)/directory

Note

Requires the env var AWS_REGION. This function prompts you to make sure that you want to delete the bucket.

Examples

if (FALSE) { # aws_has_creds()
bucket <- random_bucket()
aws_bucket_create(bucket = bucket)
desc_file <- file.path(system.file(), "DESCRIPTION")
aws_file_upload(desc_file, s3_path(bucket, "DESCRIPTION.txt"))
aws_file_upload(desc_file, s3_path(bucket, "d_file.txt"))
temp_dir <- file.path(tempdir(), bucket)
aws_bucket_download(bucket = bucket, dest_path = temp_dir)
fs::dir_ls(temp_dir)

# cleanup
six_bucket_delete(bucket, force = TRUE)
}