Fast download from files to the browser from Blazor without any javascript library reference or dependency.
BlazorDownloadFileFast is the solution to saving files on the client-side, and is perfect for web apps that generates files on the client.
When using this project in a NET 5.0 or 6.0 Blazor WebAssembly project, there is an additional speed increase. Read the blog post mentioned from Gérald Barré in the credits.
builder.Services.AddBlazorDownloadFile();
[Inject]
public IBlazorDownloadFileService BlazorDownloadFileService { get; set; }
byte[] bytes = ...;
await BlazorDownloadFileService.DownloadFileAsync("example.txt", bytes);
- The idea and code from this project is based on Generating and efficiently exporting a file in a Blazor WebAssembly application
- For resolving the Content-Type based on the file extension, this code is used: MimeTypeMap
- This project is inspired by BlazorDownloadFile