Blazorme.StreamSaver 26.9.14

dotnet add package Blazorme.StreamSaver --version 26.9.14
                    
NuGet\Install-Package Blazorme.StreamSaver -Version 26.9.14
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Blazorme.StreamSaver" Version="26.9.14" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Blazorme.StreamSaver" Version="26.9.14" />
                    
Directory.Packages.props
<PackageReference Include="Blazorme.StreamSaver" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Blazorme.StreamSaver --version 26.9.14
                    
#r "nuget: Blazorme.StreamSaver, 26.9.14"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Blazorme.StreamSaver@26.9.14
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Blazorme.StreamSaver&version=26.9.14
                    
Install as a Cake Addin
#tool nuget:?package=Blazorme.StreamSaver&version=26.9.14
                    
Install as a Cake Tool

Blazorme.StreamSaver

JSInterop of the StreamSaver package for Blazor. With this package, you can download files by writing incoming data chunks directly to the file instead of accumulating them in memory. This will prevent memory overflows for very large files.

Requires .NET 10. Earlier versions targeted net5.0, which is no longer supported.

Intended for Blazor WebAssembly. It also runs on Blazor Server, but there every chunk crosses the SignalR circuit, which makes it a poor fit for the large transfers this package exists for.

It provides a very simple API:

    public interface IStreamSaver
    {
        Task<Stream> CreateWritableFileStreamAsync(string fileName);
    }

With this call, a C# stream will be returned to the caller. The caller can write(append) data chunks to the file by calling the Stream interface WriteAsync call. After all chunks are written, Close call on the stream will complete the file download.

Installation

  • Install NuGet package:
  Install-Package Blazorme.StreamSaver

Using

In _Imports.razor add:

  @using Blazorme

In a razor file add:

  [Inject]
  IStreamSaver StreamSaver { get; set; }

From code behind, inject the interface to your constructor:

  using Blazorme;
  Xxx(IStreamSaver streamSaver, ...)

JS references

Add the following lines to your index.html file:



    <script src="_content/Blazorme.StreamSaver/polyfill.min.js"></script>
    <script src="_content/Blazorme.StreamSaver/StreamSaver.min.js"></script>

Service addition

Add the following to Program.cs:

  using Blazorme;
  
  Main
  {
      ...
      builder.Services.AddStreamSaver();
      ...
  }
Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Blazorme.StreamSaver:

Package Downloads
WebRTCme.Middleware

Services layer between Blazor or .NET MAUI applications and the WebRTCme library.

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on Blazorme.StreamSaver:

Repository Stars
melihercan/WebRTCme
A cross-platform framework that enables WebRTC support in .NET MAUI (mobile and desktop) and Blazor applications through a single, unified .NET/C# API.
Version Downloads Last Updated
26.9.14 242 9/14/2026
26.9.7 111 9/7/2026
1.0.1 6,731 6/16/2021
1.0.0 582 6/12/2021

Modernised for .NET 10. Targets net10.0 only; net5.0 is no longer supported.
The JS interop is rebuilt on IJSObjectReference modules, replacing System.Private.Runtime.InteropServices.JavaScript — the .NET 5/6 preview WASM API that was removed in .NET 7 and that this package could not have run without.
Fixed: WriteAsync ignored the offset and count it was given and sent the whole array. Stream.WriteAsync(ReadOnlyMemory) supplies an oversized pooled buffer, so downloads had trailing bytes appended.