Skip to content

Instantly share code, notes, and snippets.

@vertonghenb
Created November 9, 2020 22:58
Show Gist options
  • Save vertonghenb/649e0d396877c5e5072fce09574106bf to your computer and use it in GitHub Desktop.
Save vertonghenb/649e0d396877c5e5072fce09574106bf to your computer and use it in GitHub Desktop.
Blob Stream Example
[HttpGet]
public async Task<IActionResult> Get()
{
BlobContainerClient container = new BlobContainerClient(_connectionString, "test");
var blockBlob = container.GetBlobClient("test.mp4");
Stream fileStream = new MemoryStream();
var contentType = "multipart/x-mixed-replace;boundary=myboundary";
await blockBlob.DownloadToAsync(fileStream);
var result = new FileStreamResult(fileStream, contentType)
{
EnableRangeProcessing = true
};
return result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment