Web Api+Azure Storage Account Download File|Download File from Azure storage | How to download azure file from asp.net core webapi| Download file from blob storage
Downloading file from azure storage account through web api can be done with very simple code. Azure SDK provided many classes to download file from azure storage account using web api. We can go in hierarchy of the classes ranging from Azure Storage Service then azure storage container then azure blob or even with the Blob it self.
We can download file from azure storage account using connection strings, shared access tokens and even with the blob url itself. In this web api file download azure storage account demo, we have used connection string to download file from azure storage account using .net core web api.
To download file from azure storage account using .Net6 webapi, we need to create a BlobContainerClient and it has an overload which accepts connection string, azure storage container name and blob name to download azure storage blob from web api.
Downloading file from storage account using web api needs creating a stream as the web api file download from storage account returns stream of bytes as file. we can use blob container client's downloadToAsync method to copy the stream of azure storage blob to the memory stream. Then we need to extract the stream to download azure blob from asp.net web api.
we can get the content type of the azure storage blob using container client get properties method and the container client itself can provide us the blob and the same we can use to download azure storage account blob using web api.
once you run the solution after doing all the above mentioned steps, it will open the swagger UI. you can click on the action then try now to download the file from azure storage account using web api.
00:00 Introduction
00:30 webapi azure storage download file project creation
05:10 Testing web api download azure blob
#webapiazuredownloadfile#
#azurestorage#
#azurestoragedownloadfileasp.netcore#