ConnectorFS: Connector for file storage

ConnectorFSR Documentation

Connector for file storage

Description

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.

Details

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.

Super class

connector::Connector -> ConnectorFS

Active bindings

path

character Path to the file storage

Methods

Public methods

Inherited methods

Method new()

Initializes the connector for file storage.

Usage
ConnectorFS$new(path, extra_class = NULL)
Arguments
path

character Path to the file storage.

extra_class

character Extra class to assign to the new connector.


Method download_cnt()

Download content from the file storage. See also download_cnt.

Usage
ConnectorFS$download_cnt(name, file = basename(name), ...)
Arguments
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.

Returns

invisible connector_object.


Method upload_cnt()

Upload a file to the file storage. See also upload_cnt.

Usage
ConnectorFS$upload_cnt(file, name = basename(file), ...)
Arguments
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.

Returns

invisible self.


Method create_directory_cnt()

Create a directory in the file storage. See also create_directory_cnt.

Usage
ConnectorFS$create_directory_cnt(name, ...)
Arguments
name

character The name of the directory to create

...

Additional arguments passed to the method for the individual connector.

Returns

ConnectorFS object of a newly created directory


Method remove_directory_cnt()

Remove a directory from the file storage. See also remove_directory_cnt.

Usage
ConnectorFS$remove_directory_cnt(name, ...)
Arguments
name

character The name of the directory to remove

...

Additional arguments passed to the method for the individual connector.

Returns

invisible self.


Method upload_directory_cnt()

Upload a directory to the file storage. See also upload_directory_cnt.

Usage
ConnectorFS$upload_directory_cnt(dir, name = basename(dir), ...)
Arguments
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.

Returns

invisible self.


Method download_directory_cnt()

Download a directory from the file storage. See also download_directory_cnt.

Usage
ConnectorFS$download_directory_cnt(name, dir = name, ...)
Arguments
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.

Returns

invisible connector_object.


Method tbl_cnt()

Use dplyr verbs to interact with the tibble. See also tbl_cnt.

Usage
ConnectorFS$tbl_cnt(name, ...)
Arguments
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.

Returns

A table object.


Method clone()

The objects of this class are cloneable with this method.

Usage
ConnectorFS$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

Examples

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


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