SquidStd.Vfs 0.28.0

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

<h1 align="center">SquidStd.Vfs</h1>

A path-based virtual filesystem abstraction for SquidStd with interchangeable backends. One interface (IVirtualFileSystem) is implemented by real directories, a single zip archive, and an in-memory store - and decorated by an encrypted vault in SquidStd.Crypto. VfsDirectories is a VFS-backed analogue of DirectoriesConfig, so named directory layouts work over any backend (a zip or an encrypted container can stand in for real folders).

Install

dotnet add package SquidStd.Vfs

Usage

using DryIoc;
using SquidStd.Vfs.Abstractions.Interfaces;
using SquidStd.Vfs.Extensions;
using SquidStd.Vfs.Services;

// Register a backend as IVirtualFileSystem (singleton).
container.RegisterVfs(_ => new PhysicalFileSystem("/var/lib/app/data"));
// or: new ZipFileSystem("/var/lib/app/data.zip")
// or: new InMemoryFileSystem()

var fs = container.Resolve<IVirtualFileSystem>();

await fs.WriteAllBytesAsync("docs/cv.pdf", bytes);
byte[]? data = await fs.ReadAllBytesAsync("docs/cv.pdf");

await foreach (var entry in fs.ListAsync("docs"))
{
    Console.WriteLine($"{entry.Path} ({entry.Size} bytes)");
}

await fs.DeleteAsync("docs/cv.pdf");

Named directories over any backend:

var dirs = new VfsDirectories(fs, ["data", "logs"]);
var target = dirs.Combine("data", "report.csv");   // "data/report.csv"
await fs.WriteAllBytesAsync(target, csvBytes);

Logical paths are normalized (forward slashes, root-relative) and reject .. traversal via SquidStd.Vfs.Abstractions.VfsPath.

Key types

Type Purpose
IVirtualFileSystem Path-based filesystem over a pluggable backend.
PhysicalFileSystem Maps logical paths onto a real directory tree.
ZipFileSystem A single .zip archive opened in update mode; IAsyncDisposable.
InMemoryFileSystem Ephemeral, in-process; handy for tests and as a decorator target.
VfsDirectories Named directory layout (DirectoriesConfig analogue) over any backend.
RegisterVfsExtensions RegisterVfs(...) registration.

Decorators

Decorators wrap any IVirtualFileSystem to add behaviour without touching the backend. Stack them in any order.

Decorator Description
ReadOnlyFileSystem(inner) Delegates all reads to inner; rejects every mutation with InvalidOperationException.
ScopedFileSystem(inner, prefix) Roots inner at a path prefix (chroot-like). All paths are resolved relative to the scope; list results are returned relative to it too.
OverlayFileSystem(base, overlay) Reads overlay-first then falls back to base. Writes and deletes go to the overlay only. List returns the union of both; overlay entries shadow base entries with the same path.
CachingFileSystem(remote, cache) Read-through cache: reads prefer the remote and refresh the cache copy on success; on a transport failure they fall back to the (possibly stale) cache. Writes are write-through (remote then cache) and fail when the remote is unreachable.

Composition example - S3 with a local disk cache for resilience to an unstable connection:

// S3 with a local disk cache for resilience to an unstable connection.
var fs = new CachingFileSystem(
    remote: s3FileSystem,
    cache:  new PhysicalFileSystem("/var/cache/app"));

Decorators are not registered via DI helpers; construct them explicitly and pass the result to RegisterVfs(...):

container.RegisterVfs(_ => new ReadOnlyFileSystem(new PhysicalFileSystem("/var/lib/app/data")));

License

MIT - part of SquidStd.

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 (1)

Showing the top 1 NuGet packages that depend on SquidStd.Vfs:

Package Downloads
SquidStd.Crypto

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.28.0 0 7/8/2026
0.27.0 39 7/7/2026
0.26.0 33 7/7/2026
0.25.0 54 7/6/2026
0.24.1 48 7/6/2026
0.24.0 54 7/6/2026
0.23.0 55 7/4/2026
0.22.0 52 7/4/2026
0.21.0 57 7/3/2026
0.20.0 54 7/3/2026
0.19.0 59 7/3/2026
0.18.0 60 7/3/2026
0.17.0 62 7/3/2026
0.16.0 61 7/3/2026
0.15.0 55 7/2/2026
0.14.1 56 7/2/2026
0.14.0 53 7/2/2026
0.13.0 54 7/2/2026
0.12.0 53 7/2/2026
0.11.0 56 7/2/2026
Loading failed