Entry Points
#Reference
Seven subpaths. Each loads only what it needs.
| import from | what you get |
|---|---|
mountx/auto | start here — mount(), which picks the transport for this host |
mountx | the driver types, capabilities, errors, path helpers, loopback |
mountx/drivers/memory | a ready-made in-memory filesystem |
mountx/drivers/node-fs | a ready-made passthrough to a real folder |
mountx/drivers/unstorage | an adapter over any unstorage Storage |
mountx/fuse | the FUSE transport on its own, if you want to pin it |
mountx/nfs | the NFSv3 transport, and createNfsServer() |
The three mountx/drivers/* subpaths are documented in the guide, beside the interface they implement: built-in drivers. mountx/auto and the two transport subpaths are documented in Transports, beside the protocols they speak.
Plus the mountx CLI, which the package installs as a binary — a demo and a test bench, documented in the guide.
#The mountx root export
Everything that is not a transport, over the five pages of this section. No transport code is reachable from here, so import … from "mountx" costs nothing but the types and a few small functions.
| page | what is on it |
|---|---|
| Driver interface | FsDriver, StatsLike, DirentLike, StatsFsLike, FileHandleLike, the S_IF* bits |
| Capabilities | FsCapabilities, resolveCapabilities(), the mountx.* extension namespace |
| Errors | fsError(), isFsError(), errnoOf(), ERRNO_CODES, rangeError() |
| Loopback harness | createLoopback() — the driver without a kernel |
| Paths and locking | normalizePath() and friends, PathLock |
#What to import
mountx/auto is the one to reach for unless you have a reason not to. It works out what this host can mount with and hands back that transport's own mount object, tagged.
import { mount } from "mountx/auto";
import { createLoopback } from "mountx";
import { createMemoryDriver } from "mountx/drivers/memory";Each subpath loads only what it needs. mountx/auto reaches a transport through await import(), so choosing FUSE never loads the NFS stack — and its probe reaches only the two cheap host checks, neither of which pulls in a protocol codec.
Note
mount is deliberately not re-exported from the root mountx. Doing so would pull the protocol layer, the session and node:child_process into every import … from "mountx" — around 90 kB — for a name that has to be chosen between transports anyway.
#Type-level guarantees
Two rules the type system holds, and both are checked in CI:
FsDriveris a subset ofnode:fs/promises. The acid test isconst driver: FsDriver = await import("node:fs/promises"), which must compile with no cast.AutoMountis a discriminated union. Narrowing onmounted.transportreaches everything that transport has, with no cast and no optional chaining.
#Platform support
| Linux | macOS | Windows | |
|---|---|---|---|
createLoopback | ✅ | ✅ | ✅ |
createNfsServer | ✅ | ✅ | ✅ |
mount (FUSE) | ✅ | — | — |
mountNfs | ✅ root | ✅ no root | — |
mount (auto) | ✅ FUSE | ✅ NFS | — |
Everything in mountx/fuse except mount.ts, and everything in mountx/nfs except server.ts/mount.ts, is pure data transformation and runs anywhere.