Vali-Blob.Core 1.0.0

dotnet add package Vali-Blob.Core --version 1.0.0
                    
NuGet\Install-Package Vali-Blob.Core -Version 1.0.0
                    
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="Vali-Blob.Core" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Vali-Blob.Core" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Vali-Blob.Core" />
                    
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 Vali-Blob.Core --version 1.0.0
                    
#r "nuget: Vali-Blob.Core, 1.0.0"
                    
#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 Vali-Blob.Core@1.0.0
                    
#: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=Vali-Blob.Core&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Vali-Blob.Core&version=1.0.0
                    
Install as a Cake Tool

Vali-Blob.Core

NuGet License: MIT .NET

Core abstractions, middleware pipeline, and shared infrastructure for the Vali-Blob ecosystem.

This package defines the IStorageProvider interface and all contracts used across every Vali-Blob provider. It is required by every Vali-Blob application regardless of which cloud provider you target.


Compatibility

Target Framework Supported
netstandard2.0 Yes
netstandard2.1 Yes
net6.0 Yes
net7.0 Yes
net8.0 Yes
net9.0 Yes

Installation

dotnet add package ValiBlob.Core

Then add the provider package of your choice:

dotnet add package ValiBlob.AWS       # Amazon S3 / MinIO
dotnet add package ValiBlob.Azure     # Azure Blob Storage
dotnet add package ValiBlob.GCP       # Google Cloud Storage
dotnet add package ValiBlob.OCI       # Oracle Cloud Infrastructure
dotnet add package ValiBlob.Supabase  # Supabase Storage
dotnet add package ValiBlob.Local     # Local filesystem (dev/test)

Key abstractions

Type Description
IStorageProvider Upload, download, delete, list, copy, move, exists
IStorageFactory Resolve a named or default provider at runtime
StoragePath Typed, normalised path — use instead of raw strings
StorageResult<T> Discriminated result with IsSuccess, Value, ErrorMessage
IResumableUploadProvider Chunked upload with pause/resume support
IPresignedUrlProvider Temporary signed upload/download URLs
IResumableSessionStore Pluggable backend for resumable session tracking

Basic setup

appsettings.json

{
  "ValiBlob": {
    "DefaultProvider": "AWS"
  }
}

Program.cs

using ValiBlob.Core.DependencyInjection;
using ValiBlob.AWS.Extensions;

builder.Services
    .AddValiBlob(opts => opts.DefaultProvider = "AWS")
    .UseAWS();

Upload a file

public class FileService(IStorageProvider storage)
{
    public async Task<string> UploadAsync(Stream content, string fileName)
    {
        var result = await storage.UploadAsync(new UploadRequest
        {
            Path        = StoragePath.From("uploads", fileName),
            Content     = content,
            ContentType = "application/octet-stream"
        });

        if (!result.IsSuccess)
            throw new Exception(result.ErrorMessage);

        return result.Value!.Url;
    }
}

Download a file

var result = await storage.DownloadAsync(new DownloadRequest
{
    Path = StoragePath.From("uploads", "report.pdf")
});

if (result.IsSuccess)
{
    using var stream = result.Value!;
    // use stream
}

Delete a file

var result = await storage.DeleteAsync("uploads/report.pdf");
if (!result.IsSuccess)
    Console.WriteLine($"Delete failed: {result.ErrorMessage}");

Middleware pipeline

Chain middleware in declaration order — each step wraps the next:

builder.Services
    .AddValiBlob(opts => opts.DefaultProvider = "AWS")
    .UseAWS()
    .WithPipeline(p => p
        .UseValidation(v =>
        {
            v.AllowedExtensions = new[] { ".jpg", ".png", ".pdf" };
            v.MaxFileSizeBytes  = 10 * 1024 * 1024; // 10 MB
        })
        .UseCompression()              // GZip for text/JSON/XML
        .UseEncryption(e =>
        {
            e.Key = Convert.FromBase64String(builder.Configuration["Storage:EncryptionKey"]!);
        })
        .Use<MyAuditMiddleware>()      // custom middleware
    );

Built-in middleware

Middleware Description
UseValidation Extension allowlist/blocklist, max size, MIME filtering
UseCompression GZip compression for text-based content types
UseEncryption AES-256-CBC with per-file random IV

StoragePath

Use StoragePath instead of raw strings to avoid path separator bugs:

var path = StoragePath.From("avatars", userId, "profile.jpg");
// → "avatars/{userId}/profile.jpg"

var path2 = StoragePath.From("2024", "01", "report.pdf");
// → "2024/01/report.pdf"

StorageResult<T>

All operations return a StorageResult<T> — no exceptions for expected errors:

var result = await storage.DownloadAsync(...);

if (result.IsSuccess)
    Console.WriteLine($"Size: {result.Value!.Length}");
else
    Console.WriteLine($"Error: {result.ErrorMessage}");

Resilience (Polly)

Vali-Blob.Core ships a Polly-based retry pipeline out of the box:

.AddValiBlob(opts =>
{
    opts.DefaultProvider = "AWS";
    opts.Retry.MaxAttempts    = 3;
    opts.Retry.BaseDelayMs    = 500;
    opts.CircuitBreaker.Enabled = true;
})

Multi-provider

Register multiple providers and select at runtime:

builder.Services
    .AddValiBlob(opts => opts.DefaultProvider = "Azure")
    .UseAWS()
    .UseAzure()
    .UseGCP();

// In a service
public class ArchiveService(IStorageFactory factory)
{
    public async Task MirrorAsync(Stream content, string path)
    {
        var aws   = factory.Create("AWS");
        var azure = factory.Create("Azure");

        await aws.UploadAsync(...);
        await azure.UploadAsync(...);
    }
}

Documentation

Full documentation at vali-blob-docs.netlify.app



Donations

If Vali-Blob is useful to you, consider supporting its development:


License

MIT License

Contributions

Issues and pull requests are welcome on GitHub.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  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 is compatible.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 is compatible. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (10)

Showing the top 5 NuGet packages that depend on Vali-Blob.Core:

Package Downloads
Vali-Blob.ImageSharp

Image processing middleware for Vali-Blob using SixLabors.ImageSharp. Provides an upload pipeline that automatically resizes, converts, and optimizes images before storing them via any Vali-Blob provider (AWS S3, Azure Blob, GCP, OCI, Supabase, Local). Supports thumbnail generation, format conversion (JPEG, PNG, WebP), quality control, and maximum dimension constraints — all configurable via DI options. Targets net6.0, net7.0, net8.0, and net9.0.

Vali-Blob.HealthChecks

ASP.NET Core Health Checks integration for Vali-Blob — the unified cloud storage abstraction library for .NET. Registers health check endpoints that probe the configured IBlobProvider (AWS S3, Azure Blob, GCP, OCI, Supabase, Local) and report Healthy / Degraded / Unhealthy status via the standard Microsoft.Extensions.Diagnostics.HealthChecks infrastructure. Works with all Vali-Blob providers and integrates with existing /health endpoints and dashboards. Targets netstandard2.0, netstandard2.1, net6.0, net7.0, net8.0, and net9.0.

Vali-Blob.Azure

Azure Blob Storage provider for Vali-Blob — the unified cloud storage abstraction library for .NET. Implements IBlobProvider over Azure Blob Storage with full support for upload, download, delete, existence checks, SAS URL generation, resumable block-blob uploads, Polly-powered retry resilience, and seamless DI registration via AddValiBlob(). Targets netstandard2.0, netstandard2.1, net6.0, net7.0, net8.0, and net9.0.

Vali-Blob.AWS

Amazon S3 provider for Vali-Blob — the unified cloud storage abstraction library for .NET. Implements IBlobProvider over AWS S3 with full support for upload, download, delete, existence checks, presigned URL generation, resumable multipart uploads, Polly-powered retry resilience, and seamless DI registration via AddValiBlob(). Targets netstandard2.0, netstandard2.1, net6.0, net7.0, net8.0, and net9.0.

Vali-Blob.Supabase

Supabase Storage provider for Vali-Blob — the unified cloud storage abstraction library for .NET. Implements IBlobProvider over the Supabase Storage REST API with full support for upload, download, delete, existence checks, signed URL generation, resumable TUS-based uploads, Polly-powered retry resilience, and seamless DI registration via AddValiBlob(). Targets netstandard2.0, netstandard2.1, net6.0, net7.0, net8.0, and net9.0.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 467 3/21/2026