Skip to contents

Generic implementing of how to upload files to a connector:

Usage

upload_cnt(connector_object, file, name = basename(file), ...)

# S3 method for class 'connector_fs'
upload_cnt(connector_object, file, name = basename(file), ...)

Arguments

connector_object

connector The connector object to use.

file

character Path to the file to download to or upload from

name

character Name of the content to read, write, or remove. Typically the table name.

...

Additional arguments passed to the method for the individual connector.

Value

invisible connector_object.

Examples

# Upload file to a file storage

writeLines("this is an example", "example.txt")

cnt <- connector_fs$new(tempdir())

cnt |>
  list_content_cnt(pattern = "example.txt")
#> character(0)

cnt |>
  upload_cnt("example.txt")

cnt |>
  list_content_cnt(pattern = "example.txt")
#> [1] "example.txt"

cnt |>
  remove_cnt("example.txt")

file.remove("example.txt")
#> [1] TRUE