firebase-cpp-sdk icon indicating copy to clipboard operation
firebase-cpp-sdk copied to clipboard

Need a way to list items in a storage bucket

Open mark-grimes opened this issue 6 years ago • 3 comments

Please fill in the following fields:

Pre-built SDK from the website or open-source from this repo: website, retrieved 10/Mar/2010 Firebase C++ SDK version: 6.12.0 Firebase plugins in use (Auth, Database, etc.): auth, storage Additional SDKs you are using (Facebook, AdMob, etc.): n/a Platform you are using the C++ SDK on (Mac, Windows, or Linux): Mac Platform you are targeting (iOS, Android, and/or desktop): iOS and desktop

Please describe the issue here:

(Please list the full steps to reproduce the issue. Include device logs, Unity logs, and stack traces if available.)

We use date-time stamps to create unique filenames, so it's very difficult to retrieve files afterwards without being able to list and iterate over the bucket contents.

All other APIs have storageRef.list() and storageRef.listAll() to list items in a storage bucket, except for C++. Getting a list of all items (rather than per "directory") would be fine, but there's currently no way to do this either.

It is possible to get some results by calling rootStorageRef.GetBytes(...)/GetFile(...), which returns a JSON listing. This isn't a full list though, because it has nextPageToken to get the next pagination but there is no way (as far as I can see) to use this token to get the next set of results in C++.

Another option would be to have the functionality to craft custom curl requests, so that missing C++ API methods could be worked around by adding things like nextPageToken into the endpoint call. If this functionality already exists I can't find it.

Please answer the following, if applicable:

Have you been able to reproduce this issue with just the Firebase C++ quickstarts ?

Not applicable, because quickstarts doesn't exercise the requested functionality.

What's the issue repro rate? (eg 100%, 1/5 etc)

100% (missing/requested feature).

mark-grimes avatar Mar 10 '20 19:03 mark-grimes

For the time being a workaround is to store download URLs in Realtime Database.

morganchen12 avatar Mar 10 '20 19:03 morganchen12

Is there any technical reason why this is still not exposed in the C++ SDK, given that it's been available in the other SDKs for 2 years? Makes a huge impact on complexity and dev effort across all projects using the C++ Storage API, so it seems like a worthwhile thing to prioritize if there's nothing blocking it.

ttgil avatar Oct 12 '21 00:10 ttgil

Almost 4 years later, I stumbled over this and had to implement a tedious workaround using a combination of Firestore and Storage. Not being able to use list()/listAll() makes what would have been so easy, complex.

familan avatar Jul 22 '25 08:07 familan

Hi everyone, With PR #1842 we have added in a list all for storage references.
This will be included in the upcoming release. I'll come back and link the exact release version when we have it

AustinBenoit avatar Mar 25 '26 14:03 AustinBenoit

Hi, With release 13.6.0 we have added support for list all for storage references.

AustinBenoit avatar Apr 15 '26 13:04 AustinBenoit