Storage
reference
file terminology, file patterns
Firebase Storage is a wrapper around Google's Cloud Storage, a cloud storage service. It is technically an object storage service because it stores immutable objects in a flat bucket, instead of files in a hierarchical filesystem.
Firebase Storage reintroduces the concept of files, folders and file hierarchy, primarily through the convention of using paths as object names, such as public/abc.png. The SDKs and docs use the term file instead of objects.
project's default bucket (implementation detail)
A Firebase project is given a default bucket, with a given URI. The bucket's URI serves to distinguish it from other ones. It is made of two components: a gs:// prefix and a domain name. The default bucket's domain uses the project's name, which makes it globally unique. If we add another bucket, we pick a globally unique name by ourselves:
"gs://<PROJECT-ID>.firebasestorage.app"
"gs://<PROJECT-ID>.appspot.com" // old default bucket URIs
"gs://<GLOBALLY-UNIQUE-ID>" // non-default bucket URI
The URIs are not HTTP URLs: no data is served if we force HTTP URLs out of them.
storage helper
We get a storage helper.
- Firebase exports a storage variable so we use another name for the helper.
- The client SDK uses the default bucket unless we specify another one in the initializer:
const storageService = getStorage(app)
const storageService = getStorage(app, "gs://...")