File references and metadata
file path
A file path uniquely identifies a file in the bucket. It includes the file extension. It starts from the bucket's root.
file reference
- We use references to interact with files
- A file reference does not guarantee the file existence.
- We build them with file (full) paths:
const fileRef = ref(storage, "tts/2F14Izjv.mp3")
// const fileRef = bucket.file("tts/2F14Izjv.mp3") // admin SDK
Note: ref can also build folder references.
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
A file metadata, of type FullMetadata, or FileMetadata on the admin SDK, contains various information about the file:
metadata.size // 1048576 (bytes)
metadata.contentType // "audio/mpeg" (MIME type)
metadata.timeCreated // "2026-01-04T12:34:56.789Z"
metadata.ref // file reference
// repeat from fileRef
// metadata.bucket
// metadata.fullPath
// metadata.name
We fetch an existing file's metadata:
const metadata = await getMetadata(fileRef)
// admin SDK
// const [metadata] = await fileRef.getMetadata()