mountx logomountx

Entry Points

#Reference

Seven subpaths. Each loads only what it needs.

import fromwhat you get
mountx/autostart heremount(), which picks the transport for this host
mountxthe driver types, capabilities, errors, path helpers, loopback
mountx/drivers/memorya ready-made in-memory filesystem
mountx/drivers/node-fsa ready-made passthrough to a real folder
mountx/drivers/unstoragean adapter over any unstorage Storage
mountx/fusethe FUSE transport on its own, if you want to pin it
mountx/nfsthe 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.

pagewhat is on it
Driver interfaceFsDriver, StatsLike, DirentLike, StatsFsLike, FileHandleLike, the S_IF* bits
CapabilitiesFsCapabilities, resolveCapabilities(), the mountx.* extension namespace
ErrorsfsError(), isFsError(), errnoOf(), ERRNO_CODES, rangeError()
Loopback harnesscreateLoopback() — the driver without a kernel
Paths and lockingnormalizePath() 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:

  • FsDriver is a subset of node:fs/promises. The acid test is const driver: FsDriver = await import("node:fs/promises"), which must compile with no cast.
  • AutoMount is a discriminated union. Narrowing on mounted.transport reaches everything that transport has, with no cast and no optional chaining.

#Platform support

LinuxmacOSWindows
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.

mountx logo

mountx  Write a filesystem in JavaScript, mount it as a real folder.