Vorn.Files.Client 8.1.0-rc3

This is a prerelease version of Vorn.Files.Client.
There is a newer version of this package available.
See the version list below for details.
dotnet add package Vorn.Files.Client --version 8.1.0-rc3
                    
NuGet\Install-Package Vorn.Files.Client -Version 8.1.0-rc3
                    
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="Vorn.Files.Client" Version="8.1.0-rc3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Vorn.Files.Client" Version="8.1.0-rc3" />
                    
Directory.Packages.props
<PackageReference Include="Vorn.Files.Client" />
                    
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 Vorn.Files.Client --version 8.1.0-rc3
                    
#r "nuget: Vorn.Files.Client, 8.1.0-rc3"
                    
#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 Vorn.Files.Client@8.1.0-rc3
                    
#: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=Vorn.Files.Client&version=8.1.0-rc3&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Vorn.Files.Client&version=8.1.0-rc3&prerelease
                    
Install as a Cake Tool

Vorn.Files.Client

Vorn.Files.Client is a Blazor-ready client SDK that connects browser applications to a running Vorn.Files.Host instance. It wraps the SignalR based transfer hub that the host exposes and complements it with a composable upload component, checksum helpers, and dependency injection extensions. Together these pieces let you add secure file streaming to any ASP.NET Core UI with only a few lines of code.

Package contents

Area Highlights
Presentation IFilesClient for programmatic uploads and the <StreamTransfer /> Razor component for end-user workflows.
Infrastructure Connection factory that provisions authenticated SignalR hubs via the shared AAAS API client and DI helpers for registering the stack.
Domain DTOs (PendingFileDto, OwnerStatisticsDto) shared with the host contract for progress tracking and analytics.

Prerequisites

  • ASP.NET Core 8.0 application (Blazor Server or interactive WASM) with static web assets enabled.
  • Access to a configured Vorn.Files.Host environment. Authentication and base address are supplied by Vorn.Aaas.Client.Api which must already be configured in your host app.
  • Vorn.EntityManagement.Client.SignalR package (installed automatically as a transitive dependency) must be able to negotiate SignalR connections to the Vorn file hub.

Installation

dotnet add package Vorn.Files.Client

The package references Vorn.Aaas.Client.Api, Vorn.EntityManagement.Client, and SignalR client dependencies, so no additional packages are required when using the supplied helpers.

Service registration

Call AddFilesClient on your WebApplicationBuilder to register the SignalR hub client, connection factory, ambient interception provider, and required caches.

var builder = WebApplication.CreateBuilder(args);

// configure AAAS base address, auth, etc. here (from Vorn.Aaas.Client.Api)

builder.AddFilesClient();

The extension method wires up:

  • IFilesClient implemented by FilesHubClient for hub communication.
  • IEntityConnectionFactory<FileInformationDto> implemented by ConnectionFactory, which creates authenticated SignalR connections using IApiClientService from the AAAS client.
  • Memory cache support and the ambient interception provider required by the shared entity management abstractions.

Once registered, inject IFilesClient into pages or components to stream files.

@inject IFilesClient FilesClient

@code {
    private async Task UploadAsync(Stream fileStream, PendingFileDto pending, CancellationToken ct)
    {
        // Convert the Stream into a ChannelReader<byte[]> using a bounded channel.
        var channel = Channel.CreateBounded<byte[]>(new BoundedChannelOptions(1)
        {
            FullMode = BoundedChannelFullMode.Wait
        });

        _ = Task.Run(async () =>
        {
            try
            {
                byte[] buffer = new byte[64 * 1024];
                int read;
                while((read = await fileStream.ReadAsync(buffer.AsMemory(0, buffer.Length), ct)) > 0)
                {
                    await channel.Writer.WriteAsync(buffer[..read].ToArray(), ct);
                }

                channel.Writer.TryComplete();
            }
            catch(Exception ex)
            {
                channel.Writer.TryComplete(ex);
                throw;
            }
        }, ct);

        FileInformationDto uploaded = await FilesClient.StreamFileAsync(channel.Reader, pending, ct);
        // Use uploaded.Url or metadata to display results.
    }
}

Tip: PendingFileDto carries file name, size, MIME type, checksum, optional thumbnail, upload progress, and user id so you can present meaningful status indicators in your UI.

Using the <StreamTransfer /> component

The StreamTransfer component delivers an end-to-end upload workflow for browsers. It manages a hidden <input type="file">, computes SHA-256 checksums, optionally captures image/video thumbnails, streams file chunks over SignalR, and surfaces progress, pending, and uploaded items back to your UI.

Quick start markup

@page "/files"

<StreamTransfer UserId="@CurrentUserId"
               OnFileUploaded="OnUploaded"
               ContextContent="RenderTransfer" />

@code {
    private string? CurrentUserId => User?.Id;
    private readonly List<FileInformationDto> _files = [];

    private RenderFragment<IStreamTransfer> RenderTransfer => transfer => @<div class="transfer-host">
        <button class="btn" disabled="@transfer.Transferring" @onclick="() => transfer.StartTransferAsync()">
            Upload files
        </button>

        <ul>
            @foreach (var pending in transfer.PendingFiles)
            {
                <li>@pending.Name (@pending.Progress:F1 %)</li>
            }
        </ul>

        <ul>
            @foreach (var file in transfer.UploadedFiles)
            {
                <li><a href="@file.Url" target="_blank">@file.Metadata.ContentType ?? file.Id.ToString()</a></li>
            }
        </ul>
    </div>;

    private Task OnUploaded(FileInformationDto file)
    {
        _files.Add(file);
        return Task.CompletedTask;
    }
}

Component anatomy

  • Activation UI – provide ActivatorContent to render a custom button/label that triggers the hidden file input. Without it the input remains visible for debugging.
  • Context renderingContextContent receives the component instance so you can show pending and uploaded collections or call StartTransferAsync from arbitrary UI elements.
  • Automatic hashing & thumbnails – the JavaScript module computes SHA-256 checksums and optional base64 thumbnails for images/videos before streaming begins, ensuring server-side integrity checks succeed.
  • Streaming pipeline – files are read via IJSStreamReference and pumped into a bounded Channel<byte[]> whose reader is passed to IFilesClient.StreamFileAsync; upload progress is updated as bytes flow.
  • Lifecycle management – the component disposes JS interop resources and tolerates browser disconnects gracefully.

Styling and theming

The component renders only what you place in ContextContent, so apply your existing design system classes. Because the actual <input type="file"> is appended to document.body, style the activator elements instead of the input itself.

Working with uploaded file metadata

Successful transfers return FileInformationDto instances populated with server-side metadata, including size, content type, checksum, owner, and optional tag or thumbnail URL. Metadata is serialised/deserialised automatically, exposing strongly-typed information for UI rendering or analytics.

To query by descriptor (name, checksum, tag), rely on FileInformationDescriptorDto from the shared common package, which the entity management abstractions understand.

Advanced scenarios

  • Custom namespace asset paths – use NamespaceExtension.NamespaceToPath if you relocate components or need to compute static asset URLs that align with the assembly namespace structure.
  • Manual checksum calculationChecksumHelpers.ComputeSHA256Checksum is available for scenarios outside the provided component (e.g., server-side preprocessing). It rewinds the stream so you can reuse it afterwards.
  • AnalyticsOwnerStatisticsDto aggregates per-owner totals and extension counts that you can surface in dashboards using data returned from the host APIs.

Building and contributing

This project is part of the wider Vorn.Files solution. Follow the repository guidelines in the root AGENTS.md for coding standards and architectural expectations when extending the client.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  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 (4)

Showing the top 4 NuGet packages that depend on Vorn.Files.Client:

Package Downloads
Vorn.Interface

This library is designed to provide interface components and services to use VORN infrastructure.

Vorn.Cms.Client

This library contains services required to use Vorn.Cms subsystem.

Vorn.Files.Client.MudBlazor

This library is designed as part of web applications which are clients who get file hosting as a service from a Vorn.Files.Host. It contains visual components using MudBlazor library and includes a reference to that library.

Vorn.Files.Client.FilePond

This library is designed as part of web applications which are clients who get file hosting as a service from a Vorn.Files.Host. It contains visual components using filepond javascript library.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
9.1.2 322 11/16/2025
9.1.1 246 11/15/2025
9.0.2 402 11/10/2025
9.0.1 216 11/9/2025
9.0.0 213 11/5/2025
8.9.4 138 11/29/2025
8.9.3 152 11/29/2025
8.9.2 185 11/23/2025
8.9.1 183 11/23/2025
8.9.0 224 11/9/2025
8.8.0 254 11/2/2025
8.7.1 252 10/29/2025
8.7.0 242 10/27/2025
8.6.2 240 10/27/2025
8.6.1 199 10/25/2025
8.6.0 186 10/25/2025
8.6.0-rc4 183 10/25/2025
8.6.0-rc3 202 10/24/2025
8.6.0-rc2 245 10/23/2025
8.1.0-rc3 189 10/8/2025
Loading failed