Pacem.Storage.Abstractions 1.1.0

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

Pacem Storage

About

Pacem.Storage.Abstractions defines IStorageService, a binary storage addressed by compatible paths (segment/segment/filename), and the StorageService base class its providers derive from:

Package Registration Stores in
Pacem.Storage.FileSystem WithFileSystemServices(o => o.RootPath = …) a local folder
Pacem.Storage.AzureBlob WithAzureBlobServices(o => o.ConnectionString = …) Azure Blob Storage (block blobs)
Pacem.Storage.AwsS3 WithAwsS3Services(…) Amazon S3
Pacem.Storage.OneDrive WithOneDriveServices(…) OneDrive (Microsoft Graph)

Getting started

// Program.cs
services.AddPacemStorage().WithFileSystemServices(options =>
{
    options.RootPath = Path.Combine(environment.ContentRootPath, "storage");
    options.TempFolder = "_temp";
});

// anywhere
string path = storage.BuildCompatiblePath("photo-0001.jpg", tenant, "attachments", "2026", "11");
await storage.UploadIfNotExistsAsync(bytes, path, new Headers { ContentType = "image/jpeg" });
byte[]? stored = await storage.DownloadIfExistsAsync(path);

Uploads are if-not-exists: content already stored at a path is never overwritten, so sending the same content again (a retried request) is harmless.

Streams

Large content (photos, documents) doesn't need to sit in memory: upload from a Stream and read back as one.

// e.g. a multipart request's file part
await using Stream content = file.OpenReadStream();
await storage.UploadIfNotExistsAsync(content, path, new Headers { ContentType = file.ContentType }, cancellationToken);

// e.g. an endpoint answering with the stored content
Stream? stored = await storage.OpenReadIfExistsAsync(path, cancellationToken);
if (stored is null)
{
    return Results.NotFound();
}
return Results.Stream(stored, contentType);   // disposes the stream
  • The content is read from the stream's current position to its end; the stream stays open, the caller disposes it.
  • OpenReadIfExistsAsync answers null when nothing is stored; the caller disposes the stream it gets.
  • Each provider streams natively:
Provider Upload Read
FileSystem copied into a new file (no partial file is left on failure) the file, shared for reading
AzureBlob block blob upload, retried from the same position the blob, read as it downloads
AwsS3 PutObject with the stream the object's response stream
OneDrive Graph's simple upload, sent again when throttled the item's content, read as it downloads
  • Retries need to read the content again. A stream that can't seek (a network body) is first copied to memory (pooled segments, never a temporary file; a MemoryStream is wrapped with no copy), by the providers that retry (AzureBlob, OneDrive, and AwsS3, whose SDK also resends from the start, so a seekable stream not at its start is copied too). FileSystem never copies.
  • A custom implementation deriving from StorageService implements the two stream primitives, UploadIfNotExistsAsync(Stream, …, Headers, …) and OpenReadIfExistsAsync: the byte[] upload and DownloadIfExistsAsync are built on them. ReadAllBytesAsync and CopyToRewindableAsync (extensions of IStorageService) are there for providers that need a buffer.
Product Compatible and additional computed target framework versions.
.NET net11.0 is compatible. 
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 Pacem.Storage.Abstractions:

Package Downloads
Pacem.Storage.FileSystem

Pacem Storage (Binary) Service implementation targeting the underlying filesystem.

Pacem.Storage.AzureBlob

Pacem Storage (Binary) Service implementation targeting Azure Blob Storage.

Pacem.Storage.AwsS3

Pacem Storage (Binary) Service implementation targeting AWS S3 Storage.

Pacem.Storage.OneDrive

Pacem Storage (Binary) Service implementation targeting OneDrive via Graph API.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.1.0 51 11/11/2026
1.1.0-archimedes 48 11/11/2026
1.0.2 114 11/9/2026
1.0.1 90 11/9/2026
1.0.0 116 11/9/2026
1.0.0-tartaglia 147 11/5/2026
1.0.0-stokes 136 11/4/2026
1.0.0-saint-venant 148 11/4/2026
1.0.0-ricci 152 10/28/2026
1.0.0-peano 141 10/27/2026
1.0.0-maiorana 141 10/27/2026
0.10.19 142 10/27/2026
0.10.19-galilei 141 10/27/2026
0.10.19-fermi 140 10/27/2026
0.10.19-degiorgi 138 10/26/2026
0.10.19-cardano 142 10/26/2026
0.10.19-bombelli 148 10/20/2026
0.10.18 155 10/14/2026
0.10.18-venn 137 10/9/2026
0.10.18-turing 138 10/8/2026
Loading failed