FileAbstractions 1.0.0

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

File Abstractions

A C# .NET library for async filesystem abstractions.

Purpose

Filesystems have become practically the only way modern software interacts with storage media. While the operating system provides an API to list, create and work with files, this API is mostly made for local disks, or rarely network mounts of specific protocols - but mounting these requires special privleges which are sometimes not available at all (for example, in mobile devices).

Moreover, Android has blocked access to the OS filesystem API in favor of "Scoped Storage" (which lacks features such as setting a file's last modified date, but that's beside the point).

There's a huge variety of different implementations of very similar concepts:

  • SFTP
  • FTP(S)
  • WebDAV
  • Proprietary Cloud Storage protocols (Google Drive, Microsoft OneDrive...)
  • And many more.

Therefore, it's logical to do the filesystem abstraction at the application layer instead of relying on the operating system, and thus these interfaces were made.

Implementation Notes

Path Format

  • The contract of all interfaces is to use pure virtual paths, where directories are separated with a forward slash ('/'), regardless of the operating system.

    • Despite this, LocalDirectory sanitizes '\' on Windows to prevent unexpected behavior.

    • A trailing '/' in directory paths is allowed in some contexts.

  • Special directories "." and ".." are deliberately not supported.

Files and Directories API

  • Users of this library hold IVirtualFile or IVirtualDirectory instances, matching the file type they expect to be found. These are roughly equivalent to paths: the file or directory being pointed to doesn't necessarily exist, nor is it even of the expected type, since the filesystem could have been modified since the last time we checked it. Therefore, callers should expect FileNotFoundException and DirectoryNotFoundException.

  • Despite this, when opening a file, the returned Stream instance is equivalent to an open file descriptor, and will always refer to the same file it referred to at the moment of opening.

  • Returned streams may implement IHasFileAttributes to allow callers to inspect the attributes of the original file, similar to fstat.

  • Returned streams may implement IConcurrentStream to allow callers to invoke multiple read/write calls concurrently and statelessly, as opposed to the usual, sequential Stream interface.

  • Returned streams may implement IAsyncDisposableCancelable, where the caller can supply a CancellationToken to DisposeAsync to cancel the disposal. This is useful for example if the disposal itself requires network IO.

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.
  • net10.0

    • No dependencies.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on FileAbstractions:

Package Downloads
JustSFTP.Client

SFTP V3 Client Implementation

CsCryptFs

A C# implementation of the gocryptfsfilesystem format.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 44 11/7/2026
0.7.0 91 9/27/2026
0.6.1 93 9/26/2026
0.6.0 153 9/4/2026
0.5.0 109 8/29/2026
0.4.0 92 8/28/2026
0.3.1 116 6/15/2026
0.3.0 164 6/12/2026
0.2.1 105 6/9/2026
0.2.0 105 6/6/2026