S3Lite 1.0.8
dotnet add package S3Lite --version 1.0.8
NuGet\Install-Package S3Lite -Version 1.0.8
<PackageReference Include="S3Lite" Version="1.0.8" />
<PackageVersion Include="S3Lite" Version="1.0.8" />
<PackageReference Include="S3Lite" />
paket add S3Lite --version 1.0.8
#r "nuget: S3Lite, 1.0.8"
#:package S3Lite@1.0.8
#addin nuget:?package=S3Lite&version=1.0.8
#tool nuget:?package=S3Lite&version=1.0.8
S3Lite
Simple AWS S3 client library without all of the heft and dependency drag of the official library.
Feedback and Enhancements
Encounter an issue or have an enhancement request? Please file an issue or start a discussion here!
New in v1.0.x
- Initial release
- Anonymous access support (for public buckets that don't require authentication)
Examples
Refer to the Test.S3, Test.S3Compatible, and Test.Automated projects for full examples.
Client Configuration
AWS S3 with Credentials (Virtual-Hosted Style)
using S3Lite;
using S3Lite.ApiObjects;
S3Client s3 = new S3Client()
.WithRegion("us-west-1")
.WithAccessKey("AKIAIOSFODNN7EXAMPLE")
.WithSecretKey("wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY")
.WithRequestStyle(RequestStyleEnum.VirtualHostedStyle)
.WithSignatureVersion(SignatureVersionEnum.Version4)
.WithLogger(Console.WriteLine);
// Check if credentials are configured
Console.WriteLine("Has credentials: " + s3.HasCredentials); // True
AWS S3 with Anonymous Access (Public Buckets)
For accessing public S3 buckets that don't require authentication, simply omit the access key and secret key:
using S3Lite;
using S3Lite.ApiObjects;
S3Client s3 = new S3Client()
.WithRegion("us-west-1")
.WithRequestStyle(RequestStyleEnum.VirtualHostedStyle)
.WithLogger(Console.WriteLine);
// Check if credentials are configured
Console.WriteLine("Has credentials: " + s3.HasCredentials); // False
// Access public bucket contents
ListBucketResult objects = await s3.Bucket.ListAsync("public-dataset-bucket");
S3-Compatible Storage (MinIO, LocalStack, etc.)
using S3Lite;
using S3Lite.ApiObjects;
S3Client s3 = new S3Client()
.WithRegion("us-west-1")
.WithAccessKey("minioadmin")
.WithSecretKey("minioadmin")
.WithHostname("localhost")
.WithPort(9000)
.WithProtocol(ProtocolEnum.Http)
.WithRequestStyle(RequestStyleEnum.PathStyle)
.WithLogger(Console.WriteLine);
Endpoint Configuration
The endpoint hostname varies based on the request style:
| Request Style | Default Hostname | Example URL |
|---|---|---|
| VirtualHostedStyle | amazonaws.com |
https://mybucket.s3.us-west-1.amazonaws.com/mykey |
| PathStyle | s3.<region>.amazonaws.com |
https://s3.us-west-1.amazonaws.com/mybucket/mykey |
For S3-compatible storage, use the hostname of your storage server (e.g., localhost for local development).
API Reference
Service APIs
// List all buckets (requires authentication)
ListAllMyBucketsResult buckets = await s3.Service.ListBucketsAsync();
Bucket APIs
// Check if bucket exists
bool exists = await s3.Bucket.ExistsAsync("mybucket");
// Create a bucket
await s3.Bucket.WriteAsync("mybucket", "us-west-1");
// List objects in a bucket
ListBucketResult objects = await s3.Bucket.ListAsync("mybucket");
// List objects with prefix filter
ListBucketResult filtered = await s3.Bucket.ListAsync("mybucket", prefix: "folder/");
// List with pagination (max 1000 keys per request)
ListBucketResult page1 = await s3.Bucket.ListAsync("mybucket", maxKeys: 100);
if (!string.IsNullOrEmpty(page1.NextContinuationToken))
{
ListBucketResult page2 = await s3.Bucket.ListAsync("mybucket",
continuationToken: page1.NextContinuationToken, maxKeys: 100);
}
// Delete a bucket (must be empty)
await s3.Bucket.DeleteAsync("mybucket");
Object APIs
// Write an object
await s3.Object.WriteAsync("mybucket", "mykey", Encoding.UTF8.GetBytes("Hello, world!"));
// Write with content type
await s3.Object.WriteAsync("mybucket", "mykey.json", jsonBytes, "application/json");
// Check if object exists
bool exists = await s3.Object.ExistsAsync("mybucket", "mykey");
// Get object metadata
ObjectMetadata metadata = await s3.Object.GetMetadataAsync("mybucket", "mykey");
// Read an object
byte[] data = await s3.Object.GetAsync("mybucket", "mykey");
// Delete an object
await s3.Object.DeleteAsync("mybucket", "mykey");
Method Signatures
ServiceApis
| Method | Parameters | Returns |
|---|---|---|
ListBucketsAsync |
headers, token |
ListAllMyBucketsResult |
BucketApis
| Method | Parameters | Returns |
|---|---|---|
ExistsAsync |
bucket, headers, token |
bool |
ListAsync |
bucket, prefix, marker, continuationToken, maxKeys, headers, token |
ListBucketResult |
WriteAsync |
bucket, region, headers, token |
Task |
DeleteAsync |
bucket, headers, token |
Task |
ObjectApis
| Method | Parameters | Returns |
|---|---|---|
ExistsAsync |
bucket, key, versionId, headers, token |
bool |
GetMetadataAsync |
bucket, key, versionId, headers, token |
ObjectMetadata |
GetAsync |
bucket, key, versionId, headers, token |
byte[] |
WriteAsync |
bucket, key, data, contentType, versionId, headers, token |
Task |
DeleteAsync |
bucket, key, versionId, headers, token |
Task |
S3Client Properties
| Property | Type | Description |
|---|---|---|
AccessKey |
string |
AWS access key (null for anonymous access) |
SecretKey |
string |
AWS secret key (null for anonymous access) |
HasCredentials |
bool |
True if both AccessKey and SecretKey are configured |
Region |
string |
AWS region (default: us-west-1) |
Hostname |
string |
S3 endpoint hostname (default: amazonaws.com) |
Port |
int |
Port number (default: 443) |
Protocol |
ProtocolEnum |
Http or Https (default: Https) |
RequestStyle |
RequestStyleEnum |
VirtualHostedStyle or PathStyle (default: VirtualHostedStyle) |
SignatureVersion |
SignatureVersionEnum |
Version2 or Version4 (default: Version4) |
Version History
Refer to CHANGELOG.md for details.
| 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 is compatible. 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 is compatible. |
| .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
- AWSSignatureGenerator (>= 1.0.9)
- PrettyId (>= 1.0.5)
- RestWrapper (>= 3.1.4)
-
.NETStandard 2.1
- AWSSignatureGenerator (>= 1.0.9)
- PrettyId (>= 1.0.5)
- RestWrapper (>= 3.1.4)
-
net10.0
- AWSSignatureGenerator (>= 1.0.9)
- PrettyId (>= 1.0.5)
- RestWrapper (>= 3.1.4)
-
net8.0
- AWSSignatureGenerator (>= 1.0.9)
- PrettyId (>= 1.0.5)
- RestWrapper (>= 3.1.4)
NuGet packages (1)
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. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Initial release