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: 18 days 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 (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2023-12-15T08:27:29.000Z (11 months ago)
- Last Synced: 2024-08-01T15:06:14.673Z (4 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
[![Demo](https://img.shields.io/badge/Live-Demo-Blue?style=flat-square)](https://blazorfilesaver.netlify.com)
[![Nuget (with prereleases)](https://img.shields.io/nuget/vpre/BlazorFileSaver.svg?style=flat-square)](https://www.nuget.org/packages/BlazorTable)
[![Nuget (with prereleases)](https://img.shields.io/nuget/dt/BlazorFileSaver.svg?style=flat-square)](https://www.nuget.org/packages/BlazorTable)
![](https://github.com/IvanJosipovic/BlazorFileSaver/workflows/CI/CD/badge.svg)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)