Pacem.Storage.Abstractions
1.0.2
See the version list below for details.
dotnet add package Pacem.Storage.Abstractions --version 1.0.2
NuGet\Install-Package Pacem.Storage.Abstractions -Version 1.0.2
<PackageReference Include="Pacem.Storage.Abstractions" Version="1.0.2" />
<PackageVersion Include="Pacem.Storage.Abstractions" Version="1.0.2" />
<PackageReference Include="Pacem.Storage.Abstractions" />
paket add Pacem.Storage.Abstractions --version 1.0.2
#r "nuget: Pacem.Storage.Abstractions, 1.0.2"
#:package Pacem.Storage.Abstractions@1.0.2
#addin nuget:?package=Pacem.Storage.Abstractions&version=1.0.2
#tool nuget:?package=Pacem.Storage.Abstractions&version=1.0.2
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.
OpenReadIfExistsAsyncanswersnullwhen 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
MemoryStreamis 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
StorageServiceimplements the two stream primitives,UploadIfNotExistsAsync(Stream, …, Headers, …)andOpenReadIfExistsAsync: thebyte[]upload andDownloadIfExistsAsyncare built on them.ReadAllBytesAsyncandCopyToRewindableAsync(extensions ofIStorageService) are there for providers that need a buffer.
| Product | Versions 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. |
-
net10.0
- Pacem.Core (>= 1.0.2)
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 |