download_cnt: Download content from the connector

View source: R/cnt_generics.R

download_cntR Documentation

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 class 'ConnectorFS'
download_cnt(connector_object, name, file = basename(name), ...)

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.

Value

invisible connector_object.

Examples

# 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")


connector documentation built on June 8, 2025, 11:36 a.m.