File references and metadata

file path

A file is uniquely identified by its path in the bucket. It includes the file extension.

file reference

We use references to interact with files. We build them with file paths:

const fileRef = ref(storage, "tts/2F14Izjv.mp3")
const fileRef = bucket.file("tts/2F14Izjv.mp3") // admin SDK

The file reference does not guarantee the file existence. The properties are of limited use:

ref.bucket // "abc.firebasestorage.app"
ref.fullPath // "tts/abc.mp3"
ref.name // "abc.mp3"

// computed references
ref.parent // ref(storage, "tts")
ref.root // ref(storage, "/")

file metadata

We fetch an existing file's metadata:

const metadata = await getMetadata(fileRef) // client SDK

It is a FullMetadata instance:

// repeat from fileRef
metadata.bucket
metadata.fullPath
metadata.name

metadata.size // 1048576 (bytes)
metadata.contentType // "audio/mpeg" (MIME type)
metadata.timeCreated // "2026-01-04T12:34:56.789Z"

metadata.ref // file reference
earlymorning logo

© Antoine Weber 2026 - All rights reserved

File references and metadata

file path

A file is uniquely identified by its path in the bucket. It includes the file extension.

file reference

We use references to interact with files. We build them with file paths:

const fileRef = ref(storage, "tts/2F14Izjv.mp3")
const fileRef = bucket.file("tts/2F14Izjv.mp3") // admin SDK

The file reference does not guarantee the file existence. The properties are of limited use:

ref.bucket // "abc.firebasestorage.app"
ref.fullPath // "tts/abc.mp3"
ref.name // "abc.mp3"

// computed references
ref.parent // ref(storage, "tts")
ref.root // ref(storage, "/")

file metadata

We fetch an existing file's metadata:

const metadata = await getMetadata(fileRef) // client SDK

It is a FullMetadata instance:

// repeat from fileRef
metadata.bucket
metadata.fullPath
metadata.name

metadata.size // 1048576 (bytes)
metadata.contentType // "audio/mpeg" (MIME type)
metadata.timeCreated // "2026-01-04T12:34:56.789Z"

metadata.ref // file reference