Ecng.Backup.Mega 1.0.123

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

Ecng.Backup.Mega

Mega.nz backup provider implementing IBackupService.

Overview

MegaService provides cloud backup capabilities using Mega.nz encrypted cloud storage. All data is end-to-end encrypted automatically.

Usage

Creating the Service

using System.Security;
using Ecng.Backup;
using Ecng.Backup.Mega;

// Create secure password
var password = new SecureString();
foreach (char c in "your-password")
    password.AppendChar(c);
password.MakeReadOnly();

var mega = new MegaService(
    email: "your-email@example.com",
    password: password
);

// Login happens automatically on first operation

Features

Feature Supported
CanPublish Yes (permanent links only)
CanExpirable No
CanFolders Yes
CanPartialDownload No

Creating Folders

Unlike S3-like services, Mega requires explicit folder creation:

// Create nested folder structure
var folder = new BackupEntry { Name = "backups" };
var subfolder = new BackupEntry { Name = "2024", Parent = folder };
var deepFolder = new BackupEntry { Name = "january", Parent = subfolder };

// Creates: /backups/2024/january
await mega.CreateFolder(deepFolder);
// Parent folders are created automatically if they don't exist

Uploading Files

// First ensure parent folder exists
var folder = new BackupEntry { Name = "backups/2024" };
await mega.CreateFolder(folder);

// Upload file to folder
var entry = new BackupEntry
{
    Name = "data.zip",
    Parent = folder
};

await using var stream = File.OpenRead(@"C:\data.zip");
await mega.UploadAsync(entry, stream, progress =>
{
    Console.WriteLine($"Upload: {progress}%");
});

Downloading Files

var folder = new BackupEntry { Name = "backups/2024" };
var entry = new BackupEntry { Name = "data.zip", Parent = folder };

await using var stream = File.Create(@"C:\downloaded-data.zip");
await mega.DownloadAsync(entry, stream, null, null, progress =>
{
    Console.WriteLine($"Download: {progress}%");
});
// Note: Partial downloads are not supported

Listing Files

// List files in folder
var folder = new BackupEntry { Name = "backups" };

await foreach (var item in mega.FindAsync(folder, criteria: null))
{
    Console.WriteLine($"{item.Name}: {item.Size} bytes");
}

// List root folder
await foreach (var item in mega.FindAsync(null, criteria: null))
{
    Console.WriteLine(item.Name);
}

// Filter by name
await foreach (var item in mega.FindAsync(folder, criteria: "zip"))
{
    Console.WriteLine(item.Name); // Only items containing "zip"
}

Publishing Files

var entry = new BackupEntry { Name = "shared-file.pdf", Parent = folder };

// Get public share link
string publicUrl = await mega.PublishAsync(entry);
Console.WriteLine($"Share link: {publicUrl}");
// Example: https://mega.nz/file/abc123#key

// Remove public access
await mega.UnPublishAsync(entry);

Deleting Files

var entry = new BackupEntry { Name = "old-backup.zip", Parent = folder };
await mega.DeleteAsync(entry);

Getting File Info

var entry = new BackupEntry { Name = "data.zip", Parent = folder };
await mega.FillInfoAsync(entry);

Console.WriteLine($"Size: {entry.Size}");
Console.WriteLine($"Modified: {entry.LastModified}");

Important Notes

  1. Login is automatic: The first operation triggers login
  2. End-to-end encryption: All files are encrypted client-side
  3. No partial downloads: You must download entire files
  4. No expiring links: Share links are permanent until unpublished
  5. Folder structure: Explicit folder creation is required

NuGet

Install-Package Ecng.Backup.Mega

Dependencies

  • Ecng.Backup
  • Ecng.Collections
  • Nito.AsyncEx
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 (2)

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

Package Downloads
StockSharp.Hydra.Core

Hydra core components. More info on web site https://stocksharp.com/store/

Ecng.Backup.All

Ecng system framework

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.127 114 3/3/2026
1.0.126 112 2/28/2026
1.0.125 166 2/4/2026
1.0.124 131 2/1/2026
1.0.123 154 1/26/2026
1.0.122 136 1/22/2026
1.0.121 154 1/19/2026
1.0.120 133 1/19/2026
1.0.119 130 1/18/2026
1.0.118 131 1/18/2026
1.0.117 139 1/14/2026
1.0.116 137 1/13/2026
1.0.115 134 1/13/2026
1.0.114 136 1/12/2026
1.0.113 137 1/9/2026
1.0.112 134 1/9/2026
1.0.111 135 1/4/2026
1.0.110 112 12/30/2025
1.0.109 112 12/29/2025
1.0.108 119 12/26/2025
Loading failed