Magically upload a file
Arguments
- path
(character) one or more file paths to add to the
bucket
. required. cannot include directories- bucket
(character) bucket to copy files to. required. if the bucket does not exist we prompt you asking if you'd like the bucket to be created
- force
(logical) force bucket creation without going through the prompt. default:
FALSE
. Should only be set toTRUE
when required for non-interactive use.- ...
named params passed on to put_object
What is magical
Exits early if files do not exist
Exits early if any
path
values are directoriesCreates the bucket if it does not exist
Adds files to the bucket, figuring out the key to use from the supplied path
Function is vectoried for the
path
argument; you can pass in many file paths
See also
Other files:
aws_file_attr()
,
aws_file_copy()
,
aws_file_delete()
,
aws_file_download()
,
aws_file_exists()
,
aws_file_rename()
,
aws_file_upload()
Other magicians:
six_admin_setup()
,
six_bucket_delete()
,
six_user_create()
,
six_user_delete()
Examples
if (FALSE) { # interactive()
bucket <- random_string("bucket")
demo_rds_file <- file.path(system.file(), "Meta/demo.rds")
six_file_upload(demo_rds_file, bucket)
## many files at once
links_file <- file.path(system.file(), "Meta/links.rds")
six_file_upload(c(demo_rds_file, links_file), bucket)
# set expiration, expire 1 minute from now
six_file_upload(demo_rds_file, bucket, Expires = Sys.time() + 60)
# bucket doesn't exist, ask if you want to create it
six_file_upload(demo_rds_file, "not-a-buckets")
# path doesn't exist
# six_file_upload("file_doesnt_exist.txt", random_string("bucket"))
# directories not supported
mydir <- tempdir()
# six_file_upload(mydir, random_string("bucket"))
}