Entry Points
#Reference
The package has nine subpath exports. Each export loads only the code that it needs.
| import from | what you get |
|---|---|
mountx/auto | start here: mount(), which selects a transport for the current host |
mountx | driver types, capabilities, errors, path helpers, and the loopback harness |
mountx/drivers/memory | an in-memory filesystem |
mountx/drivers/node-fs | a passthrough driver for a real directory |
mountx/drivers/unstorage | an adapter for an unstorage Storage |
mountx/fuse | the FUSE transport, when you must select it directly |
mountx/9p | the 9P2000.L transport and createP9Server() |
mountx/nfs | the NFS transport (v3 by default, v4.1 on request) and createNfsServer() |
mountx/s3 | the S3 gateway and createS3Server(); this is not a mount transport |
mountx/webdav | the WebDAV server and createWebdavServer(); this is not a mount transport |
The guide documents the three mountx/drivers/* subpaths next to the interface that they implement. See Built-in drivers.
The Transports section documents mountx/auto and the five transport subpaths. It also explains the protocols.
The package also installs the mountx command-line interface (CLI). The CLI is a demonstration and test tool. Its documentation is in the guide.
#The mountx root export
The root export contains the APIs on the five pages in this section. It does not include transport code. Therefore, import … from "mountx" loads only the types and a small set of functions.
| page | APIs |
|---|---|
| Driver interface | FsDriver, StatsLike, DirentLike, StatsFsLike, FileHandleLike, and the S_IF* bits |
| Capabilities | FsCapabilities, resolveCapabilities(), and the mountx.* extension namespace |
| Errors | fsError(), isFsError(), errnoOf(), ERRNO_CODES, and rangeError() |
| Loopback harness | createLoopback(), which runs a driver without a kernel |
| Paths and locking | normalizePath() and related helpers, plus PathLock |
#What to import
Use mountx/auto unless you must select a specific transport. It checks the host and returns the selected transport's mount object. The object includes a transport tag.
import { mount } from "mountx/auto";
import { createLoopback } from "mountx";
import { createMemoryDriver } from "mountx/drivers/memory";Each subpath loads only the code that it needs. mountx/auto loads a selected transport with await import(). Selecting FUSE does not load the 9P or NFS stack. The probe loads only three small host checks. It does not load a protocol codec.
Note
mount is intentionally not exported from the mountx root. If it were exported there, each import … from "mountx" would load the protocol layer, the session, and node:child_process. This adds about 90 kB. The transport must be selected separately in all cases.
#Type-level guarantees
Continuous integration (CI) checks these two TypeScript guarantees:
FsDriveris a subset ofnode:fs/promises.const driver: FsDriver = await import("node:fs/promises")must compile without a cast.AutoMountis a discriminated union. Checkmounted.transportto access all members for that transport. You do not need a cast or optional chaining.
#Platform support
| Linux | macOS | Windows | |
|---|---|---|---|
createLoopback | ✅ | ✅ | ✅ |
createNfsServer | ✅ | ✅ | ✅ |
createP9Server | ✅ | ✅ | ✅ |
createS3Server | ✅ | ✅ | ✅ |
mount (FUSE) | ✅ | — | — |
mount9p | ✅ root | — | — |
mountNfs | ✅ root | ✅ no root | — |
mount (auto) | ✅ FUSE, then 9P, then NFS | ✅ NFS | — |
createP9Server runs on every platform that supports Node. Only mount9p() requires Linux and root. mountx/nfs has the same separation between createNfsServer and mountNfs.
Most transport modules perform only data transformation and run on any platform. In mountx/fuse, this includes every file except mount.ts. In mountx/9p and mountx/nfs, it includes every file except server.ts and mount.ts. The server files are portable Node socket servers. Only the mount files have platform requirements.