Get Download URL from file uploaded with Cloud Functions for Firebase

后端 未结 23 2446
春和景丽
春和景丽 2020-11-22 01:19

After uploading a file in Firebase Storage with Functions for Firebase, I\'d like to get the download url of the file.

I have this :

...

return buck         


        
23条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2020-11-22 01:57

    answer by https://stackoverflow.com/users/269447/laurent works best

    const uploadOptions: UploadOptions = {
        public: true
    };
    
    const bucket = admin.storage().bucket();
    [ffile] = await bucket.upload(oPath, uploadOptions);
    ffile.metadata.mediaLink // this is what you need
    

提交回复
热议问题