![]() |
VOOZH | about |
dotnet add package Ecng.Backup --version 1.0.271
NuGet\Install-Package Ecng.Backup -Version 1.0.271
<PackageReference Include="Ecng.Backup" Version="1.0.271" />
<PackageVersion Include="Ecng.Backup" Version="1.0.271" />Directory.Packages.props
<PackageReference Include="Ecng.Backup" />Project file
paket add Ecng.Backup --version 1.0.271
#r "nuget: Ecng.Backup, 1.0.271"
#:package Ecng.Backup@1.0.271
#addin nuget:?package=Ecng.Backup&version=1.0.271Install as a Cake Addin
#tool nuget:?package=Ecng.Backup&version=1.0.271Install as a Cake Tool
Core abstractions for cloud backup services. This library defines the unified interface IBackupService that all backup providers implement.
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.
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;
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);
}
// 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}%");
});
}
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}%");
});
}
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}%"));
}
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");
}
}
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;
}
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);
}
| 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 |
Install-Package Ecng.Backup
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net6.0 net6.0 is compatible. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 was computed. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. 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 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 |
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.271 | 93 | 6/17/2026 |
| 1.0.270 | 229 | 6/12/2026 |
| 1.0.269 | 241 | 5/15/2026 |
| 1.0.268 | 234 | 5/14/2026 |
| 1.0.267 | 322 | 5/3/2026 |
| 1.0.266 | 399 | 4/14/2026 |
| 1.0.265 | 503 | 3/17/2026 |
| 1.0.264 | 461 | 3/17/2026 |
| 1.0.263 | 529 | 3/3/2026 |
| 1.0.262 | 390 | 2/28/2026 |
| 1.0.261 | 517 | 2/4/2026 |
| 1.0.260 | 480 | 2/1/2026 |
| 1.0.259 | 590 | 1/22/2026 |
| 1.0.258 | 513 | 1/19/2026 |
| 1.0.257 | 542 | 1/18/2026 |
| 1.0.256 | 466 | 1/18/2026 |
| 1.0.255 | 478 | 1/14/2026 |
| 1.0.254 | 467 | 1/13/2026 |
| 1.0.253 | 478 | 1/13/2026 |
| 1.0.252 | 527 | 1/9/2026 |