How to download file from the blob storage in CSharp
To download a file from a blob storage, first you have to download the reference or assembly from the nuget package "Azure.Storage.Blobs".
You also have to obtain the connection string from azure blob storage account
private BlobServiceClient blobServiceClient = new BlobServiceClient(connectionString);
var container = _blobServiceClient.GetBlobContainerClient(containerName);
await container.CreateIfNotExistsAsync(Azure.Storage.Blobs.Models.PublicAccessType.BlobContainer);
var blob = container.GetBlobClient("image.png");
await blob.DownloadToAsync("c:\users\documents\image.png");
Comments
Post a Comment