Ecng.Backup 1.0.255

There is a newer version of this package available.
See the version list below for details.
dotnet add package Ecng.Backup --version 1.0.255
                    
NuGet\Install-Package Ecng.Backup -Version 1.0.255
                    
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="Ecng.Backup" Version="1.0.255" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Ecng.Backup" Version="1.0.255" />
                    
Directory.Packages.props
<PackageReference Include="Ecng.Backup" />
                    
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 Ecng.Backup --version 1.0.255
                    
#r "nuget: Ecng.Backup, 1.0.255"
                    
#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 Ecng.Backup@1.0.255
                    
#: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=Ecng.Backup&version=1.0.255
                    
Install as a Cake Addin
#tool nuget:?package=Ecng.Backup&version=1.0.255
                    
Install as a Cake Tool

Ecng.Backup

Core abstractions for cloud backup services. This library defines the unified interface IBackupService that all backup providers implement.

Overview

The library provides a provider-agnostic API for working with cloud storage services. You can upload, download, delete, and publish files using the same code regardless of whether you're using AWS S3, Azure Blob Storage, Yandex.Disk, or Mega.

Key Types

BackupEntry

Represents a file or folder in cloud storage.

var folder = new BackupEntry { Name = "my-folder" };
var file = new BackupEntry
{
    Name = "data.zip",
    Parent = folder  // Creates path: my-folder/data.zip
};

// Get full path including all parents
string path = file.GetFullPath(); // "my-folder/data.zip"

// Access metadata (populated after FillInfoAsync or FindAsync)
long size = file.Size;
DateTime modified = file.LastModified;

IBackupService

The main interface for interacting with cloud storage.

public interface IBackupService : IDisposable
{
    // Feature detection
    bool CanPublish { get; }        // Supports public URLs
    bool CanExpirable { get; }      // Supports expiring public URLs
    bool CanFolders { get; }        // Supports folder creation
    bool CanPartialDownload { get; } // Supports range downloads

    // Operations
    Task CreateFolder(BackupEntry entry, CancellationToken ct = default);
    IAsyncEnumerable<BackupEntry> FindAsync(BackupEntry parent, string criteria);
    Task FillInfoAsync(BackupEntry entry, CancellationToken ct = default);
    Task DeleteAsync(BackupEntry entry, CancellationToken ct = default);
    Task DownloadAsync(BackupEntry entry, Stream stream, long? offset, long? length,
                       Action<int> progress, CancellationToken ct = default);
    Task UploadAsync(BackupEntry entry, Stream stream,
                     Action<int> progress, CancellationToken ct = default);
    Task<string> PublishAsync(BackupEntry entry, TimeSpan? expiresIn = null,
                              CancellationToken ct = default);
    Task UnPublishAsync(BackupEntry entry, CancellationToken ct = default);
}

Usage Examples

Uploading a File

// Works with any IBackupService implementation
async Task UploadFileAsync(IBackupService service, string localPath, string remotePath)
{
    var entry = new BackupEntry { Name = remotePath };

    await using var stream = File.OpenRead(localPath);
    await service.UploadAsync(entry, stream, progress =>
    {
        Console.WriteLine($"Upload progress: {progress}%");
    });
}

Downloading a File

async Task DownloadFileAsync(IBackupService service, string remotePath, string localPath)
{
    var entry = new BackupEntry { Name = remotePath };

    await using var stream = File.Create(localPath);
    await service.DownloadAsync(entry, stream, null, null, progress =>
    {
        Console.WriteLine($"Download progress: {progress}%");
    });
}

Partial Download (Resume Support)

async Task ResumeDownloadAsync(IBackupService service, BackupEntry entry, string localPath)
{
    if (!service.CanPartialDownload)
        throw new NotSupportedException("Service doesn't support partial downloads");

    var fileInfo = new FileInfo(localPath);
    long existingBytes = fileInfo.Exists ? fileInfo.Length : 0;

    // Get total file size
    await service.FillInfoAsync(entry);
    long remaining = entry.Size - existingBytes;

    if (remaining <= 0)
        return; // Already complete

    await using var stream = new FileStream(localPath, FileMode.Append);
    await service.DownloadAsync(entry, stream, existingBytes, remaining,
        progress => Console.WriteLine($"Resume progress: {progress}%"));
}

Listing Files

async Task ListFilesAsync(IBackupService service, string folderPath)
{
    var folder = new BackupEntry { Name = folderPath };

    await foreach (var entry in service.FindAsync(folder, criteria: "*.zip"))
    {
        Console.WriteLine($"{entry.GetFullPath()} - {entry.Size} bytes");
    }
}

Publishing a File

async Task<string> ShareFileAsync(IBackupService service, BackupEntry entry)
{
    if (!service.CanPublish)
        throw new NotSupportedException("Service doesn't support publishing");

    // Permanent public URL (if supported)
    string permanentUrl = await service.PublishAsync(entry);

    // Or expiring URL (7 days max for S3)
    if (service.CanExpirable)
    {
        string tempUrl = await service.PublishAsync(entry, TimeSpan.FromHours(24));
    }

    return permanentUrl;
}

Working with Folders

async Task OrganizeFilesAsync(IBackupService service)
{
    if (!service.CanFolders)
    {
        // S3-like services use virtual folders via path prefixes
        var file = new BackupEntry { Name = "backups/2024/january/data.zip" };
        // The "folders" are created implicitly
        return;
    }

    // Services like Yandex.Disk require explicit folder creation
    var folder = new BackupEntry { Name = "backups" };
    await service.CreateFolder(folder);

    var subfolder = new BackupEntry { Name = "2024", Parent = folder };
    await service.CreateFolder(subfolder);
}

Available Implementations

Package Service CanPublish CanFolders CanPartialDownload
Ecng.Backup.AWS Amazon S3 Yes No Yes
Ecng.Backup.AWS Amazon Glacier No No No
Ecng.Backup.Azure Azure Blob Storage Yes No Yes
Ecng.Backup.Yandex Yandex.Disk Yes Yes Yes
Ecng.Backup.Mega Mega.nz Yes Yes No

NuGet

Install-Package Ecng.Backup
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  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.  net9.0 was computed.  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 (7)

Showing the top 5 NuGet packages that depend on Ecng.Backup:

Package Downloads
StockSharp.Xaml

Misc graphical components. More info on web site https://stocksharp.com/store/

Ecng.Backup.Yandex

Ecng system framework

StockSharp.Studio.WebApi

Community types. More info on web site https://stocksharp.com/store/

Ecng.Backup.AWS

Ecng system framework

Ecng.Backup.Mega

Ecng system framework

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.260 122 2/1/2026
1.0.259 334 1/22/2026
1.0.258 258 1/19/2026
1.0.257 284 1/18/2026
1.0.256 214 1/18/2026
1.0.255 218 1/14/2026
1.0.254 210 1/13/2026
1.0.253 223 1/13/2026
1.0.252 274 1/9/2026
1.0.251 320 1/4/2026
1.0.250 209 12/30/2025
1.0.249 208 12/29/2025
1.0.248 201 12/26/2025
1.0.247 201 12/26/2025
1.0.246 202 12/26/2025
1.0.245 211 12/26/2025
1.0.244 283 12/25/2025
1.0.243 285 12/25/2025
1.0.242 294 12/22/2025
1.0.241 265 12/21/2025
1.0.240 281 12/19/2025
1.0.239 311 12/19/2025
1.0.238 345 12/19/2025
1.0.237 372 12/17/2025
1.0.236 434 12/16/2025
1.0.235 412 12/15/2025
1.0.234 271 12/12/2025
1.0.233 381 12/12/2025
1.0.232 357 11/29/2025
1.0.231 246 11/28/2025
1.0.230 247 11/28/2025
1.0.229 301 11/27/2025
1.0.228 299 11/24/2025
1.0.227 313 11/24/2025
1.0.226 310 11/23/2025
1.0.225 327 11/22/2025
1.0.224 522 11/20/2025
1.0.223 525 11/18/2025
1.0.222 525 11/18/2025
1.0.221 416 11/13/2025
1.0.220 367 11/10/2025
1.0.219 270 11/1/2025
1.0.218 319 10/28/2025
1.0.217 318 10/27/2025
1.0.216 322 10/27/2025
1.0.215 237 10/25/2025
1.0.214 292 10/3/2025
1.0.213 366 9/25/2025
1.0.212 3,093 8/30/2025
1.0.211 341 8/19/2025
1.0.210 1,716 7/13/2025
1.0.209 317 7/13/2025
1.0.208 304 7/12/2025
1.0.207 561 7/8/2025
1.0.206 1,548 6/16/2025
1.0.205 487 6/9/2025
1.0.204 384 6/8/2025
1.0.203 635 5/21/2025
1.0.202 287 5/17/2025
1.0.201 715 5/12/2025
1.0.200 367 5/12/2025
1.0.199 422 4/17/2025
1.0.198 1,441 3/20/2025
1.0.197 363 3/19/2025
1.0.196 1,027 2/26/2025
1.0.195 324 2/26/2025
1.0.194 1,109 2/5/2025
1.0.193 333 1/21/2025
1.0.192 362 1/14/2025
1.0.191 323 1/12/2025
1.0.190 288 1/10/2025
1.0.189 2,290 11/18/2024
1.0.188 561 11/7/2024
1.0.187 411 10/19/2024
1.0.186 1,370 10/5/2024
1.0.185 1,022 9/18/2024
1.0.184 341 9/17/2024
1.0.183 869 9/1/2024
1.0.182 2,950 6/12/2024
1.0.181 641 5/28/2024
1.0.180 1,248 5/4/2024
1.0.179 900 4/14/2024
1.0.178 914 3/28/2024
1.0.177 341 3/17/2024
1.0.176 929 2/23/2024
1.0.175 424 2/23/2024
1.0.174 922 2/18/2024
1.0.173 347 2/16/2024
1.0.172 636 2/13/2024
1.0.171 606 2/8/2024
1.0.170 596 2/4/2024
1.0.169 721 1/23/2024
1.0.168 730 1/12/2024
1.0.167 855 1/2/2024
1.0.166 335 12/29/2023
1.0.165 1,831 11/12/2023
1.0.164 367 11/10/2023
1.0.163 329 11/10/2023
1.0.162 335 11/9/2023
1.0.161 350 11/3/2023
1.0.160 360 11/1/2023
1.0.159 332 11/1/2023
1.0.158 1,863 9/8/2023
1.0.157 427 9/8/2023
1.0.156 409 9/3/2023
1.0.155 431 8/21/2023
1.0.154 429 8/14/2023
1.0.153 445 8/10/2023
1.0.152 2,073 6/29/2023
1.0.151 1,011 5/27/2023
1.0.150 564 5/19/2023
1.0.149 1,389 5/8/2023
1.0.148 536 4/21/2023
1.0.147 2,273 4/3/2023
1.0.146 671 3/18/2023
1.0.145 511 3/17/2023
1.0.144 527 3/17/2023
1.0.143 1,895 3/6/2023
1.0.142 2,952 2/9/2023
1.0.141 1,154 2/7/2023
1.0.140 836 2/4/2023
1.0.139 1,275 2/2/2023
1.0.138 1,277 1/30/2023
1.0.137 2,807 12/30/2022
1.0.136 1,755 12/12/2022
1.0.135 1,942 11/30/2022
1.0.134 2,700 11/11/2022
1.0.133 1,033 11/11/2022
1.0.132 1,505 11/5/2022
1.0.131 1,900 11/1/2022
1.0.130 1,620 10/16/2022
1.0.129 2,868 9/8/2022
1.0.128 1,257 9/8/2022
1.0.127 1,227 9/8/2022
1.0.126 2,752 8/24/2022
1.0.125 1,296 8/14/2022
1.0.124 937 8/13/2022
1.0.123 968 8/8/2022
1.0.122 989 8/8/2022
1.0.121 983 7/26/2022
1.0.120 901 7/26/2022
1.0.119 701 7/26/2022
1.0.118 1,720 7/19/2022
1.0.117 1,246 7/18/2022
1.0.116 3,320 7/8/2022
1.0.115 2,612 6/18/2022
1.0.114 690 6/6/2022
1.0.113 2,935 4/30/2022
1.0.112 694 4/20/2022
1.0.111 753 4/10/2022
1.0.110 718 4/7/2022
1.0.109 742 4/7/2022
1.0.108 722 4/2/2022
1.0.107 1,692 3/29/2022
1.0.106 713 3/27/2022
1.0.105 666 3/27/2022
1.0.104 23,586 1/24/2022
1.0.103 7,873 12/29/2021
1.0.102 991 12/20/2021
1.0.101 600 12/13/2021
1.0.100 968 12/7/2021
1.0.99 1,209 12/6/2021
1.0.98 615 12/6/2021
1.0.97 619 12/2/2021
1.0.96 1,646 11/29/2021
1.0.95 990 11/22/2021
1.0.94 591 11/17/2021
1.0.93 595 11/14/2021
1.0.92 982 11/13/2021
1.0.91 624 11/11/2021
1.0.90 605 11/11/2021
1.0.89 603 11/10/2021
1.0.88 583 11/9/2021
1.0.87 1,461 11/5/2021
1.0.86 621 11/5/2021
1.0.85 612 11/4/2021
1.0.84 605 11/4/2021
1.0.83 619 11/3/2021
1.0.82 722 10/30/2021
1.0.81 1,127 10/21/2021
1.0.80 742 10/17/2021
1.0.79 1,199 10/14/2021
1.0.78 876 10/13/2021
1.0.77 622 10/12/2021
1.0.76 873 10/11/2021
1.0.75 619 10/9/2021
1.0.74 977 10/7/2021
1.0.73 1,118 10/7/2021
1.0.72 566 10/7/2021
1.0.71 642 10/6/2021
1.0.70 592 9/28/2021
1.0.69 1,400 9/23/2021
1.0.68 675 9/11/2021
1.0.67 635 9/10/2021
1.0.66 661 9/9/2021
1.0.65 605 9/8/2021
1.0.64 626 9/8/2021
1.0.63 1,056 9/6/2021
1.0.62 643 8/31/2021
1.0.61 578 8/30/2021
1.0.60 1,692 7/31/2021
1.0.59 748 7/31/2021
1.0.58 659 7/30/2021
1.0.57 681 7/26/2021
1.0.56 1,187 7/5/2021
1.0.55 641 7/1/2021
1.0.54 1,617 6/4/2021
1.0.53 2,218 4/26/2021
1.0.52 1,130 4/19/2021
1.0.51 1,695 4/7/2021
1.0.50 812 4/3/2021
1.0.49 1,311 3/22/2021
1.0.48 1,528 3/4/2021
1.0.47 862 2/26/2021
1.0.46 2,040 2/2/2021
1.0.45 1,001 1/26/2021
1.0.44 771 1/24/2021
1.0.43 680 1/24/2021
1.0.42 716 1/23/2021
1.0.41 953 1/20/2021
1.0.40 725 1/20/2021
1.0.39 753 1/18/2021
1.0.38 572 1/18/2021
1.0.37 821 1/16/2021
1.0.36 12,853 12/16/2020
1.0.35 4,896 12/14/2020
1.0.34 5,939 12/9/2020
1.0.33 1,117 12/6/2020
1.0.32 908 12/2/2020
1.0.31 855 12/2/2020
1.0.30 3,189 12/1/2020
1.0.29 12,327 11/12/2020
1.0.29-atestpub 600 11/11/2020
1.0.28 2,605 10/11/2020
1.0.27 6,701 9/9/2020
1.0.26 2,103 9/3/2020
1.0.25 2,306 8/20/2020
1.0.24 5,202 8/9/2020
1.0.23 2,169 7/28/2020
1.0.22 2,176 7/19/2020
1.0.21 3,145 7/6/2020
1.0.20 4,588 6/6/2020
1.0.19 2,098 6/4/2020
1.0.18 3,221 5/29/2020
1.0.17 3,237 5/21/2020
1.0.16 951 5/17/2020
1.0.15 3,247 5/12/2020
1.0.14 5,474 5/4/2020
1.0.13 1,370 4/24/2020
1.0.12 941 4/22/2020
1.0.11 912 4/22/2020
1.0.10 966 4/21/2020
1.0.9 2,491 4/18/2020
1.0.8 2,114 4/16/2020
1.0.7 854 4/16/2020
1.0.6 2,038 4/15/2020
1.0.5 2,350 4/11/2020
1.0.4 2,200 4/3/2020
1.0.3 879 4/1/2020
1.0.2 2,147 3/27/2020
1.0.1 2,288 3/22/2020
1.0.0 1,066 3/22/2020