ConnectorFS | R Documentation |
The ConnectorFS class is a file storage connector for accessing and manipulating files any file storage solution. The default implementation includes methods for files stored on local or network drives.
We recommend using the wrapper function connector_fs()
to simplify the process of
creating an object of ConnectorFS class. It provides a more intuitive and user-friendly
approach to initialize the ConnectorFS class and its associated functionalities.
connector::Connector
-> ConnectorFS
path
character Path to the file storage
new()
Initializes the connector for file storage.
ConnectorFS$new(path, extra_class = NULL)
path
character Path to the file storage.
extra_class
character Extra class to assign to the new connector.
download_cnt()
Download content from the file storage. See also download_cnt.
ConnectorFS$download_cnt(name, file = basename(name), ...)
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.
invisible connector_object.
upload_cnt()
Upload a file to the file storage. See also upload_cnt.
ConnectorFS$upload_cnt(file, name = basename(file), ...)
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.
invisible self.
create_directory_cnt()
Create a directory in the file storage. See also create_directory_cnt.
ConnectorFS$create_directory_cnt(name, ...)
name
character The name of the directory to create
...
Additional arguments passed to the method for the individual connector.
ConnectorFS object of a newly created directory
remove_directory_cnt()
Remove a directory from the file storage. See also remove_directory_cnt.
ConnectorFS$remove_directory_cnt(name, ...)
name
character The name of the directory to remove
...
Additional arguments passed to the method for the individual connector.
invisible self.
upload_directory_cnt()
Upload a directory to the file storage. See also upload_directory_cnt.
ConnectorFS$upload_directory_cnt(dir, name = basename(dir), ...)
dir
character The path to the directory to upload
name
character The name of the directory to create
...
Additional arguments passed to the method for the individual connector.
invisible self.
download_directory_cnt()
Download a directory from the file storage. See also download_directory_cnt.
ConnectorFS$download_directory_cnt(name, dir = name, ...)
name
character The name of the directory to download
dir
character The path to the directory to download
...
Additional arguments passed to the method for the individual connector.
invisible connector_object.
tbl_cnt()
Use dplyr verbs to interact with the tibble. See also tbl_cnt.
ConnectorFS$tbl_cnt(name, ...)
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.
A table object.
clone()
The objects of this class are cloneable with this method.
ConnectorFS$clone(deep = FALSE)
deep
Whether to make a deep clone.
# Create file storage connector
folder <- withr::local_tempdir()
cnt <- ConnectorFS$new(folder)
cnt
# You can do the same thing using wrapper function connector_fs()
cnt <- connector_fs(folder)
cnt
# List content
cnt$list_content_cnt()
# Write to the connector
cnt$write_cnt(iris, "iris.rds")
# Check it is there
cnt$list_content_cnt()
# Read the result back
cnt$read_cnt("iris.rds") |>
head()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.