【问题标题】:How can we list all folders in firebase storage [closed]我们如何列出firebase存储中的所有文件夹[关闭]
【发布时间】:2020-12-22 06:59:18
【问题描述】:

firebase 存储的官方文档没有规定显示 文件夹,它只提供了 file。那么在这种情况下我该怎么办呢。

【问题讨论】:

  • 欢迎来到社区,请在发布问题前阅读this

标签: javascript firebase-storage


【解决方案1】:

这是不正确的 - 它确实允许您显示嵌套前缀(您称之为文件夹)。 documentation 在提供的示例代码中说明了这一点:

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 包含嵌套在列出的前缀下的前缀列表。请注意,我使用了正确的术语“前缀”。 Cloud Storage 并没有真正的“文件夹”。

【讨论】:

    猜你喜欢
    • 2021-03-29
    • 2021-03-03
    • 2021-12-18
    • 2019-08-10
    • 1970-01-01
    • 1970-01-01
    • 2021-07-04
    • 1970-01-01
    • 2021-03-17
    相关资源
    最近更新 更多