简体   繁体   中英

What is the difference between putFile() and putStream() methods of StorageReference of Firebase cloud storage?

I want to upload files to the Firebase cloud storage. I found that there are two different methods that I can use, which are StorageReference.putFile() and StorageReference.putStream() . I am confused on what is the difference between these two methods.

PS: I do not even know the difference between stream and file.

The difference is that these are overloded methods and are using different parameters. There are three flavours of putFile() method:

  1. putFile(Uri uri, StorageMetadata metadata, Uri existingUploadUri)
  2. putFile(Uri uri, StorageMetadata metadata)
  3. putFile(Uri uri)

While putStream() method has only two flavours:

  1. putStream(InputStream stream, StorageMetadata metadata)
  2. putStream(InputStream stream)

All these methods do the same, asynchronously uploads from a content URI to this StorageReference and all three return UploadTask .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM