SharpS3.StrongName
1.0.0
dotnet add package SharpS3.StrongName --version 1.0.0
NuGet\Install-Package SharpS3.StrongName -Version 1.0.0
<PackageReference Include="SharpS3.StrongName" Version="1.0.0" />
<PackageVersion Include="SharpS3.StrongName" Version="1.0.0" />
<PackageReference Include="SharpS3.StrongName" />
paket add SharpS3.StrongName --version 1.0.0
#r "nuget: SharpS3.StrongName, 1.0.0"
#:package SharpS3.StrongName@1.0.0
#addin nuget:?package=SharpS3.StrongName&version=1.0.0
#tool nuget:?package=SharpS3.StrongName&version=1.0.0
SharpS3
A transport-agnostic .NET library for building Amazon S3 compatible clients, servers, and storage backends.
Features
- Single-Port In-Process Server: Zero subprocesses or separate server ports. Mounts directly into any web framework pipeline or custom endpoints on the same port as your application.
- Transport-Agnostic Protocol Engine: Operates entirely on raw HTTP metadata (
method,path,headers,query) and standardSystem.IO.Stream, with zero coupling to any web server or socket layer. - Client & Server SDK: Strongly-typed interfaces to build S3 client applications (
ISharpS3Client) and S3-compatible service hosts (ISharpS3Server). - Comprehensive S3 API Support:
- Service operations (
ListBuckets) - Bucket operations (
CreateBucket,DeleteBucket,BucketExists,GetBucketLocation,Get/PutBucketAcl,Get/PutBucketTagging) - Object operations (
GetObject,PutObject,DeleteObject,DeleteObjects,HeadObject,CopyObject,Get/PutObjectAcl,Get/PutObjectTagging,Get/PutObjectLegalHold,Get/PutObjectRetention) - Multipart upload workflow (
CreateMultipartUpload,UploadPart,UploadPartCopy,CompleteMultipartUpload,AbortMultipartUpload,ListParts,ListMultipartUploads) - Byte-range streaming (
Range: bytes=start-endand suffix ranges)
- Service operations (
- AOT & Trimming: Full support for Native AOT compilation and assembly trimming.
- No Reflection: Uses compile-time Roslyn source generators (
SharpS3.Generators) for XML serialization and deserialization with zero runtime reflection for optimal performance and trim safety. - AWS SDK Compatible: Fully verified against the official Amazon AWS SDK for .NET (
AWSSDK.S3). - Streaming AWS-Chunked Decoding & SigV4 Verification: Native streaming decode for
STREAMING-AWS4-HMAC-SHA256-PAYLOADpayloads with on-the-fly chunk and trailer HMAC verification viaAwsChunkedDecodingStream. - Presigned URLs: Built-in support for generating and validating SigV4 presigned URLs with custom expirations.
- Pluggable Storage Backends (
IS3StorageBackend):InMemoryStorageBackend: Fast, thread-safe in-memory backend for unit tests and local development.FileSystemStorageBackend: Production-grade disk storage with directory-based buckets, file-based objects, atomic streaming writes, XML sidecar metadata (.s3meta.xml), path-traversal protection, and directory pruning.
- Verb-Specific & Catch-All Routing: Clean
ReceiveGetRequestAsync,ReceiveHeadRequestAsync,ReceivePutRequestAsync,ReceivePostRequestAsync, andReceiveDeleteRequestAsyncmethods alongside catch-allReceiveRequestAsync. - Built-in Observability & OpenTelemetry: Instruments metric counters, histograms, and distributed tracing spans via
System.Diagnostics.MetricsandSystem.Diagnostics.ActivitySource. - Target Frameworks: Targets
.NET Standard 2.0and.NET 10.0for broad cross-platform and runtime support.
Installation
Install the library via NuGet:
dotnet add package SharpS3
Getting Started
1. S3 Client Quick Start
Initialize SharpS3Client and perform standard S3 operations:
using SharpS3;
using SharpS3.Models;
// 1. Initialize client
var options = new SharpS3ClientOptions
{
Endpoint = new Uri("http://localhost:8000"),
AccessKey = "test-access-key",
SecretKey = "test-secret-key",
ForcePathStyle = true
};
using ISharpS3Client client = new SharpS3Client(options);
// 2. Create a bucket
await client.CreateBucketAsync("my-bucket");
// 3. Upload an object
await client.PutObjectAsync("my-bucket", "documents/sample.txt", "Hello S3 from SharpS3!");
// 4. Download an object
using var response = await client.GetObjectAsync("my-bucket", "documents/sample.txt");
string content = await response.ReadAsStringAsync();
Console.WriteLine($"Downloaded: {content}");
// 5. Generate a presigned URL (valid for 1 hour)
Uri presignedUrl = client.GeneratePresignedUrl("my-bucket", "documents/sample.txt", HttpMethod.Get, TimeSpan.FromHours(1));
Console.WriteLine($"Presigned URL: {presignedUrl}");
2. S3 Server & Protocol Engine
SharpS3 is transport-agnostic and decoupled from any web server. Receive and dispatch requests in any framework using ISharpS3Server and S3RequestDispatcher:
using SharpS3;
using SharpS3.Dispatch;
using SharpS3.Storage;
// 1. Initialize SharpS3 protocol server and storage backend
ISharpS3Server s3Server = new SharpS3Server();
IS3StorageBackend backend = new FileSystemStorageBackend(@"C:\Data\S3Storage");
var dispatcher = new S3RequestDispatcher(backend);
// 2. Parse incoming HTTP request metadata and body stream
var s3Request = await s3Server.ReceiveRequestAsync(
httpMethod: "GET",
path: "/my-bucket/documents/sample.txt",
queryParameters: queryDictionary,
headers: headerDictionary,
bodyStream: requestStream);
// 3. Dispatch to storage backend and obtain response stream
using var s3Response = await dispatcher.DispatchAsync(s3Request);
Console.WriteLine($"Status: {s3Response.StatusCode}, Content-Type: {s3Response.ContentType}");
3. Using Official AWS SDK (AWSSDK.S3)
Any standard AWS SDK client can connect directly to your SharpS3 server:
using Amazon.S3;
using Amazon.S3.Model;
var s3Config = new AmazonS3Config
{
ServiceURL = "http://localhost:8000",
ForcePathStyle = true,
UseHttp = true
};
using var awsClient = new AmazonS3Client("test-key", "test-secret", s3Config);
// List buckets using AWS SDK
var response = await awsClient.ListBucketsAsync();
foreach (var b in response.Buckets)
{
Console.WriteLine($"Bucket: {b.BucketName}");
}
Storage Backends
SharpS3 separates the S3 wire protocol from persistence through the IS3StorageBackend interface:
| Backend | Implementation | Best Used For |
|---|---|---|
| In-Memory | InMemoryStorageBackend |
Unit testing, integration tests, mock services, ephemeral cache |
| File System | FileSystemStorageBackend |
Local S3 storage, edge appliances, NAS/SAN storage, on-prem S3 |
| Custom | IS3StorageBackend |
Azure Blob, Google Cloud Storage, SQLite, or database backends |
Custom Storage Backend Example
Implement IS3StorageBackend to back S3 requests with any custom store:
public class CustomStorageBackend : IS3StorageBackend
{
public Task<ListAllMyBucketsResult> ListBucketsAsync(IS3Request request, CancellationToken ct = default)
{
// Custom bucket listing logic...
}
public Task<S3ObjectPayload> ReadObjectAsync(string bucket, string key, IS3Request request, CancellationToken ct = default)
{
// Custom stream streaming logic...
}
// Implement remaining bucket and object operations...
}
Contributing
Contributions are welcome! Please feel free to submit issues, pull requests, or feature proposals.
License
SharpS3 is provided as-is under the MIT license.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. 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 was computed. 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 was computed. 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 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. |
| .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 was computed. |
| .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. |
-
.NETStandard 2.0
- No dependencies.
-
net10.0
- No dependencies.
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 |
|---|---|---|
| 1.0.0 | 57 | 11/22/2026 |