javascript - Angular Firebase - 从存储中下载文件
问题描述
我正在尝试使用 firebase 存储来下载文件。我有一个包含电影 URL 的实时数据库。我已经使用应该下载文件的方法创建了服务。我按照firebase docs中的所有内容做了所有事情,但我的方法没有做任何事情。
firebase 文档:https ://firebase.google.com/docs/storage/web/download-files?authuser=1#download_data_via_url
我的代码如下:
public downloadMovie() {
this.fireStorage.storage.refFromURL("https://example_link_for_firebase.com/b/bucket/o/images%20stars.jpg").getDownloadURL().then(url => {
const xhr = new XMLHttpRequest();
xhr.responseType = "blob";
xhr.onload = function(event) {
const blob = xhr.response;
};
xhr.open("GET", url);
xhr.send();
})
}
有任何想法吗?
解决方案
推荐阅读
- angular - 尝试从.net核心WebApi并行执行多个调用中的多个存储过程
- python - 如何在 PySimpleGUI 上获得 pandastable?
- python - Python joblib Parallel n_jobs=1 正在工作。n_jobs=2 不工作。没有错误。空输出。nmslib 模型管道
- excel - 当我在工作簿中添加此代码时收到错误
- java - 我如何告诉 maven 我希望编译后的代码去哪里?
- python - 如何在不使用 reverse() 且不使用 return 的情况下反转列表
- php - 我想将过滤后的数据从数据库发送到我的邮件
- azure-devops - 如何使用 powershell 命令创建名称和机密作为输入参数的 Azure AD B2C 身份体验框架策略密钥
- flutter - 如何使用 Flutter 向 googleSignIn 添加范围
- excel - 在单元格中包含一个字符串