Hi ,
I am trying to download 1GB video from azure blockblob to memory stream .
error occure System.OutOfMemoryException.
Code:
MemoryStream memoryStream = new MemoryStream();
CloudBlockBlob blockBlob = container.GetBlockBlobReference(path);
myblock.DownloadToStream(memoryStream);
please help
Bhuvanesh MohankumarPosted May 13, 2016, 5:37 AM
One option would be to download the file in pieces and reassemble it once you have the pieces. There are a couple of ways to do that.
1.If the blob was uploaded in multiple blocks, then you could download each block individually. This is supported directly in the client libraries, so if you can do this it's probably easier. You can also download the blocks in parallel to reduce the total time it takes to download.
2.You could use HTTP Range headers to get certain byte ranges. I don't believe this is supported in the clients, so you'd probably have to code it yourself. But it will work even if the blob was not uploaded in blocks. I think this could also be done in parallel, but I'm not sure.
http://stackoverflow.com/questions/5659189/how-to-split-a-large-file-into-chunks-in-c