Google Firebase, Storage folder names?

966 views
Skip to first unread message

Herprit Singh

unread,
Nov 28, 2016, 4:08:05 PM11/28/16
to Firebase Google Group
Hey, 

Do someone know how to retrieve the folder names from google firebase project, maybe in form of a list? 
I can read that you only can specify folder names and then upload to that folder.
  

Benjamin Wulfe

unread,
Nov 28, 2016, 10:40:47 PM11/28/16
to Firebase Google Group
There isn't really a concept of a "Folder" in either Google Cloud Storage or Firebase Storage.
Folders are simply common portions of a path that two objects happen to share.

For example:
gs://bucket/images/image1.png
gs://bucket/images/image2.png

There is no concrete folder object that represents "images".  There are simply two objects whose paths have something in common (they are both under "/images/").  That said, the Firebase Storage SDK gives you some ways to organize your data into these "folders" via a StorageReference at that point.

StorageReference images = FirebaseStorage.getInstance().getReference().child("images");  <== represents the "images" part of the path for a future item.
images.child("image1.png").getBytes(...);  <== downloads image1.png.

The SDK does not give any options to list these "folders" at this time.  However, you can build your own directory structure using the realtime database.  This has the benefit of realtime updates to clients when you update it.  The only complexity here is that you'll need to keep the realtime database in sync as you add more items in storage.

-ben
Reply all
Reply to author
Forward
0 new messages