
# Reference

**Seven subpaths. Each loads only what it needs.**

| import from                                                     | what you get                                                         |
| --------------------------------------------------------------- | -------------------------------------------------------------------- |
| [`mountx/auto`](/transports/auto)                               | **start here** — `mount()`, which picks the transport for this host  |
| [`mountx`](#the-mountx-root-export)                             | the driver types, capabilities, errors, path helpers, loopback       |
| [`mountx/drivers/memory`](/guide/drivers/built-in#memory)       | a ready-made in-memory filesystem                                    |
| [`mountx/drivers/node-fs`](/guide/drivers/built-in#node-fs)     | a ready-made passthrough to a real folder                            |
| [`mountx/drivers/unstorage`](/guide/drivers/built-in#unstorage) | an adapter over any [unstorage](https://unstorage.unjs.io) `Storage` |
| [`mountx/fuse`](/transports/fuse)                               | the FUSE transport on its own, if you want to pin it                 |
| [`mountx/nfs`](/transports/nfs)                                 | the NFSv3 transport, and `createNfsServer()`                         |

The three `mountx/drivers/*` subpaths are documented in the guide, beside the interface they implement: [built-in drivers](/guide/drivers/built-in). `mountx/auto` and the two transport subpaths are documented in [Transports](/transports), beside the protocols they speak.

Plus the [`mountx` CLI](/guide/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](/reference/driver-interface) | `FsDriver`, `StatsLike`, `DirentLike`, `StatsFsLike`, `FileHandleLike`, the `S_IF*` bits |
| [Capabilities](/reference/capabilities)         | `FsCapabilities`, `resolveCapabilities()`, the `mountx.*` extension namespace            |
| [Errors](/reference/errors)                     | `fsError()`, `isFsError()`, `errnoOf()`, `ERRNO_CODES`, `rangeError()`                   |
| [Loopback harness](/reference/loopback)         | `createLoopback()` — the driver without a kernel                                         |
| [Paths and locking](/reference/paths)           | `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.

```ts
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

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