Ecng.Backup.Mega 1.0.149

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.149
                    
NuGet\Install-Package Ecng.Backup.Mega -Version 1.0.149
                    
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.

                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.

                    
Directory.Packages.props

                    
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.149
                    
#r "nuget: Ecng.Backup.Mega, 1.0.149"
                    
#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.149
                    
#: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.149
                    
Install as a Cake Addin
#tool nuget:?package=Ecng.Backup.Mega&version=1.0.149
                    
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.151 173 9/25/2026
1.0.150 183 9/13/2026
1.0.149 129 9/10/2026
1.0.148 156 8/30/2026
1.0.147 134 8/26/2026
1.0.146 166 8/20/2026
1.0.145 160 8/13/2026
1.0.144 136 8/12/2026
1.0.143 190 8/4/2026
1.0.142 152 8/3/2026
1.0.141 149 8/2/2026
1.0.140 155 8/2/2026
1.0.139 157 8/1/2026
1.0.138 251 7/8/2026
1.0.137 185 6/20/2026
1.0.136 187 6/17/2026
1.0.135 163 6/12/2026
1.0.134 164 5/15/2026
1.0.133 161 5/14/2026
1.0.132 156 5/3/2026
Loading failed