简体   繁体   中英

Difference between DownloadTo(stream) vs DownloadTo(string) in working with Azure Storage blob

I am working with the Azure Storage and I am using the functionality to download the blob from the Azure Storage Container. I did the search and found several overload methods to download.

I want to understand what is the difference between the method that takes the stream vs string. I currently used the DownloadTo(string folderTodownLoad). However, if I want to use the stream what should I pass as a parameter and what would be the purpose or benefit if any over Download(string) method.

在此处输入图像描述

DownloadTo(string) downloads directly to your file system and supports downloading multiple blocks at a time.

DownloadTo(stream) downloads a single block at a time to an stream, the advantage of this, is that it provides you more flexibility. An simple example could be downloading to an GZipStream so you can decompress an file while downloading it from blob storage.

Another example could be downloading to an MemoryStream, so you can process the result in memory right away, instead of having to load the file from disk.

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