Skip to content
Advertisement

When accessing files in Firebase Cloud Storage from a client, is it more cost effective to fetch a file using a downloadURL vs getBlob?

In my web application which uses Firebase v9:

Specific to downloading files from a firebase cloud storage bucket client side, I am concerned about cost and quotas.

Which method is the most cost effective?

  1. use getBlob() to download a file.

  2. use getDownloadURL() to obtain a download url, store it in the DB and subsequently fetch the file.

Looking at the documentation Firebase provides surrounding quotas it is not clear.

Are the quotas which are associated with calls to getBlob() more restrictive than using getDownloadURL() along with a subsequent http request to download the file?

UPDATE:

I understand that getBlob() provides more security via security rules as an alternative to retrieving a publicly accessible downloadURL(). In this case all files are meant to be publicly accessible.

I am concerned specifically about cost at scale over time and whether or not calls to getBlob() would be more cost effective vs having to call getDownloadURL() after every file upload, storing that result in the DB and subsequently making http request(s) to download the file.

It seems to me that the later would ultimately be more expensive in the long run, unless there is a restrictive or limiting quota associated with making calls to getBlob().

Can anyone, preferably from the Firebase team if possible, tell me if a getBlob() call results in a greater impact to quota vs a call to downloadURL() plus subsequent http fetch request(s) to download.

Is there a difference in the long run over time since the later requires making that additional call to getDownloadURL()?

Advertisement

Answer

No, you’ll still be charged for bandwidth same way as the downloadURL. There’s a security benefit however, anyone with the downloadURL could see and download the image. But you can use getBlob() if you don’t want to return a URL but download the file itself (protected by security rules). This way a user cannot share any downloadURL.

Checkout this Firebase Release Notes video where this is explained in detail.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement