如何获取Firebase存储URL

时间:2020-06-04 16:12:03

标签: firebase go google-cloud-storage firebase-storage

我正在用我的Go后端发送带有图像链接的FCM通知。图像存储在Firebase存储中。我需要将存储桶路径解析为可用于创建FCM通知的Url。

似乎有一个Javascript函数(getDownloadUrl)可以做到这一点。如何在Go中获取下载URL?

1 个答案:

答案 0 :(得分:2)

Country population exp.consumption exp.military 1 United States 322.99 14.19 3.54 5 United Kingdom 65.59 18.68 2.18 6 Ireland 4.75 12.22 0.40 7 Netherlands 17.03 24.64 1.13 8 Belgium 11.33 23.46 0.89 9 Luxembourg 0.58 16.84 0.31 exp.military.wdi order exp.econaffairs exp.environment exp.housing 1 3.20 2.06 3.42 0.00 0.54 5 1.81 2.07 3.07 0.79 0.47 6 0.33 1.31 3.12 0.52 0.70 7 1.15 1.88 3.99 1.48 0.44 8 0.92 1.83 6.79 1.00 0.37 9 0.50 1.00 4.80 1.08 0.53 exp.health exp.recreation exp.education exp.socprot exp.genservices 1 8.87 0.25 6.18 7.94 5.38 5 7.55 0.68 5.29 16.63 5.00 6 7.03 0.72 4.49 11.95 5.44 7 8.12 1.46 5.41 16.81 5.13 8 7.92 1.25 6.39 20.07 8.40 9 4.75 1.22 5.22 18.64 4.53 soc.oldage soc.survivors soc.incap soc.health soc.family soc.labmkt 1 6.42 0.66 1.50 14.05 0.64 0.10 5 7.26 0.05 1.95 7.72 3.47 0.19 6 3.57 0.32 1.44 5.30 2.21 0.57 7 6.14 0.09 4.09 8.42 1.46 0.77 8 9.12 1.84 2.93 7.92 2.82 0.72 9 6.67 1.70 3.26 5.10 3.37 0.66 soc.unempl soc.housing soc.other soc.total exp.total 1 0.20 0.26 0.80 24.63 38.18 5 0.27 1.53 0.10 22.55 43.76 6 1.49 0.50 0.12 15.51 35.75 7 1.46 0.45 1.25 24.13 45.93 8 2.95 0.23 0.65 29.19 54.94 9 1.38 0.31 0.49 22.94 42.11 是Firebase客户端SDK的一项功能,用于读取和写入Cloud Storage。后端和服务器SDK没有直接等效项。

Cloud Storage具有类似的概念signed URLs,可用于创建直接访问Cloud Storage中内容的URL。您可以按照文档中的说明直接使用REST API,或者,如果您使用的是Go SDK,则只需直接调用SignedURL即可获得符合您要求的URL。