英文:
What is the difference between 'getBytes()' and 'getStream()' methods in Firebase Storage?
问题
我对开发领域相对较新,正在努力学习 Firebase 存储。有一些名为 getStream 和 getBytes 的方法。能否有人帮我理解它们各自的具体用途呢?谢谢。
英文:
I am relatively new to the field of development and I am trying to learn firebase Storage. There are some methods named getStream and getBytes. Can some one help me understand what are there specific use cases.
Thanks.
答案1
得分: 3
在这里有可用的文档。文档中提到,对于两者都是:“异步下载对象”,一次你会将其作为流接收,另一次作为字节数组接收,但是使用getBytes时,“将分配足够大的字节数组以在内存中容纳整个文件。因此,使用此方法将影响进程的内存使用情况。如果你正在下载许多大文件,则使用getStream(StreamDownloadTask.StreamProcessor)可能是更好的选择。”
英文:
There's documentation available. It says for both: Asynchronously downloads the object, one time you receive it as a stream, the other as an array of bytes, but with getBytes A byte array will be allocated large enough to hold the entire file in memory. Therefore, using this method will impact memory usage of your process. If you are downloading many large files, getStream(StreamDownloadTask.StreamProcessor) may be a better option.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论