Search code examples
c#azure-functionszipazure-blob-storageazure-http-trigger

unzip Http FormFile in Azure Function


I have a front hand in which the user can download a zip. My idea is to use http triggered azure function to unzip that file and send it to Azure blob storage. Therefore I am simulating the http function with postman sending the zip in the form-data. I am not able to figure it out how to go from the Http.FormFile to the unzipped file that I am going to send. I am using c#.

Do you have some suggestion/reference ?

Maybe my approach is wrong and I should send the data(which unzipped is like 60-70 Mb) first to the blob and then use a Blob trigger to send the unzipped file to another container. This last approach feel to me more resource intensive. Which would you choose ?


Solution

  • As per article credits by FBoucher

    Install the extension from Inside Visual Studio Code and Azure Function Core Tools set the setting AzureWebJobsStorage to UseDevelopmentStorage=true in the local.settings.json file.

    {
        "IsEncrypted": false,
        "Values": {
            "AzureWebJobsStorage": "UseDevelopmentStorage=true",
            "FUNCTIONS_WORKER_RUNTIME": "dotnet",
            "unziptools_STORAGE": "DefaultEndpointsProtocol=https;AccountName=unziptools;AccountKey=XXXXXXXXX;EndpointSuffix=core.windows.net",
        }
    }
    

    In Azure Function Extension, select your subscription and Function App name under Function App use AzUnzipEverything -> add new setting -> create cloud5mins_storage, destinationStorage and destinationContainer.

    In your storage account -> resource group -> select your blob -> input files -> upload a zip file

    After few mins uploaded zip file will be Unzipped into the blob storage container output-files.

    For your Reference :

    https://github.com/FBoucher/AzUnzipEverything by FBoucher