FileResourceGetter {resourcer} | R Documentation |
File resource getter
Description
File resource getter
File resource getter
Format
A R6 object of class FileResourceGetter
Details
Helper base class for getting the file described by the resource object. ResourceClient class implementations can use this utility to retrieve files from any locations before processing them according to the declared data format.
Methods
Public methods
Method new()
Creates a new FileResourceGetter instance.
Usage
FileResourceGetter$new()
Returns
A FileResourceGetter object.
Method isFor()
Check that the provided parameter is of class "resource" and has a format defined.
Usage
FileResourceGetter$isFor(resource)
Arguments
resource
The resource object to validate.
Returns
A logical.
Method downloadFile()
Stub function which subclasses will implement to make a "resource.file" object from a resource.
Usage
FileResourceGetter$downloadFile(resource, ...)
Arguments
resource
A valid resource object.
...
Additional parameters that may be relevant for FileResourceGetter subclasses.
Returns
A "resource.file" object.
Method extractFileName()
Utility to get the base name from the file path.
Usage
FileResourceGetter$extractFileName(resource)
Arguments
resource
A valid resource object.
Returns
The file base name.
Method makeDownloadDir()
Creates a directory where to download file in the R session's temporary directory. This directory will be flushed when the R session ends.
Usage
FileResourceGetter$makeDownloadDir()
Returns
The path to the download directory.
Method clone()
The objects of this class are cloneable with this method.
Usage
FileResourceGetter$clone(deep = FALSE)
Arguments
deep
Whether to make a deep clone.