Firebase网站:下载URL中的存储位置 [英] Firebase web: Storage Location from Download URL

查看:86
本文介绍了Firebase网站:下载URL中的存储位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个需要存储位置的firebase函数. 现在我已经下载了网址:

https://firebasestorage.googleapis.com/v0/b/dxxxxxxxxx.com/o/videosvideo%3A67423?alt=media&token=acxxxxxxxxxxxxxxxxx

有没有办法像这样获取存储位置:

gs://dexxxxxxxxxxxxxx.com/videosvideo:67423

从给定的下载网址?

解决方案

refFromURl 说,它返回参考并接受:

A URL in the form: 
1) a gs:// URL, for example gs://bucket/files/image.png 
2) a download URL taken from object metadata. 

基于此,我希望以下各项能正常工作:

const downloadUrl = "https://firestorage.googleapis...";
const gsUrl = firebase.storage().refFromUrl(downloadUrl).toString();

I'm writing a firebase function where i need storage location. Right now i have download url:

https://firebasestorage.googleapis.com/v0/b/dxxxxxxxxx.com/o/videosvideo%3A67423?alt=media&token=acxxxxxxxxxxxxxxxxx

Is there a way to get Storage location like this:

gs://dexxxxxxxxxxxxxx.com/videosvideo:67423

from the given download url?

解决方案

The description for refFromURl says that it returns a Reference and accepts:

A URL in the form: 
1) a gs:// URL, for example gs://bucket/files/image.png 
2) a download URL taken from object metadata. 

Based on this, I'd expect the following to work fine:

const downloadUrl = "https://firestorage.googleapis...";
const gsUrl = firebase.storage().refFromUrl(downloadUrl).toString();

这篇关于Firebase网站:下载URL中的存储位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆