javascript - 我们如何列出firebase存储中的所有文件夹
问题描述
firebase 存储的官方文档没有规定显示文件夹,它只提供file。那么在这种情况下我该怎么办。
解决方案
这是不正确的 - 它确实允许您显示嵌套前缀(您称之为文件夹)。文档在提供的示例代码中清楚地说明了这一点:
listRef.listAll().then(function(res) {
res.prefixes.forEach(function(folderRef) {
// All the prefixes under listRef.
// You may call listAll() recursively on them.
});
res.items.forEach(function(itemRef) {
// All the items under listRef.
});
}).catch(function(error) {
// Uh-oh, an error occurred!
});
上面,res.prefixes
包含嵌套在列出的前缀下的前缀列表。请注意,我使用了正确的术语“前缀”。云存储实际上没有“文件夹”。
推荐阅读
- python - 解析错误的 XHTML
- java - 在两个字符串之间查找文本(十六进制)
- python - 在 python 中的 Cypher 查询中传递变量
- dart - 如何将 BottomNavigationBar 与 BLoC 一起使用?
- html - ionic 3 storage 获取数据并在 html 中显示
- sql-server - 重叠日期时间的触发器
- spring - 找不到名为“entityManagerFactory”的bean
- android - 如何从其他活动中调用此功能?
- javascript - 使用 Array.includes() 和测试重复项的 JavaScript 问题
- python - np.argsort() 的奇怪/错误输出