【问题标题】:Cloud Functions for Firebase download from google storageCloud Functions for Firebase 从谷歌存储下载
【发布时间】:2018-02-28 07:16:05
【问题描述】:

我在 firebase 中有一个集合,看起来像这样:

people: 
 -KuM2GgA5JdH0Inem6lGaddclose
   appliedTo: "-KuM1IB5TisBtc34y2Bb"
   document: "docs/837c2500-9cbe-11e7-8ac1-17a6c37e2057"
   name: "Test Testerson"

文档节点包含存储桶中文件的路径。是否可以使用 http firebase 功能将此文件下载到客户端。根据Stream files in node/express to client,我应该能够快速响应。 google-storage readstream 会为此工作吗?

谢谢,

【问题讨论】:

    标签: node.js firebase google-cloud-storage google-cloud-functions


    【解决方案1】:

    Firebase Admin SDK 有一个您可以使用的 Storage 对象。它为您提供了一个进入Google Cloud Storage SDK 的入口点,该入口点可以与存储桶进行交互。

    const bucket = admin.storage().bucket
    

    使用此Bucket 对象上传和下载文件。您应该能够使用流向客户端发送内容。

    【讨论】:

      猜你喜欢
      • 2018-01-27
      • 2017-09-27
      • 2017-08-15
      • 2017-11-06
      • 2018-10-01
      • 2017-10-19
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多