Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/IvanJosipovic/BlazorFileSaver
Blazor Component wrapper for FileSaver.js
https://github.com/IvanJosipovic/BlazorFileSaver
Last synced: 4 months ago
JSON representation
Blazor Component wrapper for FileSaver.js
- Host: GitHub
- URL: https://github.com/IvanJosipovic/BlazorFileSaver
- Owner: IvanJosipovic
- License: mit
- Archived: true
- Created: 2019-02-09T23:37:12.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2023-12-15T08:27:29.000Z (about 1 year ago)
- Last Synced: 2024-08-01T15:06:14.673Z (7 months ago)
- Language: HTML
- Homepage: https://BlazorFileSaver.netlify.com
- Size: 287 KB
- Stars: 26
- Watchers: 4
- Forks: 8
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# BlazorFileSaver
[](https://blazorfilesaver.netlify.com)
[](https://www.nuget.org/packages/BlazorTable)
[](https://www.nuget.org/packages/BlazorTable)
Blazor Component wrapper for [FileSaver.js](https://github.com/eligrey/FileSaver.js/)
# Demo
[Sample](https://blazorfilesaver.netlify.com)# Installation
- Add Nuget [BlazorFileSaver](https://www.nuget.org/packages/BlazorTable)
- Add ```` to the index.html or _Hosts.cshtml
- Add AddBlazorFileSaver() to the ConfigureServices in Program.cs as noted below# Program.cs
```csharp
namespace BlazorFileSaver.Sample
{
public class Program
{
public static async Task Main(string[] args)
{
var builder = WebAssemblyHostBuilder.CreateDefault(args);
builder.RootComponents.Add("app");builder.Services.AddBlazorFileSaver(); // Add This!
await builder.Build().RunAsync();
}
}
}
```# Example
```csharp
@page "/sample"BlazorFileSaver.Sample
Save
@code {
[Inject]
private IBlazorFileSaver BlazorFileSaver { get; set; }
private string FileName { get; set; } = "Sample.txt";private string Data { get; set; } = "Sample Text";
private async Task Save()
{
await BlazorFileSaver.SaveAs(FileName, Data);
}
}
```# More Examples
[SaveAsBase64 Zip](https://github.com/IvanJosipovic/BlazorFileSaver/blob/master/src/BlazorFileSaver.Sample/Pages/Index.razor)