Get Download URL from file uploaded with Cloud Functions for Firebase

后端 未结 23 1814
春和景丽
春和景丽 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:50

    With the recent changes in the functions object response you can get everything you need to "stitch" together the download URL like so:

     const img_url = 'https://firebasestorage.googleapis.com/v0/b/[YOUR BUCKET]/o/'
    + encodeURIComponent(object.name)
    + '?alt=media&token='
    + object.metadata.firebaseStorageDownloadTokens;
    
    console.log('URL',img_url);
    

提交回复
热议问题