Storage {firebase} | R Documentation |
Storage
Description
Storage
Storage
Value
An object of class Storage
.
Super class
firebase::Firebase
-> Storage
Methods
Public methods
Inherited methods
Method new()
Usage
Storage$new( config_path = "firebase.rds", session = shiny::getDefaultReactiveDomain() )
Arguments
config_path
Path to the configuration file as created by
firebase_config
.session
A valid shiny session.
Details
Initialiases Firebase Storage
Initialises the Firebase Storage application client-side.
Method ref()
Usage
Storage$ref(path = NULL)
Arguments
path
Path to the file, directory, bucket, or full URL to file. If
NULL
creates a path to the root.
Details
Reference
Creates a reference to a file or directory you want to operate on. Note that this reference persists, make sure you change it between operations.
Returns
Invisibly return the class instance.
Method upload_file()
Usage
Storage$upload_file(file, response = TRUE)
Arguments
file
Path to the file to upload.
response
A boolean or character string.
TRUE
indicates that you want to capture the results of the file upload (e.g.: success or failed) withget_response
method.FALSE
indicates you do not want those results back. A character string is used as named of the response which then can be used in theget_response
method.
Details
Upload a File
Upload a file to the store system or bucket. Requires a valid authentication.
Examples
\dontrun{ s <- Storage$new() # default response s$ ref("test.png")$ upload_file("path/to/file.png") observeEvent(s$get_response(), { # do something }) # named response s$ ref("test.png")$ upload_file("path/to/file.png", response = "fl") observeEvent(s$get_response("fl"), { # do something }) }
Method download_file()
Usage
Storage$download_file(response = TRUE)
Arguments
response
A boolean or character string.
TRUE
indicates that you want to capture the results of the file upload (e.g.: success or failed) withget_response
method.FALSE
indicates you do not want those results back. A character string is used as named of the response which then can be used in theget_response
method.
Details
Download a File
Download a file from the store system or bucket. Requires a valid authentication.
Examples
\dontrun{ s <- Storage$new() s$ ref("test.png")$ upload_file("path/to/file.png")$ download_file("dl") observeEvent(s$get_response("dl"), { # do something }) }
Method delete_file()
Usage
Storage$delete_file(response = TRUE)
Arguments
response
A boolean or character string.
TRUE
indicates that you want to capture the results of the file upload (e.g.: success or failed) withget_response
method.FALSE
indicates you do not want those results back. A character string is used as named of the response which then can be used in theget_response
method.
Details
Delete a File
Delete a file from the store system or bucket. Requires a valid authentication.
Method get_metadata()
Usage
Storage$get_metadata(response = TRUE)
Arguments
response
A boolean or character string.
TRUE
indicates that you want to capture the results of the file upload (e.g.: success or failed) withget_response
method.FALSE
indicates you do not want those results back. A character string is used as named of the response which then can be used in theget_response
method.
Details
File Metadata
Get the metadata of a file from the store system or bucket. Requires a valid authentication.
Method list_files_all()
Usage
Storage$list_files_all(response = TRUE)
Arguments
response
A boolean or character string.
TRUE
indicates that you want to capture the results of the file upload (e.g.: success or failed) withget_response
method. A character string is used as named of the response which then can be used in theget_response
method.
Details
List All Files
List all files in the reference (ref
).
Requires a valid authentication.
Method get_response()
Usage
Storage$get_response(response = NULL)
Arguments
response
Name of the response.
Details
Capture response
Method clone()
The objects of this class are cloneable with this method.
Usage
Storage$clone(deep = FALSE)
Arguments
deep
Whether to make a deep clone.
Examples
## ------------------------------------------------
## Method `Storage$upload_file`
## ------------------------------------------------
## Not run:
s <- Storage$new()
# default response
s$
ref("test.png")$
upload_file("path/to/file.png")
observeEvent(s$get_response(), {
# do something
})
# named response
s$
ref("test.png")$
upload_file("path/to/file.png", response = "fl")
observeEvent(s$get_response("fl"), {
# do something
})
## End(Not run)
## ------------------------------------------------
## Method `Storage$download_file`
## ------------------------------------------------
## Not run:
s <- Storage$new()
s$
ref("test.png")$
upload_file("path/to/file.png")$
download_file("dl")
observeEvent(s$get_response("dl"), {
# do something
})
## End(Not run)