Learn R Programming

connector (version 0.1.0)

download_cnt: Download content from the connector

Description

Generic implementing of how to download files from a connector:

  • ConnectorFS: Uses fs::file_copy() to copy a file from the file storage to the desired file.

Usage

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

# S3 method for ConnectorFS download_cnt(connector_object, name, file = basename(name), ...)

Value

invisible connector_object.

Arguments

connector_object

Connector The connector object to use.

name

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

file

character Path to the file to download to or upload from

...

Additional arguments passed to the method for the individual connector.

Examples

Run this code
# Download file from a file storage

folder <- withr::local_tempdir()
cnt <- connector_fs(folder)

cnt |>
  write_cnt("this is an example", "example.txt")

list.files(pattern = "example.txt")

cnt |>
  download_cnt("example.txt")

list.files(pattern = "example.txt")
readLines("example.txt")

cnt |>
  remove_cnt("example.txt")

Run the code above in your browser using DataLab