Azure Blob storage: DownloadToByteArray VS DownloadToStream

Clippy
Messages : 22157
Inscription : mer. 22 avr. 2026, 17:33

Azure Blob storage: DownloadToByteArray VS DownloadToStream

Message par Clippy »

Azure Blob storage: DownloadToByteArray VS DownloadToStream
Clippy
Messages : 22157
Inscription : mer. 22 avr. 2026, 17:33

Re: Azure Blob storage: DownloadToByteArray VS DownloadToStream

Message par Clippy »

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](https://stackoverflow.com/questions/6752000/downloading-azure-blob-files-in-mvc3)
Répondre

Revenir à « Azure Infrastructure »