Storage

reference

file terminology

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, and uses that terminology exclusively. Among other things, It does so by naming objects with their hierarchical path such as public/abc.png.

project's default bucket (implementation detail)

A Firebase project is given a default bucket, with a given URI:

"gs://<PROJECT-ID>.firebasestorage.app"
"gs://<PROJECT-ID>.appspot.com" // old default bucket URIs

The bucket's URI serves to distinguish it from other buckets.

  • It is made of two components: a gs:// prefix and a domain name.
  • The default bucket's domain uses the project's name as a subdomain, which makes it globally unique.
  • If we add another bucket, we pick a globally unique name by ourselves:
"gs://<GLOBALLY-UNIQUE-ID>" // non-default bucket URI

The URIs only act as identifiers. There is no matching HTTP endpoint and no server listening to, for example, abc.firebasestorage.app.

storage helper

We get a storage helper for use in various storage related functions:

  • We don't name it storage because Firebase already exports a storage variable. We use another name such as storageService or bucket.
  • The client SDK uses the default bucket unless we specify another one in the initializer:
const storageService = getStorage(app)
const storageService = getStorage(app, "gs://...")

// const bucket = getStorage().bucket(); // admin SDK
earlymorning logo

Storage

reference

file terminology

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, and uses that terminology exclusively. Among other things, It does so by naming objects with their hierarchical path such as public/abc.png.

project's default bucket (implementation detail)

A Firebase project is given a default bucket, with a given URI:

"gs://<PROJECT-ID>.firebasestorage.app"
"gs://<PROJECT-ID>.appspot.com" // old default bucket URIs

The bucket's URI serves to distinguish it from other buckets.

  • It is made of two components: a gs:// prefix and a domain name.
  • The default bucket's domain uses the project's name as a subdomain, which makes it globally unique.
  • If we add another bucket, we pick a globally unique name by ourselves:
"gs://<GLOBALLY-UNIQUE-ID>" // non-default bucket URI

The URIs only act as identifiers. There is no matching HTTP endpoint and no server listening to, for example, abc.firebasestorage.app.

storage helper

We get a storage helper for use in various storage related functions:

  • We don't name it storage because Firebase already exports a storage variable. We use another name such as storageService or bucket.
  • The client SDK uses the default bucket unless we specify another one in the initializer:
const storageService = getStorage(app)
const storageService = getStorage(app, "gs://...")

// const bucket = getStorage().bucket(); // admin SDK