Cloud Storage

Firebase.cloudstore_addfirebase — Method

cloudstoreaddfirebase(bucket; projectid=projectid())

Links a Google Cloud Storage bucket to a Firebase project.

Example

init("[PROJECT_SDK].json")
cloudstore_addfirebase("my-existing-gcs-bucket")
source
Firebase.cloudstore_get — Function

cloudstore_get(file2download; token=nothing, dest=nothing)

Get a file from cloud storage and write it to disk. Returns the path written.

token is the object's download token, required when the bucket's rules do not allow unauthenticated reads. dest overrides the local destination path, which otherwise mirrors the remote path.

Example

init("[PROJECT_SDK].json")
cloudstore_init("https://firebasestorage.googleapis.com/v0/b/[PROJECT_ID].appspot.com/o/")
cloudstore_get("/audio/data.mp3")
cloudstore_get("/data.mp3"; dest="local-copy.mp3")
source
Firebase.cloudstore_getbucket — Method

cloudstoregetbucket(bucket; projectid=projectid())

Gets a single linked storage bucket. bucket is the bucket id, e.g. "my-app.appspot.com".

Example

init("[PROJECT_SDK].json")
cloudstore_getbucket("my-app.appspot.com")
source
Firebase.cloudstore_init — Method

cloudstore_init(url)

Set cloud storage url initialize

Example

cloudstore_init("https://firebasestorage.googleapis.com/v0/b/[PROJECT_ID].appspot.com/o")
source
Firebase.cloudstore_listbuckets — Method

cloudstorelistbuckets(; projectid=projectid(), pagesize=nothing, pagetoken=nothing)

Lists the linked storage buckets for a project.

Note that the Storage Management API identifies the project by its project number, so project_id may need to be the numeric id rather than the textual one.

Example

init("[PROJECT_SDK].json")
cloudstore_listbuckets()
#=
Dict{String, Any} with 1 entry:
  "buckets" => Any[Dict{String, Any}("name"=>"projects/123456789/buckets/my-app.appspot.com")]
=#
source
Firebase.cloudstore_removefirebase — Method

cloudstoreremovefirebase(bucket; projectid=projectid())

Unlinks a linked Google Cloud Storage bucket from a Firebase project. The bucket and its contents are not deleted, they just stop being reachable through Firebase.

Example

init("[PROJECT_SDK].json")
cloudstore_removefirebase("my-app.appspot.com")
source
Firebase.cloudstore_sendfile — Function

cloudstore_sendfile(file2upload)

Send a file to cloud storage to store. The local file is read from file2upload relative to the current directory, and stored under the same path in the bucket.

Example

init("[PROJECT_SDK].json")
cloudstore_init("https://firebasestorage.googleapis.com/v0/b/[PROJECT_ID].appspot.com/o/")
cloudstore_sendfile("/audio/data.mp3")
source
Firebase.content_type — Method
content_type(path) -> String

Best-effort content type for path, from its extension. Falls back to "application/octet-stream".

source