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()

Note

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

Examples

if (FALSE) { # interactive()
bucket <- random_string("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
aws_bucket_delete("tmp-bucket-369")
}