SmooAI.File.S3 2.2.4

dotnet add package SmooAI.File.S3 --version 2.2.4
                    
NuGet\Install-Package SmooAI.File.S3 -Version 2.2.4
                    
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="SmooAI.File.S3" Version="2.2.4" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SmooAI.File.S3" Version="2.2.4" />
                    
Directory.Packages.props
<PackageReference Include="SmooAI.File.S3" />
                    
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 SmooAI.File.S3 --version 2.2.4
                    
#r "nuget: SmooAI.File.S3, 2.2.4"
                    
#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 SmooAI.File.S3@2.2.4
                    
#: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=SmooAI.File.S3&version=2.2.4
                    
Install as a Cake Addin
#tool nuget:?package=SmooAI.File.S3&version=2.2.4
                    
Install as a Cake Tool

SmooAI.File.S3

S3 upload, download, and presigned-URL helpers for SmooAI.File — typed, cancellable, and still magic-byte-safe.

Companion package to SmooAI.File. Split on purpose — apps that only need local MIME detection and validation don't pay the AWSSDK.S3 install cost.

Install

dotnet add package SmooAI.File.S3

(Also brings in SmooAI.File.)

Quick start

using Amazon.S3;
using SmooAI.File;
using SmooAI.File.S3;

var s3 = new AmazonS3Client();

// Load an S3 object as a SmooFile — magic-byte MIME detection still applies
var file = await S3SmooFile.CreateFromS3Async(s3, "my-bucket", "uploads/foo.bin");
file.Validate(allowedMimes: new[] { "image/png", "image/jpeg", "application/pdf" });

// Upload a SmooFile to S3
await file.UploadToS3Async(s3, "my-bucket", "destination/key");

// Save an S3 object directly to a local path
await S3SmooFile.SaveFromS3ToFileAsync(s3, "my-bucket", "uploads/foo.bin", "/tmp/foo.bin");

Presigned uploads

Let the browser PUT directly to S3 — your API never touches the bytes:

var uploadUrl = await S3SmooFile.CreatePresignedUploadUrlAsync(s3, new()
{
    Bucket      = "my-bucket",
    Key         = $"avatars/{userId}.png",
    ContentType = "image/png",
    ExpiresIn   = TimeSpan.FromMinutes(10),
    MaxSize     = 2 * 1024 * 1024,   // enforced by signed policy
});

// Return uploadUrl to the client; they PUT the file straight to S3.

After the client uploads, pull it back through SmooFile to magic-byte-verify the content before using it:

var uploaded = await S3SmooFile.CreateFromS3Async(s3, "my-bucket", $"avatars/{userId}.png");
uploaded.Validate(
    maxSize:          2 * 1024 * 1024,
    allowedMimes:     new[] { "image/png", "image/jpeg" },
    expectedMimeType: "image/png");

License

MIT — © SmooAI

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 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 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. 
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.2.4 95 4/24/2026