Upload a local file to a cloud storage bucket
Usage
upload_cloud_file(file, provider, options, name = file)
Arguments
- file
a file-path (character) to upload. A vector with multiple files
is also supported.
- provider
cloud provider to use, either "gcs" or "aws"
- options
named list with cloud provider options, see details
- name
What to call the file once uploaded. Default is the filepath
Value
If provider
is "gcs" and if successful a list of medatada objects
Details
Google Cloud Services
For Google Cloud Services ("gcs") options must be a list with two fields:
bucket
with the bucketname (character) you are uploading to, and
service_account_key
with the contents of the authentication json file you
have downloaded from your Google Project (if cloud_storage_authenticate has
not been called before).
This function uses googleCloudStorageR::gcs_upload under the hood to upload
the file.
Examples
# Google Cloud Services
if (FALSE) { # \dontrun{
authentication_details <- readLines("location_of_json_file.json")
upload_cloud_file(
file = "table_to_upload.csv",
provider = "gcs",
options = list(
service_account_key = authentication_details,
bucket = "my-bucket"
)
)
} # }