Storage | R Documentation |
Storage
Storage
An object of class Storage
.
firebase::Firebase
-> Storage
new()
Storage$new( config_path = "firebase.rds", session = shiny::getDefaultReactiveDomain() )
config_path
Path to the configuration file as created by firebase_config
.
session
A valid shiny session.
Initialiases Firebase Storage
Initialises the Firebase Storage application client-side.
ref()
Storage$ref(path = NULL)
path
Path to the file, directory, bucket, or
full URL to file.
If NULL
creates a path to the root.
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.
Invisibly return the class instance.
upload_file()
Storage$upload_file(file, response = TRUE)
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)
with get_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 the get_response
method.
Upload a File
Upload a file to the store system or bucket. Requires a valid authentication.
\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 }) }
download_file()
Storage$download_file(response = TRUE)
response
A boolean or character string.
TRUE
indicates that you want to capture the
results of the file upload (e.g.: success or failed)
with get_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 the get_response
method.
Download a File
Download a file from the store system or bucket. Requires a valid authentication.
\dontrun{ s <- Storage$new() s$ ref("test.png")$ upload_file("path/to/file.png")$ download_file("dl") observeEvent(s$get_response("dl"), { # do something }) }
delete_file()
Storage$delete_file(response = TRUE)
response
A boolean or character string.
TRUE
indicates that you want to capture the
results of the file upload (e.g.: success or failed)
with get_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 the get_response
method.
Delete a File
Delete a file from the store system or bucket. Requires a valid authentication.
get_metadata()
Storage$get_metadata(response = TRUE)
response
A boolean or character string.
TRUE
indicates that you want to capture the
results of the file upload (e.g.: success or failed)
with get_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 the get_response
method.
File Metadata
Get the metadata of a file from the store system or bucket. Requires a valid authentication.
list_files_all()
Storage$list_files_all(response = TRUE)
response
A boolean or character string.
TRUE
indicates that you want to capture the
results of the file upload (e.g.: success or failed)
with get_response
method. A character string is
used as named of the response which then can be used
in the get_response
method.
List All Files
List all files in the reference (ref
).
Requires a valid authentication.
get_response()
Storage$get_response(response = NULL)
response
Name of the response.
Capture response
clone()
The objects of this class are cloneable with this method.
Storage$clone(deep = FALSE)
deep
Whether to make a deep clone.
## ------------------------------------------------
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.