firebase-storage-kit

Querying files

Check if files exist, read metadata, get download URLs, and delete objects.

StorageManager includes helpers for common read and delete operations on objects already in your bucket.

Check if a file exists

const exists = await manager.exists("uploads/photo.jpg");
ResultMeaning
trueObject exists
falseObject not found

exists returns false only for not found. Permission errors, network failures, and other problems throw — handle them with try/catch.

Get metadata

const meta = await manager.getMetadata("uploads/photo.jpg");
console.log(meta.size, meta.contentType, meta.customMetadata);

Throws if the object does not exist.

Get a download URL

const url = await manager.getDownloadURL("uploads/photo.jpg");

Returns a public or tokenized URL depending on your bucket rules and object ACLs.

Delete a file

await manager.delete("uploads/old.jpg");

Full example

const path = "uploads/photo.jpg";

if (await manager.exists(path)) {
  const meta = await manager.getMetadata(path);
  const url = await manager.getDownloadURL(path);
  console.log(meta.size, url);
}

await manager.delete("uploads/old.jpg");

On this page