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.
connector::Connector -> ConnectorFS
pathcharacter Path to the file storage
new()Initializes the connector for file storage.
ConnectorFS$new(path, extra_class = NULL)pathcharacter Path to the file storage.
extra_classcharacter Extra class to assign to the new connector.
download_cnt()Download content from the file storage. See also download_cnt.
ConnectorFS$download_cnt(src, dest = basename(src), ...)srccharacter The name of the file to download from the connector
destcharacter Path to the file to download to
...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(src, dest = basename(src), ...)srccharacter Path to the file to upload
destcharacter The name of the file to create
...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, ...)namecharacter 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, ...)namecharacter 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(src, dest = basename(src), ...)srccharacter The path to the directory to upload
destcharacter 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(src, dest = basename(src), ...)srccharacter The name of the directory to download from the connector
destcharacter The path to the directory to download to
...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, ...)namecharacter 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)deepWhether to make a deep clone.
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.
# Create file storage connector
folder <- withr::local_tempdir("test", .local_envir = .GlobalEnv)
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()
Run the code above in your browser using DataLab