如何检查Firebase存储中是否存在文件? [英] how to check if file exists in Firebase Storage?

查看:230
本文介绍了如何检查Firebase存储中是否存在文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在使用数据库时,您可以执行 snapshot.exists()来检查是否存在某些数据。根据文档,没有类似的存储方法。



https://firebase.google.com/docs/reference/js/firebase.storage.Reference



<如何检查Firebase存储中是否存在某个文件?

解决方案

我相信FB存储API用户只能请求一个存在的文件。

因此,一个不存在的文件将不得不作为一个错误处理:
< a href =https://firebase.google.com/docs/storage/web/handle-errors =nofollow> https://firebase.google.com/docs/storage/web/handle-errors


When using the database you can do snapshot.exists() to check if certain data exists. According to the docs there isn't a similar method with storage.

https://firebase.google.com/docs/reference/js/firebase.storage.Reference

What is the proper way of checking if a certain file exists in Firebase Storage?

解决方案

I believe that the FB storage API is setup in a way that the user only request a file that exists.

Thus a non-existing file will have to be handled as an error: https://firebase.google.com/docs/storage/web/handle-errors

这篇关于如何检查Firebase存储中是否存在文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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