Talrace.Core.Storage 8.0.0

dotnet add package Talrace.Core.Storage --version 8.0.0
NuGet\Install-Package Talrace.Core.Storage -Version 8.0.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="Talrace.Core.Storage" Version="8.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Talrace.Core.Storage --version 8.0.0
#r "nuget: Talrace.Core.Storage, 8.0.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.
// Install Talrace.Core.Storage as a Cake Addin
#addin nuget:?package=Talrace.Core.Storage&version=8.0.0

// Install Talrace.Core.Storage as a Cake Tool
#tool nuget:?package=Talrace.Core.Storage&version=8.0.0

About

This package provides an API for working with file storages: Azure File Storage, Amazon S3, Google Cloud Storage, local storage.

Available api

IFileStorage - interface provides a set of methods for working with file storage.
UriExtensions - static class provides a set of Uri class extension methods for working with IFileStorage. Extension methods provide a wrapper around the IFileStorage functionality.
IAppPaths - interface provides functionality to get application paths for working with different file folders: "thumbs", "temp", "content".
IDateAdapter<T> - interface provides functionality to get current time with different types.
IFileHandler - interface provides a set of methods for file processing: saving and deleting files, getting relative, original and temporary file paths.
IUploadService<T, U, V> - interface provides functionality for uploading files. T is a class that inherits from IPostFile; U is a class that inherits from IFileInfo<V>. V is a type of Create Time.

Storage configuration (appsettings.json, environment variables, etc.)

Azure storage

{
  "StorageConfiguration": {
    "FilesPath": "<FilesPath>",
    "AzureConnectionString": "<AzureConnectionString>"
  }
}

Google storage

{
  "StorageConfiguration": {
    "FilesPath": "<FilesPath>",
    "FileEndpoint": "<FileEndpoint>",
    "GoogleKey": {
      "type": "<Type>",
      "project_id": "<ProjectId>",
      "private_key_id": "<PrivateKeyId>",
      "private_key": "<PrivateKey>",
      "client_email": "<ClientEmail>",
      "client_id": "<ClientId>",
      "auth_uri": "<AuthUri>",
      "token_uri": "<TokenUri>",
      "auth_provider_x509_cert_url": "<AuthProvider>",
      "client_x509_cert_url": "<ClientUrl>"
    }
  }
}

Amazon S3

{
  "StorageConfiguration": {
    "FilesPath": "<FilesPath>",
    "AssessKeyId": "<AssessKeyId>",
    "AssessKeySecret": "<AssessKeySecret>",
    "Bucket": "<Bucket>",
    "Region": "<AWS Region>"
  }
}

Storage injection

Azure storage

public void ConfigureServices(IServiceCollection services) {
    var storageConfiguration = Configuration.GetSection("StorageConfiguration");
    services.AddAzureStorage(storageConfiguration);
}

Google storage

public void ConfigureServices(IServiceCollection services) {
    var storageConfiguration = Configuration.GetSection("StorageConfiguration");
    services.AddGoogleStorage(storageConfiguration);
}

Amazon S3

public void ConfigureServices(IServiceCollection services) {
    var storageConfiguration = Configuration.GetSection("StorageConfiguration");
    services.AddAwsS3Storage(storageConfiguration);
}

Local storage

public void ConfigureServices(IServiceCollection services) {
    services.AddLocalStorage();
}

Core services

To use IAppPaths, IFileHandler and IUploadService<T, U, V>, you need to add these services to the dependency container by calling the AddCoreStorage method. Also you need to provide singleton implementation of IDateAdapter<V> or use long or DateTime implementation. Also you need to add IFileStorage to dependency container. Also you can provide override of upload service

{
  "StorageConfiguration": {
    "FilesPath": "<FilesPath>"
  }
}

Use unix create time

public void ConfigureServices(IServiceCollection services) {
    var storageConfiguration = Configuration.GetSection("StorageConfiguration");
    services.AddCoreStorage<long>(storageConfiguration);
    // TODO: provide storage.
    // For example: services.AddLocalStorage();
}
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. 
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
8.0.0 607 11/30/2023
6.0.16 1,337 6/6/2023
6.0.15 385 4/21/2023
6.0.14 1,044 4/12/2023
6.0.13 188 3/28/2023
6.0.12 1,616 2/24/2023
6.0.11 223 2/24/2023
6.0.10 1,695 2/23/2023
6.0.9 466 2/22/2023
6.0.8 215 2/22/2023
6.0.7 227 2/21/2023
6.0.6 229 2/20/2023
6.0.5 225 2/15/2023
6.0.4 248 2/2/2023
6.0.3 294 1/30/2023
6.0.2 242 1/27/2023
6.0.1 1,676 5/5/2022
6.0.0 400 4/28/2022
3.1.19 298 9/24/2021
3.1.10 3,595 4/28/2021