s3io_write: Write a file to AWS S3

View source: R/s3io_write.R

s3io_writeR Documentation

Write a file to AWS S3

Description

Write a file to AWS S3

Usage

s3io_write(
  obj,
  bucket,
  key,
  writefun,
  ...,
  .localfile = fs::file_temp(),
  .rm_localfile = TRUE,
  .aws_config = NULL,
  .put_object_opts = NULL,
  .opts = .aws_config
)

Arguments

obj

<anything> The object to write.

bucket

<chr(1)> AWS S3 bucket name.

key

<chr(1)> AWS S3 object key.

writefun

<function> A write function where the first argument is the object to write and the second argument is a filepath. The function's signature should look like writefun(obj, file, ...).

...

Additional arguments passed on to writefun.

.localfile

<chr(1)> The local filepath for the initial write-to-disk.

.rm_localfile

<lgl(1)> Remove localfile once the copy-to-S3 is complete?

.opts

<dict> Additional –opts for the AWS CLI 'aws s3api put-object' command. A common option you may want to specify, e.g., is content-type: .opts = list("content-type" = "application/json").

Value

The returned value from writefun.

Examples

## Not run: 
  s3io_write(iris, "mybucket", "my/object/key.csv", readr::write_csv, col_names = TRUE)

## End(Not run)

mmuurr/s3io documentation built on Jan. 5, 2023, 2:19 p.m.