DevelopmentHelpers.Storage.Core 10.0.1

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

DevelopmentHelpers.Storage.Core

A small library to simplify working with Azure Blob Storage, Azure FileShare, and local filesystem directories. It provides an easy-to-use API for uploading, downloading and syncing entire directory structures and individual files. The library supports both local and Azure storage implementations and integrates with dependency injection.

Key features

  • Unified IStorage interface with implementations for Azure Blob Storage and local filesystem.
  • Azure FileShare support via IAzureFileStorage implementation.
  • Upload/download entire directories and containers.
  • Upload large files in chunks (resumable/large-file friendly).
  • Container synchronization helpers (container-to-container and directory-to-container).
  • Create ZIP archives from containers.
  • Easy configuration using appsettings.json and dependency injection.

Prerequisites

  • .NET 10
  • Azure Storage account (when using Azure implementations)

Quick start

  1. Add the project or NuGet package to your solution.
  2. Configure storage settings in appsettings.json (example below).
  3. Register services in Program.cs / Startup.cs.
  4. Inject IStorage or IAzureFileStorage where needed and call methods.

Configuration (appsettings.json)

Keep the following structure in your appsettings.json under a DevelopmentHelpers section. The values shown are examples — replace them with your account details.

"DevelopmentHelpers": {
  "AzureConfiguration": {
    "AccountName": "Account-Name",
    "AccountKey": "Account-Key",
    "UseHttps": "True"
  },
  "AzureFileStorageConfiguration": {
    "ConnectionString": "Connection-String",
    "ShareName": "Share-Name"
  }
}

Registering services (dependency injection)

In Program.cs or Startup.cs register the library services so you can resolve IStorage and IAzureFileStorage from DI. The library exposes an extension method to register required services.

// in Program.cs
services.AddAzureStorage(Configuration);

Note: AddAzureStorage reads the DevelopmentHelpers section from configuration and registers the appropriate implementations.

Basic usage examples

Create storage instances (examples)

// Using DI (recommended)
public class MyService
{
    private readonly IStorage _storage;
    private readonly IAzureFileStorage _fileStorage;
    public MyService(IStorage storage, IAzureFileStorage fileStorage)
    {
        _storage = storage;
        _fileStorage = fileStorage;
    }
}

// Or instantiate manually for quick testing
var azureConfig = new Models.AzureConfiguration
{
    AccountName = "...",
    AccountKey = "...",
    UseHttps = true
};
var logger = ConfigHelper.Instance.LoggerFactory.CreateLogger<AzureStorage>();
IStorage storage = new AzureStorage(azureConfig, logger);
IStorage localStorage = new FileSystemStorage(azureConfig /* or local config */, logger);
IAzureFileStorage fileStorage = new AzureFileStorage(/* AzureFileStorageConfiguration */, logger);

Uploading and downloading

// Upload a single file
var fileInfo = new FileInfo("/path/to/file.txt");
var blobUrl = await _storage.UploadFileAsync(fileInfo, MimeTypes.txt, "my-container");

// Upload a Directory
await _storage.UploadDirectoryAsync(new DirectoryInfo("/path/to/folder"), "my-container");

// Download a file (by blob URL)
var downloaded = await _storage.DownloadToFileAsync(blobUrl, "/local/download/path");

// Download entire container to local folder
await _storage.DownloadContainer("my-container", "/local/download/path");

// Create a zip from a container
var zipPath = await _storage.CreateZipFromContainerAsync("my-container", "/tmp", "archive.zip");

Chunked uploads (large files)

// Upload large file in chunks
var uri = await _storage.UploadInChunks(fullFilePath, "container-name", "file-name.txt", MimeTypes.txt);

Checking blobs and containers

// Check existence
bool exists = await _storage.BlobExistsAsync(blobUrl);

// Create a container if not exists
var response = await _storage.CreateContainerAsync("container-name", publicAccess: false);

// List containers
var containers = await _storage.GetContainersAsync();

Sync helpers

The library includes helpers for synchronizing between containers or from a directory to a container.

// Container to container sync
var syncHelper = new ContainerToContainerSyncHelper(sourceStorage, targetStorage);
var (success, message) = await syncHelper.SyncContainersAsync("source", "target", deleteExtraFiles: false, localTempPath: "/tmp");

// Directory to container sync helper
var directorySyncHelper = new DirectoryToContainerSyncHelper(storage);
var result = await directorySyncHelper.GetBlobUrlListExistInTargetButNotInSourceAsync(sourceDirectoryPath, "target-container");

Tips and best practices

  • Use UploadInChunks for large files to avoid memory issues.
  • Keep container names lowercase when interacting with Azure Blob Storage.
  • When uploading directories with nested folders, use consistent path separators (/) for blob names.
  • Clean up temporary local directories after operations to avoid consuming disk space.

Testing

The DevelopmentHelpers.Storage.Core.Tests project includes a comprehensive set of integration tests that exercise common flows such as uploading/downloading files, chunked uploads, container sync and zip creation. The tests expect an Azure Storage account configured via ConfigHelper in test settings. You can inspect the test project for sample usage patterns.

Contributing

Contributions and issues are welcome. Please open an issue describing the problem or the feature request and submit pull requests for fixes.

License

Include your license information here (e.g., MIT) or a note about internal use.

If you need a targeted example or the exact code snippet for a specific scenario, describe the scenario and I will add a short sample.

Product Compatible and additional computed target framework versions.
.NET 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
10.0.1 71 12/16/2025
10.0.0 195 12/3/2025
9.0.8 169 9/26/2025
9.0.6 270 8/27/2025
9.0.5 267 8/8/2025
9.0.4 293 5/20/2025
9.0.3 325 5/13/2025
9.0.2 234 4/22/2025
9.0.1 234 4/6/2025
9.0.0 295 11/20/2024
7.0.19 198 11/14/2024
7.0.18 438 10/11/2024
7.0.17 191 10/9/2024
7.0.16 204 9/30/2024
7.0.15 282 8/13/2024
7.0.14 215 8/2/2024
7.0.11 197 5/31/2024
7.0.10 199 5/23/2024
7.0.9 186 5/23/2024
7.0.8 359 4/10/2024
7.0.7 396 2/16/2024
7.0.6 217 2/7/2024
7.0.5 193 1/29/2024
7.0.4 206 1/16/2024
7.0.3 233 12/26/2023
7.0.2 229 12/15/2023
7.0.1 203 12/15/2023
7.0.0 253 11/14/2023
6.0.5 253 10/23/2023
6.0.4 329 8/2/2023
6.0.3 225 7/27/2023
6.0.2 246 7/11/2023
6.0.1 250 6/22/2023
6.0.0 283 5/4/2023
5.0.3 307 4/27/2023
5.0.2 332 4/11/2023
5.0.1 377 2/22/2023
5.0.0 502 11/10/2022
4.0.11 455 11/10/2022
4.0.10 446 11/10/2022
4.0.9 574 9/6/2022
4.0.8 627 7/25/2022
4.0.7 561 7/25/2022
4.0.6 564 7/25/2022
4.0.5 594 7/14/2022
4.0.4 251 7/14/2022
4.0.3 691 3/24/2022
4.0.2 325 12/16/2021
4.0.1 285 12/16/2021
4.0.0 1,029 11/29/2021
3.0.3 762 10/15/2020
3.0.2 636 9/30/2020
3.0.1 604 9/29/2020
3.0.0 654 9/16/2020
2.0.2 783 7/8/2020
2.0.1 761 12/25/2019
2.0.0 692 12/25/2019
1.0.6 722 12/5/2019
1.0.5 826 6/2/2019
1.0.4 927 11/30/2018
1.0.3 965 11/12/2018
1.0.2 951 11/12/2018
1.0.1 960 11/12/2018
1.0.0 951 11/12/2018

Introduced new extension methods to register Azure Blob and
File Storage services using a connection string,
alongside the existing configuration-based approach. Added connection string parsing logic and updated AzureConfiguration and AzureFileStorageConfiguration to support initialization from connection strings. Enhanced tests to cover the new registration methods, added a sample appsettings.test.json, and improved test cleanup. Updated package references to 10.0.1 and incremented library version. These changes simplify integration in scenarios where only a connection string is available.