从谷歌存储下载Firebase的云功能

时间:2017-09-19 13:15:58

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

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

    <?php
        // USE jimport TO PULL IN THE PROFILE PICTURE CLASS
        jimport('profilepicture.profilepicture');

        // GET THE USER OBJECT LIKE YOU ALREADY DID
        $user       = JFactory::getUser();

        // CREATE A NEW INSTANCE OF THE ProfilePicture CLASS PASSING IT THE USER ID
        $userPix    = new ProfilePicture($user->get('id'));

        // ECHO OUT THE ENTIRE HTML FOR THE USER PROFILE PICTURE
        echo $userPix->toHTML();

文档节点包含存储桶中文件的路径。是否可以使用http firebase功能将此文件下载到客户端。根据{{​​3}},我应该能够在快递中流式传输回复。谷歌存储Stream files in node/express to client能为此工作吗?

谢谢,

1 个答案:

答案 0 :(得分:1)

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

const bucket = admin.storage().bucket

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

相关问题