Fungusware.Nfs
2026.11.7.141
dotnet add package Fungusware.Nfs --version 2026.11.7.141
NuGet\Install-Package Fungusware.Nfs -Version 2026.11.7.141
<PackageReference Include="Fungusware.Nfs" Version="2026.11.7.141" />
<PackageVersion Include="Fungusware.Nfs" Version="2026.11.7.141" />
<PackageReference Include="Fungusware.Nfs" />
paket add Fungusware.Nfs --version 2026.11.7.141
#r "nuget: Fungusware.Nfs, 2026.11.7.141"
#:package Fungusware.Nfs@2026.11.7.141
#addin nuget:?package=Fungusware.Nfs&version=2026.11.7.141
#tool nuget:?package=Fungusware.Nfs&version=2026.11.7.141
Fungusware.Nfs
A managed, asynchronous NFS client for .NET. Connect to an NFS server (version 3, 4.0 or 4.1: a NAS, a Linux server, a storage appliance), then list, read and write files using ordinary paths. No operating system NFS client, no administrator rights and no native code.
- Pure .NET (
netstandard2.0andnetstandard2.1): runs on Windows, Linux and macOS, on .NET Framework 4.6.1 and later, .NET Core 2.0+ and .NET 5 and later. - NFSv3, NFSv4.0 and NFSv4.1, picked automatically: the newest the server offers.
- Async from top to bottom, with several requests in flight at once, so transfers stay fast on slow or high-latency links (VPN, Wi-Fi, WAN).
- Streams, whole-file helpers, directories, rename/move, permissions and timestamps.
- Familiar .NET exceptions (
FileNotFoundException,DirectoryNotFoundException,UnauthorizedAccessException). - Offline licensing: a signed key is checked on the machine. No activation server, no internet access needed.
Quick start
using Fungusware.Nfs;
NfsLicense.Register("FNFS1...."); // your license key (once, at start-up)
await using var nfs = await NfsClient.ConnectAsync(new NfsClientOptions
{
Host = "192.168.1.20",
ExportPath = "/volume1/shared", // an exported directory on the server
UserId = 1000, // the Unix user the server should treat you as
GroupId = 1000,
});
// List a directory
foreach (var entry in await nfs.ListAsync("/photos"))
Console.WriteLine($"{entry.Name} {(entry.IsDirectory ? "<dir>" : entry.Attributes.Size + " bytes")} {entry.Attributes.ModifyTimeUtc:u}");
// Read
byte[] data = await nfs.ReadAllBytesAsync("/photos/cat.jpg");
await using (var stream = await nfs.OpenReadAsync("/photos/big-video.mp4")) // seekable, with read-ahead
await stream.CopyToAsync(destination);
// Write
await nfs.CreateDirectoryAsync("/backup/2026/10"); // creates missing parents
await nfs.WriteAllBytesAsync("/backup/2026/10/report.bin", data);
await using (var output = await nfs.OpenWriteAsync("/backup/log.txt", NfsWriteMode.Append))
await output.WriteAsync(System.Text.Encoding.UTF8.GetBytes("new line\n"));
// Manage
await nfs.MoveAsync("/backup/log.txt", "/backup/log-old.txt", overwrite: true);
await nfs.SetAttributesAsync("/backup/report.bin", new NfsSetAttributes { Mode = Convert.ToUInt32("640", 8) });
await nfs.DeleteFileAsync("/backup/log-old.txt");
await nfs.DeleteDirectoryAsync("/backup/2026", recursive: true);
Paths
Paths are /-separated and relative to the export you connected to (/photos/cat.jpg). A leading / is optional. . and .. are resolved by the client and can never climb out of the export. Names are UTF-8.
API overview (NfsClient)
| Area | Methods |
|---|---|
| Connect | ConnectAsync(NfsClientOptions) |
| Information | GetAttributesAsync, ExistsAsync, ListAsync, GetLinkAttributesAsync |
| Read | ReadAllBytesAsync, ReadAsync(path, offset, buffer), OpenReadAsync |
| Write | WriteAllBytesAsync, WriteAsync(path, offset, data), OpenWriteAsync(path, NfsWriteMode) |
| Manage | CreateDirectoryAsync, DeleteFileAsync, DeleteDirectoryAsync, MoveAsync, SetAttributesAsync |
| Symbolic links | CreateSymbolicLinkAsync, ReadLinkAsync, GetLinkAttributesAsync |
NfsFileAttributes gives type, Unix mode, owner, size, space used, inode and UTC access/modify/change times.
Options (NfsClientOptions)
| Option | Meaning |
|---|---|
Host, ExportPath |
Required. The server and the exported directory to use as the root. |
Version |
Auto (default), V3, V4, V40 or V41. See NFS versions below. |
UserId, GroupId, AdditionalGroupIds, MachineName |
The identity sent with each request (AUTH_SYS). AUTH_SYS does not check passwords: the server trusts these numbers. |
TimeoutMs |
Connect and per-request timeout. Default 30000. |
MaxParallelRequests |
Requests in flight at once (1 to 64, default 8). Raises throughput on high-latency links. |
UseSecurePort |
Connect from a reserved local port (512-1023), which exports using the secure option require (the default on Linux servers). Needs root on Linux/macOS; no special rights on Windows. Default false. |
FollowSymbolicLinks |
Follow links in paths and when reading, writing or listing (default true). See below. |
DefaultFileMode, DefaultDirectoryMode |
Permission bits for files and directories you create (default 0644 and 0755). Some servers, such as Synology, ignore these and apply their own. |
NfsPort, MountPort |
NFSv3: skip the portmapper by naming the ports (for firewalls that only allow 2049). NFSv4: NfsPort is the one port, default 2049; MountPort is not used. |
LicenseKey |
Your license key, if not registered globally. |
Licensing
A license is per developer, and applications you build can be distributed freely. Give the library your key one of three ways, checked in this order:
NfsClientOptions.LicenseKeyNfsLicense.Register(key)once at start-up- The
FUNGUSWARE_NFS_LICENSEenvironment variable
Use of the library is governed by the license agreement (EULA) included in the package (LICENSE.txt), which you accept when you install it. Keys are signed tokens verified locally, so no internet access is needed. A key includes one year of updates: it works forever with every build released on or before its "updates until" date (NfsLicense.UpdatesUntilUtc). Package versions are release dates (2026.10.13.1430), so you can see which builds a key covers.
Without a valid key the library works fully, but each connection waits 10 seconds and NfsLicense.Notice is raised, so it is fine for a quick trial and not for production. NfsLicense.Status tells you why a key was not accepted (Malformed, InvalidSignature, Expired, UpdatesExpired, ...).
NFS versions
NfsClientOptions.Version selects the protocol. The default, Auto, uses the newest version the server offers: NFSv4.1, then 4.0, then 3. NfsClient.ProtocolVersion reports which one is in use. Your code is the same for every version.
Version |
Protocol |
|---|---|
Auto (default) |
4.1, else 4.0, else 3. |
V4 |
4.1, else 4.0. No fallback to 3. |
V41, V40, V3 |
Exactly that version. |
- NFSv4 uses one connection to port 2049 (
NfsPort). There is no portmapper and no MOUNT.ExportPathis a path in the server's NFSv4 namespace, which on Linux and Synology servers is the same as the NFSv3 export path. WithAuto, an export path that is not in the server's NFSv4 tree falls back to NFSv3. - NFSv4.1 uses sessions. A request that changes something (create, rename, delete) runs at most once even if the connection breaks and the request is sent again. Requests in flight are limited to the slots the server grants;
MaxParallelRequestsis a ceiling. The session ends when the client is disposed. - NFSv4.0 has no such guarantee. If the connection breaks while a create, rename or delete is in flight, the library reports the error instead of repeating the request, because it cannot tell whether the server did it. Reads and writes at an offset are always repeated.
- Owners. NFSv4 names owners as text. Numeric ids (
1000) androotbecome the matching number; any othername@domainis reported as 65534 (nobody).UserIdandGroupIdare still sent as AUTH_SYS numbers. - Security. AUTH_SYS only, as for NFSv3: trusted networks only. A server that requires Kerberos refuses the connection.
Symbolic links
Links work like they do in System.IO: reading, writing and listing a path follows them, ListAsync reports the link itself as NfsFileType.SymbolicLink (and never descends into it, so a recursive delete cannot wander into a link's target), and DeleteFileAsync / MoveAsync act on the link, not its target.
await nfs.CreateSymbolicLinkAsync("/current", "releases/2026-10"); // relative target, resolved from the link's folder
string where = await nfs.ReadLinkAsync("/current"); // "releases/2026-10"
var atTarget = await nfs.GetAttributesAsync("/current"); // follows the link (stat)
var atLink = await nfs.GetLinkAttributesAsync("/current"); // the link itself (lstat)
- A link can never take you outside the export. An absolute link such as
/volume1/shared/docsis followed if it lies inside the export you connected to (ExportPath), otherwise it behaves like a missing file, as do loops (more than 40 hops) and dangling links. ..in a link or path is resolved by the client and stops at the export root.- Set
FollowSymbolicLinks = falseto see links as plain items (this also saves one request per file created).
Errors
| Situation | Exception |
|---|---|
| Missing file | FileNotFoundException |
| Missing or non-directory path | DirectoryNotFoundException |
| Permission denied, or reading a directory as a file | UnauthorizedAccessException |
Move onto an existing file without overwrite, deleting a non-empty directory |
IOException |
| Server refuses to mount the export | NfsMountException (has a Status) |
| Other server error | NfsStatusException (has an NfsStatus) |
No answer within TimeoutMs |
TimeoutException |
| Malformed or unexpected RPC reply | RpcException |
Good to know
- Writes are safe by default. Data is sent in parallel, then committed to the server's disk. If the server restarts mid-write, the library reports it instead of silently losing data.
- Thread safety. A single
NfsClientcan be used from many tasks at once. - Firewalls. NFSv3 uses the portmapper (TCP 111), the MOUNT service and the NFS service (usually 2049). If only 2049 is open, use NFSv4 (
Version = NfsProtocolVersion.V4), or for NFSv3 setNfsPortandMountPort. - The
secureexport option. Linux NFS servers export withsecureby default and then refuse clients that connect from an ordinary port, with an error that does not say why. If you get an authentication or access-denied error at connect, setUseSecurePort = true(the exception message says so too). - Exports. The server must export the directory to your client address, and the Unix user in
UserIdmust have access. A mount refusal (AccessDenied) usually means the export's client list or user mapping, not the library.
Not supported (yet)
- Kerberos / RPCSEC_GSS authentication (planned), NFS over UDP, NFSv4 delegations and pNFS.
- File locking (NLM).
Requirements
.NET Framework 4.6.1 or later (tested on 4.8), .NET Core 2.0 or later, or .NET 5 or later (including .NET 8 and 10), on any operating system. The .NET Framework build adds the System.Memory and Microsoft.Bcl.AsyncInterfaces packages. TCP access to the server.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. 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 was computed. 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. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 is compatible. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Microsoft.Bcl.AsyncInterfaces (>= 8.0.0)
- System.Memory (>= 4.5.5)
-
.NETStandard 2.1
- No dependencies.
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 |
|---|---|---|
| 2026.11.7.141 | 116 | 11/7/2026 |
| 2026.10.22.1059 | 126 | 10/22/2026 |
| 2026.10.22.1021 | 103 | 10/22/2026 |
| 2026.10.22.1008 | 108 | 10/22/2026 |
| 2026.10.15.612 | 116 | 10/15/2026 |
| 2026.10.13.850 | 121 | 10/13/2026 |