Cloud.File.Storage.Manager.AmazonS3 2.1.0

dotnet add package Cloud.File.Storage.Manager.AmazonS3 --version 2.1.0
                    
NuGet\Install-Package Cloud.File.Storage.Manager.AmazonS3 -Version 2.1.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="Cloud.File.Storage.Manager.AmazonS3" Version="2.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Cloud.File.Storage.Manager.AmazonS3" Version="2.1.0" />
                    
Directory.Packages.props
<PackageReference Include="Cloud.File.Storage.Manager.AmazonS3" />
                    
Project file
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 Cloud.File.Storage.Manager.AmazonS3 --version 2.1.0
                    
#r "nuget: Cloud.File.Storage.Manager.AmazonS3, 2.1.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.
#:package Cloud.File.Storage.Manager.AmazonS3@2.1.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Cloud.File.Storage.Manager.AmazonS3&version=2.1.0
                    
Install as a Cake Addin
#tool nuget:?package=Cloud.File.Storage.Manager.AmazonS3&version=2.1.0
                    
Install as a Cake Tool

Cloud File Storage Manager

Provides complete implementation to handle easily cloud file storage operations like get informations about files, reading, downloadURL generation, file update, file move and delete. Primarily for Amazon S3 right now.

Configuration

Let's add a section to the appsettings.json

"AmazonS3torageSettings": {
    "IsAnonymus": false,
    "AccessKey": "",
    "SecretKey": "",
    "BucketName": "",
    "BucketRegion": ""
}

In the application, configure this settings part

services.AddSingleton<ICloudFileStorageManager, AmazonS3FileStorageManager>(services => new AmazonS3FileStorageManager(new AmazonS3FileStorageManagerOptions()
{
    IsAnonymus = config.GetSection("AmazonS3torageSettings").GetValue<bool>("IsAnonymus"),
    AccessKey = config.GetSection("AmazonS3torageSettings").GetValue<string>("AccessKey"),
    SecretKey = config.GetSection("AmazonS3torageSettings").GetValue<string>("SecretKey"),
    BucketName = config.GetSection("AmazonS3torageSettings").GetValue<string>("BucketName"),
    BucketRegion = config.GetSection("AmazonS3torageSettings").GetValue<string>("BucketRegion")
}));  

Behaviour

  • Directory listings return one level: the files directly in the folder plus its sub-folders (from the S3 common prefixes). Folder marker keys ending with / are not listed as files.
  • File info is resolved with a single ListObjectsV2 request for the exact key, so only s3:ListBucket is needed; s3:GetObject and s3:ListBucketVersions are not required for it.
  • Deleting a folder removes every key under its prefix in pages of up to 1000 keys. If S3 reports any failed key, an IOException is thrown naming the first failure.
  • Delete returns true when something was deleted and false when nothing existed under the path.
  • Moving copies the object with a single CopyObject request and then deletes the original; S3 limits this to objects of at most 5 GB.
  • Use ReadFileVersionAsync(versionId, pathSegments) to read a specific object version with root-relative path segments; a null or empty version id reads the current version. The older ReadFileAsync(versionId, absolutePathSegments) overload is obsolete and only accepts paths under the configured root. On a variable typed as AmazonS3FileStorageManager, a call like ReadFileAsync("dir", "file.txt") binds to that overload with "dir" as the version id; use the ICloudFileStorageManager interface or ReadFileVersionAsync for plain reads.
  • Request presigned download URLs for at most 7 days, the S3 limit for signature version 4. The validity is not capped by the library: for a longer validity the AWS SDK falls back to a legacy signature version 2 URL, which buckets and regions without signature version 2 support reject.
  • Path segments . and .. are rejected.
  • The configured root directory itself cannot be deleted, moved or overwritten.
Product 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.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
2.1.0 66 10/10/2026
2.0.0 372 2/5/2024
1.0.0 328 5/20/2023

- Exact file info via a single listing, no GetObject or ListVersions permission needed
- One-level folder listings with folder prefixes
- Folder deletes in pages of 1000 keys, failed keys raise an IOException
- Delete returns false when nothing was found, provider root protected against delete, move and overwrite
- ReadFileVersionAsync for versioned reads with root-relative paths, ReadFileAsync(versionId, ...) obsolete and kept under the root
- Update Cloud.File.Storage.Manager.Common 3.0.0 -> 3.1.0