Evospike.AzureStorage
1.0.8
dotnet add package Evospike.AzureStorage --version 1.0.8
NuGet\Install-Package Evospike.AzureStorage -Version 1.0.8
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="Evospike.AzureStorage" Version="1.0.8" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Evospike.AzureStorage --version 1.0.8
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Evospike.AzureStorage, 1.0.8"
#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.
// Install Evospike.AzureStorage as a Cake Addin #addin nuget:?package=Evospike.AzureStorage&version=1.0.8 // Install Evospike.AzureStorage as a Cake Tool #tool nuget:?package=Evospike.AzureStorage&version=1.0.8
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Evospike.AzureStorage
This package is designed to use azure blob storage in a very simple way.
Allows you to configure AzureStorage in a very simple way
appsettings.json
configuration
The file path and other settings can be read from JSON configuration if desired.
In appsettings.json
add a "AzureStorageSetting"
properties:
{
"AzureStorageSetting": {
"StorageConnectionString": "{YourConnectionString}",
"AccountName": "{YourAccountName}"
}
}
And then pass the configuration section to the next methods:
services.AddAzureStorageClient(Configuration);
Example of a controller using dependency injection services
public class ItemsController : ControllerBase
{
private readonly IStorageService _storageService;
public ItemsController(IStorageService storageService)
{
_storageService = storageService;
}
public async Task<IActionResult> UploadFile(IFormFile file)
{
var responseUrl = await _storageService.SaveBlobAsync("ContainerName", file);
return Redirect(responseUrl);
}
public async Task<IActionResult> UploadFile(string blobPath, Stream file)
{
var responseUrl = await _storageService.SaveBlobAsync("ContainerName", blobPath, file);
return Redirect(responseUrl);
}
public IActionResult ViewFile(string filePath)
{
var responseUrl = _storageService.GetProtectedUrl("ContainerName", filePath, DateTimeOffset.UtcNow.AddSeconds(10));
return Redirect(responseUrl);
}
public async Task<IActionResult> DeleteFile(string filePath)
{
await _storageService.RemoveBlobAsync("ContainerName", filePath);
return View();
}
}
Additional methods
_storageService.CreateContainerAsync("ContainerName");
_storageService.RemoveContainerAsync("ContainerName");
_storageService.GetContainerSize("ContainerName");
_storageService.DownloadBlobAsync("ContainerName", "blobPath");
_storageService.GetBlobProperties("ContainerName", "blobPath");
_storageService.ExistBlobAsync("ContainerName", "blobPath");
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 is compatible. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net5.0
- Azure.Storage.Blobs (>= 12.9.1)
- Microsoft.AspNetCore.Http (>= 2.2.2)
- Microsoft.Extensions.Configuration (>= 5.0.0)
- Microsoft.Extensions.Configuration.Binder (>= 5.0.0)
- Microsoft.Extensions.DependencyInjection (>= 5.0.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.