Streams a file to the store (two passes over the file: one to hash it,
one to send it). The server's ETag is compared with the file's MD5.
Files larger than the config's multipart_threshold (64 MiB by default)
go up as a multipart upload, read part by part, aborted on any failure.
Usage
upload_s3(
path,
key = NULL,
bucket = NULL,
content_type = NULL,
metadata = NULL,
headers = NULL,
config = s3_config()
)Arguments
- path
File to upload.
- key
Object key, or an
s3://bucket/keyURL.NULL,""or a key ending in/gets the file's name appended.- bucket
Bucket; defaults to the config's bucket (
S3PE_BUCKET).- content_type
Content type to store with the object.
- metadata
Named character vector of user metadata, stored with the object as
x-amz-meta-<name>and returned byhead_s3().- headers
Named character vector of extra headers to send with the upload:
Cache-Control,Content-Disposition,Content-Encoding,x-amz-storage-class,x-amz-server-side-encryption, ... (x-amz-*headers are signed).- config
An
s3_config().
Examples
if (FALSE) { # interactive()
upload_s3("output/panel.parquet", "etl/", bucket = "my-bucket")
upload_s3("figure1.png", "s3://my-bucket/report/figure1.png")
upload_s3("report.pdf", "public/", bucket = "my-bucket",
headers = c("Content-Disposition" = "inline"))
}