Acontplus.S3Application
1.1.6
dotnet add package Acontplus.S3Application --version 1.1.6
NuGet\Install-Package Acontplus.S3Application -Version 1.1.6
<PackageReference Include="Acontplus.S3Application" Version="1.1.6" />
<PackageVersion Include="Acontplus.S3Application" Version="1.1.6" />
<PackageReference Include="Acontplus.S3Application" />
paket add Acontplus.S3Application --version 1.1.6
#r "nuget: Acontplus.S3Application, 1.1.6"
#:package Acontplus.S3Application@1.1.6
#addin nuget:?package=Acontplus.S3Application&version=1.1.6
#tool nuget:?package=Acontplus.S3Application&version=1.1.6
Acontplus.S3Application
A modern .NET 9+ library providing a simple, robust, and strongly-typed interface for AWS S3 storage operations. Includes async CRUD, presigned URLs, and enterprise-grade error handling.
📑 Table of Contents
- Features
- Installation
- Quick Start
- Advanced Usage
- Configuration
- Dependencies
- Error Handling
- Contributing
- License
- Author
- Company
🚀 Features
- Async S3 CRUD: Upload, update, delete, and retrieve S3 objects asynchronously
- Presigned URLs: Generate secure, time-limited download links
- Strong Typing: Models for S3 objects, credentials, and responses
- Enterprise Error Handling: Consistent, metadata-rich responses
- Modern .NET 9+: Nullable, required properties, and latest C# features
- Easy Integration: Designed for DI and configuration-first usage
📦 Installation
NuGet Package Manager
Install-Package Acontplus.S3Application
.NET CLI
dotnet add package Acontplus.S3Application
PackageReference
<PackageReference Include="Acontplus.S3Application" Version="1.0.4" />
🎯 Quick Start
1. Register the Service
services.AddScoped<IS3StorageService, S3StorageService>();
2. Configure appsettings.json
{
"S3Bucket": {
"Name": "your-bucket-name",
"Region": "your-region"
},
"AwsConfiguration": {
"AWSAccessKey": "your-access-key",
"AWSSecretKey": "your-secret-key"
}
}
3. Basic Usage Example
public class MyS3Consumer
{
private readonly IS3StorageService _s3Service;
public MyS3Consumer(IS3StorageService s3Service) => _s3Service = s3Service;
public async Task UploadFileAsync(IFormFile file)
{
var config = ... // get IConfiguration from DI
var s3Object = new S3ObjectCustom(config);
await s3Object.Initialize("uploads/", file);
var response = await _s3Service.UploadAsync(s3Object);
if (response.StatusCode == 201)
{
// Success
}
}
}
🛠️ Advanced Usage
Downloading an Object
var s3Object = new S3ObjectCustom(config);
s3Object.Initialize("uploads/myfile.pdf");
var response = await _s3Service.GetObjectAsync(s3Object);
if (response.StatusCode == 200)
{
var fileBytes = response.Content;
var contentType = response.ContentType;
}
Generating a Presigned URL
var s3Object = new S3ObjectCustom(config);
s3Object.Initialize("uploads/myfile.pdf");
var urlResponse = await _s3Service.GetPresignedUrlAsync(s3Object, expirationInMinutes: 30);
var presignedUrl = urlResponse.FileName; // URL string
Checking if an Object Exists
var exists = await _s3Service.DoesObjectExistAsync(s3Object);
⚙️ Configuration
- S3Bucket:Name: Your S3 bucket name
- S3Bucket:Region: AWS region (e.g., us-east-1)
- AwsConfiguration:AWSAccessKey: AWS access key
- AwsConfiguration:AWSSecretKey: AWS secret key
All configuration is injected via IConfiguration
for seamless integration with ASP.NET Core and other .NET apps.
📚 Dependencies
🛡️ Error Handling
All service methods return an S3Response
object:
StatusCode
: HTTP-like status code (e.g., 200, 201, 404, 500)Message
: Success or error messageContent
: File bytes (for downloads)ContentType
: MIME type (for downloads)FileName
: File name or presigned URL (for presigned requests)
🤝 Contributing
Contributions are welcome! Please open an issue or submit a pull request.
📄 License
MIT License. See LICENSE for details.
👤 Author
🏢 Company
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net9.0 is compatible. 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 was computed. 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. |
-
net9.0
- AWSSDK.Core (>= 4.0.0.22)
- AWSSDK.S3 (>= 4.0.6.5)
- Microsoft.Extensions.Configuration.Abstractions (>= 9.0.8)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Enhanced with contemporary cloud storage patterns, comprehensive AWS S3 integration, async CRUD operations, presigned URL generation, bucket management, and enterprise-ready cloud file handling for cloud-native applications.