# Node.js compatibility

> Which Node modules are Stable, what each contract covers, and what stays out.

HTML: https://amberjs.com/docs/node-compat · Index for agents: https://amberjs.com/llms.txt

Amber is not a drop-in Node.js replacement. Each module below is Stable only for the methods named in its contract. Everything else in `src/nodejs_core/` is Preview. For a searchable view, use the [compatibility page](https://amberjs.com/compatibility.md).

## Modules and loading

| API | Id | Notes |
| :--- | :--- | :--- |
| CommonJS `require`, `module.exports`, `require.resolve`, `createRequire` | G28 (provisional) | `node_modules` walk, `"exports"` / `"imports"` / `"main"`, JSON, TS, and ESM via `require`. No `require.cache`; resolve errors have no `code`. |
| `node:` and bare builtin names | G28 | Loading a builtin does not make its whole API Stable. |

## File system and paths

| API | Id | Notes |
| :--- | :--- | :--- |
| `fs`, `fs/promises` | G8 | Byte read and write, `mkdir`, `stat`, `copyFile`, `rm`, `realpath`, fds, `chmod`, `access`, `existsSync`, `readdir` dirents, system errors. Async work runs on the isolate thread at the next tick. |
| `fs.watch`, `fs.watchFile` | G64 (tentative) | Real OS watcher and stat polling. No `fs.promises.watch`. |
| `path` | G17 | POSIX semantics. `path.win32` only changes `sep` and `delimiter`. |

`fs.glob`, `fs.cp`, `fs.opendir`, and `fs.statfs` are not implemented.

## Core utilities

| API | Id | Notes |
| :--- | :--- | :--- |
| `events` (`EventEmitter`) | G18 | No `events.on` async iterator. |
| `buffer` / `Buffer` | G19 | `from`, `alloc`, `concat`, `byteLength`, `toString`, `slice`. `compare` and `readUInt*` are outside the pin. |
| `util` | G22, G59 | `format`, shallow `inspect`, `promisify`, `callbackify`, `inherits`, listed `util.types`. |
| `process` | G22, G44, G53, G54 | `nextTick`, `env`, `cwd`, `pid`, `platform`, `stdout.write`, `hrtime`, `memoryUsage`. Heap fields are estimates; `process.on` / `off` are no-ops and not Stable. |
| `os` | G20, G62, G63 | Host info, `hostname`, real `networkInterfaces`. |
| `querystring` | G38 | Fixed `&` and `=` separators. |
| `string_decoder` | G39, G68 | UTF-8 plus latin1, ascii, base64, hex, utf16le. No `base64url`. |
| `assert` | G40, G69 | `ok`, `strictEqual`, `deepStrictEqual`, `throws`, `match`, `rejects`, and a few more. Loose `equal` semantics are not pinned. |
| `timers`, `timers/promises` | G42, G50 | Same functions as the globals; Promise `setTimeout` and `setImmediate` with `AbortSignal`. |
| `tty.isatty` | G49 | Always `false` on Windows today. |
| `vm` | G55, G66 (tentative) | `runInThisContext` and `runInNewContext`. Not full Contextify. |
| `diagnostics_channel` | G56 (tentative) | `channel` pub/sub and `tracingChannel.traceSync`. |
| `async_hooks` | G57 (tentative) | `AsyncResource` and `AsyncLocalStorage`. No `createHook`. |
| `readline` | G46 (tentative) | `question()` on host stdin and stdout only. |

## Crypto and compression

| API | Id | Notes |
| :--- | :--- | :--- |
| `crypto` hashes and random | G23 | `createHash`, `createHmac` (md5, sha1, sha256, sha384, sha512, blake3), `randomBytes`, `randomUUID`, `timingSafeEqual`. Returns `Uint8Array`. |
| `crypto` AES ciphers | G43, G51, G52 | `createCipheriv` / `createDecipheriv` for AES-CBC, AES-GCM, and AES-CTR. |
| `zlib` | G21, G48, G58 | Sync and callback gzip, deflate, and raw deflate. |

KDF, sign and verify, key pairs, `KeyObject`, brotli, and streaming `createGzip` are not Stable.

## Processes and networking

| API | Id | Notes |
| :--- | :--- | :--- |
| `child_process` sync | G25 | `execSync`, `spawnSync`. `pid` is `0`. |
| `child_process` async | G47, G60, G67 | `exec`, `execFile`, `spawn` with captured output, and `fork` with JSON IPC. No live stdio pipes. |
| `http` server | G37 (tentative) | `createServer`, `listen`, buffered responses, keep-alive. |
| `net` server and client | G45, G61 (tentative) | `createServer` listen and accept; `net.connect` client. |
| `dns` | G27, G65 | `lookup`, `resolve*`, `reverse`, `getServers` from the OS resolver. |
| `url` | G26 | POSIX `fileURLToPath` and `pathToFileURL`. Legacy `parse` is outside. |
| `stream` | G24 | `Readable`, `Writable`, `PassThrough`. No `Transform`, `Duplex`, or `pipeline`. |

## Not supported

These fail or reject instead of pretending to work:

- `http.request`, `http.get`, `http.Agent`, the `https` module, and `http2`.
- Streaming `zlib.createGzip` family, brotli, and `zlib.constants`.
- Node native addons beyond the Experimental N-API hello loader.

## Conformance

The Node conformance scorecard in `tests/conformance/` is 56/56 on main. See [Stability levels](https://amberjs.com/docs/stability.md) for what that number does and does not mean.


---

Status labels and limits: [Compatibility](https://amberjs.com/compatibility.md) · [Docs index](https://amberjs.com/docs.md) · [Overview](https://amberjs.com/index.md)
