FileVault.YandexDisk 0.1.3-alpha

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

FileVault

CI NuGet License: MIT

A platform-independent .NET library for working with file systems. The single IFileProvider interface abstracts away the differences between the local file system, FTP, SFTP, and cloud storage. Extracted from the file subsystem of X-Filer Desktop.

FileVault does not parse user-entered paths or choose a backend for an application. The client resolves its own routes, bookmarks, accounts, and credentials, then creates the appropriate IFileProvider directly.

Supported backends: Local FS · FTP/FTPS · SFTP · Yandex Disk · Google Drive · WSL via UNC paths (Windows)

Packages

Package NuGet Description
FileVault.Core NuGet Contracts and helpers. Depends only on BCL
FileVault.Local NuGet Local file system
FileVault.Ftp NuGet FTP/FTPS via FluentFTP
FileVault.Sftp NuGet SFTP via SSH.NET
FileVault.YandexDisk NuGet Yandex Disk via REST API
FileVault.GoogleDrive NuGet Google Drive via Drive API v3
FileVault.Wsl NuGet WSL distros via \\wsl$\ UNC paths (Windows 10 1903+)

Installation

dotnet add package FileVault.Core
dotnet add package FileVault.Local
dotnet add package FileVault.Ftp
dotnet add package FileVault.Sftp
dotnet add package FileVault.YandexDisk
dotnet add package FileVault.GoogleDrive
dotnet add package FileVault.Wsl        # Windows only

Quick Start

Local file system

using FileVault.Core;
using FileVault.Local;

var provider = new LocalFileProvider("/home/user/Documents");

await foreach (var item in provider.GetItemsAsync(FileProviderFilter.Default))
{
    Console.WriteLine($"{item.Name}  {item.Size?.ToString() ?? "<dir>"}");
}

FTP

using FileVault.Ftp;
using FluentFTP;

var client = new AsyncFtpClient("ftp.example.com", "user", "secret");
await client.Connect();

var provider = new FtpFileProvider(client, "/public");

SFTP

using FileVault.Sftp;
using Renci.SshNet;

var privateKeyFile = new PrivateKeyFile("/home/user/.ssh/id_rsa");
var client = new SftpClient("ssh.example.com", "deploy", privateKeyFile);
client.Connect();

var provider = new SftpFileProvider(client, "/var/data");

Yandex Disk

using Egorozh.YandexDisk.Client.Http;
using FileVault.YandexDisk;

var api = new DiskHttpApi("y0_AgAAAA...", logSaver: null);

// Disk root
var provider = new YandexDiskFileProvider(api, "disk:/");

// Specific folder
var photos = new YandexDiskFileProvider(api, "disk:/Photos");

Google Drive

using Google.Apis.Auth.OAuth2;
using Google.Apis.Drive.v3;
using Google.Apis.Services;
using FileVault.GoogleDrive;

// Build an authenticated DriveService (OAuth2 user credentials example)
var credential = await GoogleWebAuthorizationBroker.AuthorizeAsync(
    GoogleClientSecrets.FromFile("client_secrets.json").Secrets,
    [DriveService.Scope.Drive],
    user: "user",
    CancellationToken.None);

var driveService = new DriveService(new BaseClientService.Initializer
{
    HttpClientInitializer = credential,
    ApplicationName = "MyApp",
});

// FileVault takes the pre-authenticated service — no OAuth logic inside the provider

// My Drive root
var root = new GoogleDriveFileProvider(driveService, "root");

// Specific folder by Drive file ID
var folder = new GoogleDriveFileProvider(driveService, "1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs");

Authentication is the caller's responsibility. Pass any DriveService — OAuth2 user, service account, or impersonation. See Google Auth Library docs.

WSL (Windows Subsystem for Linux)

Requires Windows 10 1903+ with WSL installed. No-op on macOS/Linux.

using FileVault.Local;
using FileVault.Wsl;

var root = new WslDriveItem("Ubuntu").CreateProvider();
var provider = new LocalFileProvider(@"\\wsl$\Ubuntu\home\user\projects");

Application-level routing

If an application supports multiple backends, it should store enough information to construct the right provider itself: local path, FTP remote path plus authenticated client, Google Drive folder ID plus DriveService, and so on.

using FileVault.Core;
using FileVault.Ftp;
using FileVault.Local;
using FileVault.GoogleDrive;

IFileProvider provider = location.Kind switch
{
    LocationKind.Local => new LocalFileProvider(location.Path),
    LocationKind.Ftp => new FtpFileProvider(ftpClient, location.RemotePath),
    LocationKind.GoogleDrive => new GoogleDriveFileProvider(driveService, location.FolderId),
    _ => throw new NotSupportedException($"Unsupported location kind: {location.Kind}")
};

Core Operations

All operations return FileOperationResult<T> — exceptions never propagate to the caller.

// Create folder (appends " (2)", " (3)", etc. on name conflict)
var result = await provider.CreateFolderAsync("NewFolder");
if (result.IsSuccess)
    Console.WriteLine(result.Result!.FullName);

// Copy a file INTO this provider from any other provider
var copyResult = await destProvider.CopyFileInAsync(
    sourceFileItem,
    "/backups/report.pdf",
    new Progress<double>(v => Console.Write($"\r{v:P0}"))
);

// Move a file (same-drive: native move; cross-provider: copy + delete)
await destProvider.MoveFileInAsync(sourceFileItem, destPath, progress);

// Delete
await provider.DeleteAsync([item], toRecycleBin: false);

// Rename
await provider.RenameAsync(item, "new-name.txt");

// Resolve a unique destination path (file is NOT created on disk)
var dest = await provider.ResolveDestinationFileAsync(sourceFile, overwrite: false);
// "report.pdf" → "report (2).pdf" if the name is already taken

Copying folders across providers

CopyFolderInAsync returns null in Result — not an error — when the provider does not support native folder copying (FTP, SFTP, or cross-provider scenarios). The orchestrator is expected to recurse manually:

async Task RecursiveCopyAsync(IFolderItem source, IFileProvider dest, string destPath)
{
    // Attempt native copy (Yandex Disk: server-side; others: returns null)
    var result = await dest.CopyFolderInAsync(source, destPath, progress);
    if (result.IsSuccess && result.Result is not null)
        return; // done

    // No native support — recurse manually
    await dest.CreateFolderAsync(source.Name);
    var subProvider = source.CreateProvider();

    await foreach (var item in subProvider.GetItemsAsync(FileProviderFilter.Default))
    {
        if (item is IFileItem file)
            await dest.CopyFileInAsync(file, $"{destPath}/{file.Name}", progress);
        else if (item is IFolderItem folder)
            await RecursiveCopyAsync(folder, dest, $"{destPath}/{folder.Name}");
    }
}

Microsoft.Extensions.DependencyInjection

Register authenticated clients, services, or app-specific factories. FileVault itself does not provide a DI routing abstraction.

services.AddSingleton(driveService);
services.AddSingleton(ftpClient);

services.AddTransient<Func<SavedLocation, IFileProvider>>(sp => location => location.Kind switch
{
    LocationKind.Local => new LocalFileProvider(location.Path),
    LocationKind.Ftp => new FtpFileProvider(sp.GetRequiredService<AsyncFtpClient>(), location.RemotePath),
    LocationKind.GoogleDrive => new GoogleDriveFileProvider(
        sp.GetRequiredService<DriveService>(),
        location.FolderId),
    _ => throw new NotSupportedException($"Unsupported location kind: {location.Kind}")
});

Adding a Custom Provider

  1. Implement IFileProvider (and IFileItem, IFolderItem for your items).
  2. Decide in your application how users select or address this provider.
  3. Write tests by inheriting FileProviderContractTests from the FileVault.Contract.Tests package — all 17 contract tests run automatically.
// In your MyProvider.Tests project:
// <PackageReference Include="FileVault.Contract.Tests" Version="..." />

public class MyProviderContractTests : FileProviderContractTests
{
    protected override Task<IFileProvider> CreateProviderAsync() { ... }
    protected override Task SeedFileAsync(string name, byte[] content) { ... }
    protected override Task SeedFolderAsync(string name) { ... }
    protected override Task<byte[]> ReadFileAsync(string name) { ... }
    protected override Task<bool> FileExistsAsync(string name) { ... }
    protected override string GetDestPath(string name) { ... }
    public override Task TearDown() { ... }
}

Development

Prerequisites

  • .NET 10 SDK
  • Docker (for FTP integration tests via TestContainers)

Build & Test

dotnet build
dotnet test tests/FileVault.Core.Tests
dotnet test tests/FileVault.Local.Tests

# FTP integration tests (requires Docker)
dotnet test tests/FileVault.Ftp.Tests --filter "Category=Integration"

# Google Drive integration tests (requires a service account JSON)
export GOOGLE_DRIVE_SERVICE_ACCOUNT_JSON=/path/to/sa.json
dotnet test tests/FileVault.GoogleDrive.Tests --filter "Category=Integration"

Releasing

Versions are driven by git tags:

git tag v1.2.0
git push origin v1.2.0

GitHub Actions will pack and publish all packages to NuGet.org automatically.

License

MIT

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
0.1.3-alpha 59 5/17/2026
0.1.2-alpha 64 5/10/2026
0.0.0-alpha.0.12 56 5/10/2026
0.0.0-alpha.0.11 53 5/10/2026