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
<PackageReference Include="Cloud.File.Storage.Manager.AmazonS3" Version="2.1.0" />
<PackageVersion Include="Cloud.File.Storage.Manager.AmazonS3" Version="2.1.0" />
<PackageReference Include="Cloud.File.Storage.Manager.AmazonS3" />
paket add Cloud.File.Storage.Manager.AmazonS3 --version 2.1.0
#r "nuget: Cloud.File.Storage.Manager.AmazonS3, 2.1.0"
#:package Cloud.File.Storage.Manager.AmazonS3@2.1.0
#addin nuget:?package=Cloud.File.Storage.Manager.AmazonS3&version=2.1.0
#tool nuget:?package=Cloud.File.Storage.Manager.AmazonS3&version=2.1.0
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
ListObjectsV2request for the exact key, so onlys3:ListBucketis needed;s3:GetObjectands3:ListBucketVersionsare 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
IOExceptionis thrown naming the first failure. - Delete returns
truewhen something was deleted andfalsewhen nothing existed under the path. - Moving copies the object with a single
CopyObjectrequest 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 olderReadFileAsync(versionId, absolutePathSegments)overload is obsolete and only accepts paths under the configured root. On a variable typed asAmazonS3FileStorageManager, a call likeReadFileAsync("dir", "file.txt")binds to that overload with"dir"as the version id; use theICloudFileStorageManagerinterface orReadFileVersionAsyncfor 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 | 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. 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. |
-
net8.0
- AWSSDK.S3 (>= 3.7.305.22)
- Cloud.File.Storage.Manager.Common (>= 3.1.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
- 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