SyntaxCircus.Storage 0.1.3

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

SyntaxCircus.Storage

Build NuGet License: MIT

A stream-based file/blob storage abstraction, a local-disk implementation, and a config-driven provider switch. No ASP.NET Core dependency — usable from any .NET host.

No support guaranteed. Published as-is and maintained on a best-effort basis. Issues and PRs are welcome, but there's no SLA — fork it or vendor what you need if that's not enough.

Usage

builder.Services.AddStorageProvider(builder.Configuration); // binds "Storage" and "Storage:Local"
{ "Storage": { "Provider": "Local" }, "Storage:Local": { "RootPath": "/var/data/my-app" } }
public sealed class WidgetService(IStorageProvider storage)
{
    public async Task<StoredObject> UploadAsync(string id, Stream content, CancellationToken ct)
        => await storage.StoreAsync(new StoreObjectRequest($"widgets/{id}.bin", content), ct);
}

IStorageProviderStoreAsync/ReadAsync/ExistsAsync/DeleteAsync, all keyed by an opaque string path-like key. ReadAsync returns StorageReadResult? (null if the key doesn't exist), which is itself an IAsyncDisposable wrapping the content stream — dispose it (or await using) once you're done reading.

Only "Local" is built in today (writes under a configured RootPath, with path-traversal and rooted/absolute keys rejected). Cloud-backed providers (S3, Azure Blob, etc.) aren't included yet — implement IStorageProvider yourself and register it directly instead of calling AddStorageProvider; the interface is designed so that isn't a breaking change to adopt later.

Building access URLs

{ "Storage": { "Provider": "Local" }, "Storage:Local": { "RootPath": "/var/data/my-app", "PublicBaseUrl": "https://cdn.example.com/files" } }
var url = await storage.GetAccessUrlAsync("widgets/abc.bin", ct); // https://cdn.example.com/files/widgets/abc.bin

GetAccessUrlAsync is a default interface method, so it's additive — any existing IStorageProvider implementation keeps compiling unchanged and simply doesn't support it (throws NotSupportedException) until it opts in. LocalFileStorageProvider builds a stable {PublicBaseUrl}/{key} URL and requires PublicBaseUrl to be configured; the expiry parameter exists for providers that support signed/time-limited URLs and is ignored on local disk.

Contributing

Issues and pull requests are welcome:

  • Keep changes focused, with a clear description of the behavior change.
  • Match the existing code style (see .editorconfig).
  • Call out any breaking changes to the public API in your PR description.

License

MIT — see LICENSE.txt.

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

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.2.1 76 9/6/2026
0.2.0 459 8/27/2026
0.1.3 105 8/18/2026
0.1.2 108 8/17/2026
0.1.1 107 8/16/2026