I am currently working on a website that will download a Blob file from the Azure Blob Storage and displayed as an image. The file has been saved as Base64 and I am having issues downloading the file to the stream. I try multiple ways and everything leads to no result. This is what I have so far:
[HttpGet]
public async IActionResult ViewFile(string name)
{
BlobServiceClient blobServiceClient = new BlobServiceClient(System.Environment.GetEnvironmentVariable("BlobConnection"));
BlobContainerClient containerClient = blobServiceClient.GetBlobContainerClient("store-images");
// this will allow us access to the file inside the container via the file name
//var blob = containerClient.GetBlobs(prefix: name);
//var blobContainerUri = containerClient.GetBlobClient(name);
BlobClient blob = containerClient.GetBlobClient(name);
MemoryStream stream = new MemoryStream();
await blob.DownloadStreamingAsync(stream);
stream.Position = 0;
return stream;
}