I had the same trouble with getting content of the file in Firebase Storage, but finally, I found there is no way to read the file content directly.
However, I did it like this.
fileRef.getDownloadURL()
.then(url => {
var xhr = new XMLHttpRequest();
xhr.responseType = 'json';
xhr.onload = function(event) {
var json= xhr.response;
console.log(json); // now you read the file content
};
xhr.open('GET', url);
xhr.send();
})
.catch(err => {
// process exceptions
})
What is important was configuring the CORS settings. You can find the instructions here.
Skipping this instruction made me consume much time :/
I hope others avoid the same mistakes. Thanks.