我正在尝试使用Firebase存储下载文件。我有一个包含电影URL的实时数据库。我已经使用下载文件的方法创建了服务。我做了所有操作,就像在Firebase文档中一样,但是我的方法什么也没做。
firebase docs: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();
})
}
有什么想法吗?