I have binary data in database or Azure Blob, I want to download the file when user hit the Azure Function. How to do it? Seems that HttpResponseData is the way to go, but how? I could not find any example on internet.
I only found some examples of earlier versions of Azure Function (such as Using Azure Function (.NET Core) to Download a file) If I use that example with IActionResult as return type of Run() function, I got this as response:
{
"FileContents": "/9j/4AAQSkZJRgABAQEA......UUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAf/9k=",
"ContentType": "image/jpeg",
"FileDownloadName": "f69bea69-49cd-4a64-a035-8a26505c578e.jpg",
"LastModified": null,
"EntityTag": null,
"EnableRangeProcessing": false
}
Can someone please give me a working example?
If it's from Azure Blob Storage, then I can get a Stream, what is the most efficient way to do it? I don't want to load a 1 GB file into memory then download it to browser.
Thank you!