Yaver.ObjectStorage
1.0.0
dotnet add package Yaver.ObjectStorage --version 1.0.0
NuGet\Install-Package Yaver.ObjectStorage -Version 1.0.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Yaver.ObjectStorage" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Yaver.ObjectStorage" Version="1.0.0" />
<PackageReference Include="Yaver.ObjectStorage" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Yaver.ObjectStorage --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Yaver.ObjectStorage, 1.0.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#addin nuget:?package=Yaver.ObjectStorage&version=1.0.0
#tool nuget:?package=Yaver.ObjectStorage&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Yaver.ObjectStorage
A .NET library for managing object storage operations with Cloudflare R2 and image processing capabilities.
Features
Object Storage Integration
- Public and private storage support
- File upload/download operations
- Directory listing
- File existence checks
- File deletion
Image Processing
- Automatic image optimization
- WebP conversion
- Multiple variant generation
- Thumbnail creation
- Image format detection
Built-in Integrations
- Cloudflare R2 Storage
- ASP.NET Core support
- Dependency Injection
- Swagger/OpenAPI documentation
Installation
dotnet add package Yaver.ObjectStorage
Configuration
Add storage configuration to your
appsettings.json
:
{
"PUBLIC_OBJECT_STORAGE": {
"ACCESS_KEY": "your-access-key",
"SECRET_KEY": "your-secret-key",
"BUCKET_NAME": "your-bucket",
"ENDPOINT": "your-r2-endpoint"
},
"PRIVATE_OBJECT_STORAGE": {
"ACCESS_KEY": "your-access-key",
"SECRET_KEY": "your-secret-key",
"BUCKET_NAME": "your-bucket",
"ENDPOINT": "your-r2-endpoint"
}
}
Usage
Service Registration
builder.Services.AddObjectStorages(builder.Configuration);
Basic File Operations
public class StorageService
{
private readonly IS3Client _client;
public StorageService(IS3ClientFactory factory)
{
_client = factory.CreateClient("public"); // or "private"
}
public async Task UploadFileAsync(IFormFile file, string key)
{
await _client.PutFileAsync(file, key);
}
public async Task<Stream> DownloadFileAsync(string fileName)
{
return await _client.GetFileStreamAsync(fileName);
}
}
Image Processing
// Upload with image variants
await _client.PutImageWithVariantsAsync(
file,
key: "images/profile",
variants: new[] {
new ImageVariant("thumbnail", Width: 150, Height: 150),
new ImageVariant("medium", Width: 800),
new ImageVariant("large", Width: 1200)
}
);
Sample API
The solution includes a sample API project demonstrating:
- File upload endpoints
- Image processing
- Public/Private storage configuration
- Swagger integration
Run the sample:
cd sample/Sample.Api
dotnet run
License
This project is licensed under the MIT License.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net8.0
- AWSSDK.S3 (>= 3.7.405.11)
- Microsoft.AspNetCore.Http (>= 2.2.2)
- Microsoft.Extensions.DependencyInjection (>= 8.0.1)
- Microsoft.Extensions.Http (>= 8.0.1)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 8.0.0)
- SixLabors.ImageSharp (>= 3.1.5)
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 | 216 | a month ago |