![]() |
VOOZH | about |
dotnet add package S3Lite --version 1.1.0
NuGet\Install-Package S3Lite -Version 1.1.0
<PackageReference Include="S3Lite" Version="1.1.0" />
<PackageVersion Include="S3Lite" Version="1.1.0" />Directory.Packages.props
<PackageReference Include="S3Lite" />Project file
paket add S3Lite --version 1.1.0
#r "nuget: S3Lite, 1.1.0"
#:package S3Lite@1.1.0
#addin nuget:?package=S3Lite&version=1.1.0Install as a Cake Addin
#tool nuget:?package=S3Lite&version=1.1.0Install as a Cake Tool
Lightweight Amazon S3 and S3-compatible storage client for .NET.
S3Lite keeps the surface area small while still covering the core bucket and object operations most applications actually need. It targets AWS S3, Less3, MinIO, LocalStack, and other S3-compatible endpoints without dragging in the official AWS SDK.
HttpClient support for DI, proxying, custom handlers, and connection reusenetstandard2.0, netstandard2.1, net8.0, and net10.0RestWrapper v3.2.0HttpClient instancesdotnet add package S3Lite
using System;
using System.Text;
using S3Lite;
using S3Lite.ApiObjects;
S3Client s3 = new S3Client()
.WithRegion("us-west-1")
.WithAccessKey("AKIAIOSFODNN7EXAMPLE")
.WithSecretKey("wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY")
.WithRequestStyle(RequestStyleEnum.VirtualHostedStyle)
.WithLogger(Console.WriteLine);
ListAllMyBucketsResult buckets = await s3.Service.ListBucketsAsync();
await s3.Object.WriteAsync(
"my-bucket",
"hello.txt",
Encoding.UTF8.GetBytes("hello from s3lite"),
"text/plain");
byte[] data = await s3.Object.GetAsync("my-bucket", "hello.txt");
Console.WriteLine(Encoding.UTF8.GetString(data));
If a bucket is public, simply omit credentials:
using System;
using S3Lite;
using S3Lite.ApiObjects;
S3Client s3 = new S3Client()
.WithRegion("us-west-1")
.WithRequestStyle(RequestStyleEnum.VirtualHostedStyle);
ListBucketResult result = await s3.Bucket.ListAsync("public-dataset-bucket");
Console.WriteLine(result.Contents.Count);
using S3Lite;
S3Client s3 = new S3Client()
.WithHostname("localhost")
.WithPort(9000)
.WithProtocol(ProtocolEnum.Http)
.WithRegion("us-west-1")
.WithRequestStyle(RequestStyleEnum.PathStyle)
.WithAccessKey("minioadmin")
.WithSecretKey("minioadmin");
S3Lite now exposes the caller-supplied HttpClient support added in RestWrapper v3.2.0. Use this when you already manage HttpClient instances through dependency injection, need a custom handler pipeline, or want to centralize transport settings.
using System;
using System.Net.Http;
using S3Lite;
HttpClient httpClient = new HttpClient();
httpClient.Timeout = TimeSpan.FromSeconds(30);
S3Client s3 = new S3Client(httpClient)
.WithRegion("us-east-1")
.WithHostname("s3.us-east-1.amazonaws.com")
.WithRequestStyle(RequestStyleEnum.PathStyle)
.WithAccessKey("AKIAIOSFODNN7EXAMPLE")
.WithSecretKey("wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY");
bool exists = await s3.Bucket.ExistsAsync("my-bucket");
You can also attach one fluently:
S3Client s3 = new S3Client()
.WithHttpClient(httpClient)
.WithRegion("us-east-1");
Notes:
HttpClientHttpClientHttpClient or its handlerListAllMyBucketsResult buckets = await s3.Service.ListBucketsAsync();
bool exists = await s3.Bucket.ExistsAsync("my-bucket");
await s3.Bucket.WriteAsync("my-bucket", "us-west-1");
ListBucketResult objects = await s3.Bucket.ListAsync("my-bucket");
ListBucketResult filtered = await s3.Bucket.ListAsync("my-bucket", prefix: "images/");
ListBucketResult page = await s3.Bucket.ListAsync("my-bucket", continuationToken: "token-value", maxKeys: 100);
await s3.Bucket.DeleteAsync("my-bucket");
await s3.Object.WriteAsync("my-bucket", "notes/hello.txt", Encoding.UTF8.GetBytes("hello"));
bool exists = await s3.Object.ExistsAsync("my-bucket", "notes/hello.txt");
ObjectMetadata metadata = await s3.Object.GetMetadataAsync("my-bucket", "notes/hello.txt");
byte[] data = await s3.Object.GetAsync("my-bucket", "notes/hello.txt");
await s3.Object.DeleteAsync("my-bucket", "notes/hello.txt");
The right hostname depends on the request style you choose:
| Request Style | Typical Hostname | Example URL |
|---|---|---|
VirtualHostedStyle |
amazonaws.com |
https://mybucket.s3.us-west-1.amazonaws.com/mykey |
PathStyle |
s3.us-west-1.amazonaws.com |
https://s3.us-west-1.amazonaws.com/mybucket/mykey |
For S3-compatible platforms such as Less3, MinIO, or LocalStack, point Hostname and Port at your service endpoint and usually prefer PathStyle.
| Property | Description |
|---|---|
AccessKey |
Access key, or null for anonymous mode |
SecretKey |
Secret key, or null for anonymous mode |
HasCredentials |
True when both access key and secret key are configured |
Region |
Region used in request signing and URL construction |
Hostname |
Endpoint hostname |
Port |
Endpoint port |
Protocol |
Http or Https |
RequestStyle |
VirtualHostedStyle or PathStyle |
SignatureVersion |
Signature version used by the client |
HttpClient |
Optional caller-supplied HttpClient instance |
Logger |
Optional request logger callback |
S3Lite throws WebException for failed requests and includes useful context in the exception Data collection, including:
StatusCodeURLRequestBodyResponseBodyRequestId, VersionId, Resource, and ErrorCode when availableThe repository now uses Touchstone so the same shared descriptors can run through multiple hosts:
src/Test.Shared: shared Touchstone descriptors and test configurationsrc/Test.Automated: console runner using Touchstone.Clisrc/Test.Xunit: xUnit adapter hostsrc/Test.Nunit: NUnit adapter hostdotnet run --framework net8.0 --project src/Test.Automated -- -b my-bucket -a ACCESS_KEY -s SECRET_KEY
Optional arguments:
--endpoint <host>--port <port>--region <region>--http--https--path-style--virtual-hosted--verbose--skip-cleanup--skip-write-tests--results <path>dotnet test src/Test.Xunit/Test.Xunit.csproj
dotnet test src/Test.Nunit/Test.Nunit.csproj
These runners read the same configuration from environment variables:
S3LITE_TEST_ENDPOINTS3LITE_TEST_PORTS3LITE_TEST_REGIONS3LITE_TEST_ACCESS_KEYS3LITE_TEST_SECRET_KEYS3LITE_TEST_BUCKETS3LITE_TEST_PROTOCOLS3LITE_TEST_REQUEST_STYLES3LITE_TEST_VERBOSES3LITE_TEST_SKIP_CLEANUPS3LITE_TEST_SKIP_WRITE_TESTSsrc/Test.S3: interactive AWS S3 examplesrc/Test.S3Compatible: interactive S3-compatible examplesrc/Test.Script: script-style object hierarchy walkthroughsrc/Test.LargeEnumeration: large-listing exerciseEncounter an issue or have an enhancement request? Please open an issue or start a discussion in the repository.
See for release details.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 net5.0 was computed. net5.0-windows net5.0-windows was computed. net6.0 net6.0 was computed. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 is compatible. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 netcoreapp2.0 was computed. netcoreapp2.1 netcoreapp2.1 was computed. netcoreapp2.2 netcoreapp2.2 was computed. netcoreapp3.0 netcoreapp3.0 was computed. netcoreapp3.1 netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 netstandard2.0 is compatible. netstandard2.1 netstandard2.1 is compatible. |
| .NET Framework | net461 net461 was computed. net462 net462 was computed. net463 net463 was computed. net47 net47 was computed. net471 net471 was computed. net472 net472 was computed. net48 net48 was computed. net481 net481 was computed. |
| MonoAndroid | monoandroid monoandroid was computed. |
| MonoMac | monomac monomac was computed. |
| MonoTouch | monotouch monotouch was computed. |
| Tizen | tizen40 tizen40 was computed. tizen60 tizen60 was computed. |
| Xamarin.iOS | xamarinios xamarinios was computed. |
| Xamarin.Mac | xamarinmac xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos xamarinwatchos was computed. |
Showing the top 1 NuGet packages that depend on S3Lite:
| Package | Downloads |
|---|---|
|
Blobject.AmazonS3Lite
BLOB storage client for Amazon S3 (including compatible storage e.g. Minio, Less3, Ceph, View) using a lightweight, non-AWS SDK. Refer to other Blobject packages for other storage repository types. |
This package is not used by any popular GitHub repositories.
Caller-supplied HttpClient support, RestWrapper 3.2.0, and Touchstone-based automated test runners.