How to get a list of all files in Cloud Storage in a Firebase app?

后端 未结 19 1033
傲寒
傲寒 2020-11-21 11:25

I\'m working on uploading images, everything works great, but I have 100 pictures and I would like to show all of them in my View, as I get the complete list of

19条回答
  •  一生所求
    2020-11-21 12:15

    I am using AngularFire and use the following for get all of the downloadURL

    getPhotos(id: string): Observable {
        const ref = this.storage.ref(`photos/${id}`)
        return ref.listAll().pipe(switchMap(list => {
          const calls: Promise[] = [];
          list.items.forEach(item => calls.push(item.getDownloadURL()))
          return Promise.all(calls)
        }));
    }
    

提交回复
热议问题