Firebase Cloud Storage下载URL与路径 [英] Firebase Cloud Storage download url vs path
问题描述
我是Firebase存储的新手,想知道什么是最佳实践. 我想将图像上传到Firebase云存储,并返回一个下载URL,然后将其存储到Firestore.下载网址是永久的吗?其他用户将从Firestore中读取以获取下载图片的网址.
I'm new to firebase storage and wants to know what is the best practice. I want to upload image to firebase cloud storage and was returned a download url which I then stored to firestore. Is the download url permanent? Other users will read from the firestore to get the url to download the image.
但是,当我想从CloudStorage删除映像时,我只有下载URL,而没有文件路径.那我要删除它吗?
But when I want to delete the image from CloudStorage, I only have the download url but not the file path. So do I delete it ?
如果我改为存储文件路径,如何获取下载网址?
If I store the file path instead, how to get the download url ?
推荐答案
下载网址是否永久?
Is the download url permanent?
下载URL一直有效,直到您将其撤消为止.
The download URL will work until you revoke it.
我只有下载URL,没有文件路径.那我要删除它吗?
I only have the download url but not the file path. So do I delete it?
You can get a StorageReference
from a download URL by calling FirebaseStorage.getReferenceFromUrl()
(or the equivalent for your platform).
如果我改为存储文件路径,如何获取下载网址?
If I store the file path instead, how to get the download url?
您可以使用 查看全文