Azure Blob storage: DownloadToByteArray VS DownloadToStream

后端 未结 3 1369
别跟我提以往
别跟我提以往 2021-01-31 14:42

I have been playing with the Azure Blob Storage service to save/recover files in a context of a web page to be hosted in Azure Web Pages.

During the learning process I h

3条回答
  •  眼角桃花
    2021-01-31 15:15

    The benefit of Stream is that you can deal with bits piece-by-piece as they are downloaded rather than building up a big byte[] and then operating on the full thing. Your use of Stream isn't really getting the benefits since you are writing to a file and then reading that full file into memory. A good use of the stream API would be to pipe the download stream directly to the request's response stream as shown in the answer here Downloading Azure Blob files in MVC3

提交回复
热议问题