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

后端 未结 19 1010
傲寒
傲寒 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<string[]> {
        const ref = this.storage.ref(`photos/${id}`)
        return ref.listAll().pipe(switchMap(list => {
          const calls: Promise<string>[] = [];
          list.items.forEach(item => calls.push(item.getDownloadURL()))
          return Promise.all(calls)
        }));
    }
    
    0 讨论(0)
提交回复
热议问题