根据这些文档,我了解到一旦我们在存储中有了Firebase路径,我们就可以通过调用此路径上的
ref
的getDownloadUrl()
来获取下载URL。我的问题是所有的文档都建议先获取下载URL,然后基于这些图像下载文件数据,但我们能否将此下载URL保存在我们的实时数据库中,以便我们不必每次调用getDownloadUrl()
?
当前文件上传和下载工作流程 ->
上传:
1. upload file to storage in specific path.
2. store path in realtime DB to persist for future downloading purposes
下载
1. get object from realtime DB and retrieve storage path
2. get storage object
3. get url from getDownloadUrl() on that object
4. download data from url
更好的上传/下载工作流 ->
上传:
1. upload file to storage in specific path.
2. get download url from storage object
3. store download path in realtime DB to persist for future downloading purposes
下载
1. get object from realtime DB
2. get download url stored in object
3. download data from download url
getDownloadUrl()
在底层做了什么,给定的url是否是静态的?
getDownloadUrl()
。 - paulsm4