Skip to content

nodeRuntime

nodeRuntime(config?): Runtime

Defined in: packages/runtime/src/platform/node.ts:70

Create a Runtime pre-wired for Node.js.

NodeRuntimeConfig

Optional NodeRuntimeConfig. capabilities on the base RuntimeConfig can selectively override individual platform methods (e.g. a mock fetch for tests that still want the real importEsm).

Runtime

A Runtime bound to the current Node process.

Uses createNodeCapabilities under the hood, which binds to node:fs/promises.readFile, globalThis.fetch (undici, Node 18+), import(dataUri) for ESM evaluation, and WebAssembly.compile. Reuse a single runtime across many boots — it holds no per-boot state.

For browser hosts use browserRuntime; for tests use testRuntime.

import { Unix, stdSystem } from '@fishnet/core'
import { nodeRuntime } from '@fishnet/runtime'
const image = await Unix().use(stdSystem()).build()
await using sys = await nodeRuntime().boot(image)
await sys.boot()