‘getBytes()’和’getStream()’方法在Firebase存储中有什么区别?

huangapple go评论78阅读模式
英文:

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.

huangapple
  • 本文由 发表于 2020年9月15日 21:07:34
  • 转载请务必保留本文链接:https://go.coder-hub.com/63902518.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定