public async Task DownloadFileAsync(string path) { await Js.InvokeAsync<string>("downloadFile", path); } // In JS function downloadFile(filename) { location.href = '/api/downloads/' + filename; }
References
https://stackoverflow.com/questions/57327440/how-to-download-a-file-from-blazor-server-side
https://learn.microsoft.com/en-us/aspnet/core/blazor/file-downloads?view=aspnetcore-7.0