Object: reference and metadata
object reference
the reference does not guarantee the object's existence. We use the reference to upload data and to download the object.
The object reference exposes properties related to the object's location and exposes related references.
// location (strings)
bucket
fullPath
name
// reference
parent
root
build a reference
We build the reference by providing the object's name, which is its full path within the bucket. That is, it includes the file extension and the parents' path.
ref(storage, objectName)
ref(storage, "tts/2F1ZqipqaG0Mg....KoFq4Izjv.mp3") // a file name
object metadata
firebase gathers the object's metadata in a FullMetadata object, which exposes properties such as the size, the contentType and the creation date.
// location (strings)
bucket
fullPath
name
// size, type and time
size
contentType
timeCreated
// objects reference
ref
we may fetch the metadata of an existing object:
const metadata = await getMetadata(fileRef);