如何在Firebase应用程序中获取Cloud Storage中所有文件的列表? [英] How to get a list of all files in Cloud Storage in a Firebase app?

查看:95
本文介绍了如何在Firebase应用程序中获取Cloud Storage中所有文件的列表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在上载图像,一切正常,但是我有100张照片,我想在我的View中显示所有照片,因为我可以在文件夹中找到图像的完整列表,所以我可以找不到用于此工作的任何API.

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 the images in a folder, I can not find any API for this work.

推荐答案

JavaScript版本6.1 iOS版本6.4 Android发行版18.1 都有列出文件的方法.

Since Firebase SDKs for JavaScript release 6.1, iOS release 6.4, and Android release version 18.1 all have a method to list files.

到目前为止,文档有点稀疏,因此建议您检出

The documentation is a bit sparse so far, so I recommend checking out Rosário's answer for details.

先前的答案,因为这种方法有时仍然有用:

Previous answer, since this approach can still be useful at times:

Firebase SDK中目前没有API调用可列出应用程序内Cloud Storage文件夹中的所有文件.如果需要这种功能,则应将文件的元数据(例如下载URL)存储在可以列出它们的位置. Firebase实时数据库

There currently is no API call in the Firebase SDK to list all files in a Cloud Storage folder from within an app. If you need such functionality, you should store the metadata of the files (such as the download URLs) in a place where you can list them. The Firebase Realtime Database and Cloud Firestore are perfect for this and allows you to also easily share the URLs with others.

您可以在我们的 FriendlyPix 示例应用程序中找到一个不错的示例(但有些涉及).网络版本的相关代码为

You can find a good (but somewhat involved) sample of this in our FriendlyPix sample app. The relevant code for the web version is here, but there are also versions for iOS and Android.

这篇关于如何在Firebase应用程序中获取Cloud Storage中所有文件的列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆