![]() |
VOOZH | about |
dotnet add package Empezar.Cloud --version 2.2.21
NuGet\Install-Package Empezar.Cloud -Version 2.2.21
<PackageReference Include="Empezar.Cloud" Version="2.2.21" />
<PackageVersion Include="Empezar.Cloud" Version="2.2.21" />Directory.Packages.props
<PackageReference Include="Empezar.Cloud" />Project file
paket add Empezar.Cloud --version 2.2.21
#r "nuget: Empezar.Cloud, 2.2.21"
#:package Empezar.Cloud@2.2.21
#addin nuget:?package=Empezar.Cloud&version=2.2.21Install as a Cake Addin
#tool nuget:?package=Empezar.Cloud&version=2.2.21Install as a Cake Tool
Cloud service encapsulating AWS, GCP & Azure for your application to be truly Cloud agnostic.
Install the nuget package for Empezar.Cloud in your API Project.
You can also use Manager Nuget Packages to install the same.
dotnet add package Empezar.Cloud
Register the cloud service in Program.cs of API project
builder.Services.RegisterCloudService(builder.Configuration["EZRBlazorWebAPI:Cloud:Type"]!,
builder.Configuration["EZRBlazorWebAPI:Cloud:BucketName"]!,
builder.Configuration.GetSection("EZRBlazorWebAPI:Cloud:AllowedFileTypes").Get<string[]>()!.ToImmutableHashSet(StringComparer.InvariantCultureIgnoreCase),
builder.Configuration["EZRBlazorWebAPI:Cloud:AzureBlobConnection"]);
Configurations can be done in appSettings.config or environment valriables as shown below
Valid Type = AWS/GCP/Azure/DEV
"EZRBlazorWebAPI": {
"Cloud": {
"Type": "AWS",
"BucketName": "YourBucketName",
"AllowedFileTypes": [ "docx", "xlsx", "csv", "pdf", "jpeg", "jpg", "png", "zip" ]
}
}
OR
export EZRBlazorWebAPI__Cloud__Type="AWS"
export EZRBlazorWebAPI__Cloud__AzureBlobConnection="YourConnectionString"
You can now inject ICloudService cloudService in your class or method.
async (CloudFile uploadDoc, [FromHeader(Name = BaseHeaderConstants.XSource)] string source,
ICloudService cloudService, CancellationToken token) =>
{
if (uploadDoc.file == null) return Results.BadRequest(new ProblemDetails { Detail = "File not found" });
else
{
var fileExtn = Empezar.Cloud.Program.GetFileExtention(uploadDoc.file);
if (fileExtn == null) return Results.BadRequest(new ProblemDetails { Detail = "Unsupported file type" });
if (uploadValidator.Invoke(caller, source, fileExtn, uploadDoc.file.Length / (1024.0 * 1024.0)))
return Results.Ok(await cloudService.UploadDocument(uploadDoc.file, uploadDoc.contenttype, token));
else
return Results.BadRequest(new ProblemDetails { Detail = "Unsupported file type or size exceeds the limit" });
}
}
static bool UploadValidator(ClaimsPrincipal caller, string source, string extention, double size)
{
var roles = caller.FindAll(ClaimTypes.Role).Select(x => x.Value);
bool isValid = false;
switch (source)
{
case "source1":
IEnumerable<string> source1FileTypes = FileTypes.GetFileTypes<FileTypes.DocTypes>();
isValid = (roles.Contains("admin") && source1FileTypes.Contains(extention, StringComparer.InvariantCultureIgnoreCase) && size <= 5);
break;
case "source2":
IEnumerable<string> source2FileTypes = FileTypes.GetFileTypes<FileTypes.ImageTypes>();
isValid = (source2FileTypes.Contains(extention, StringComparer.InvariantCultureIgnoreCase) && size <= 1);
break;
}
return isValid;
}
To Download or Delete file, you can use
async (string key, ICloudService cloudService, CancellationToken token) =>
await cloudService.DownloadDocument(Uri.UnescapeDataString(key), token)
async (string key, ICloudService cloudService, CancellationToken token) =>
await cloudService.DeleteDocument(Uri.UnescapeDataString(key), token)
The service implements MimeDetective package which will provide easy extention methods on your byte[] to validate MIME Type and File Extentions using magic bytes.
//Gets actual MIME Type
uploadDoc.file.GetMimeType()
//Gets actual File Extention
uploadDoc.file.GetFileExtention()
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 net10.0 is compatible. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
Showing the top 2 NuGet packages that depend on Empezar.Cloud:
| Package | Downloads |
|---|---|
|
Empezar.API
Package Description |
|
|
Empezar.BlazorWebAPI
Package Description |
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 2.2.21 | 100 | 6/5/2026 |
| 2.2.20 | 106 | 6/5/2026 |
| 2.2.19 | 123 | 5/18/2026 |
| 2.2.18 | 373 | 4/29/2026 |
| 2.2.17 | 116 | 4/22/2026 |
| 2.2.16 | 177 | 4/13/2026 |
| 2.2.15 | 136 | 4/7/2026 |
| 2.2.14 | 178 | 3/27/2026 |
| 2.2.13 | 134 | 3/27/2026 |
| 2.2.12 | 119 | 3/26/2026 |
| 2.2.11 | 116 | 3/26/2026 |
| 2.2.10 | 231 | 3/9/2026 |
| 2.2.9 | 126 | 3/9/2026 |
| 2.2.8 | 257 | 2/24/2026 |
| 2.2.7 | 182 | 2/12/2026 |
| 2.2.6 | 136 | 2/12/2026 |
| 2.2.5 | 138 | 2/11/2026 |
| 2.2.4 | 144 | 2/10/2026 |
| 2.2.3 | 134 | 2/5/2026 |
| 2.2.2 | 160 | 2/3/2026 |