SDK

Node fast path

Booting V8 is the slow part of running Node. NodeRuntime boots it once, snapshots it, and restores that snapshot for each subsequent run — isolated and fast.

Warm up, then run

javascript
const rt = nano.nodeRuntime();
await rt.warmup();                 // boot V8 once, snapshot it
await rt.run("console.log(2 + 2)"); // fast restore
await rt.run("console.log(Date.now())");

warmup() boots V8 and captures a snapshot; each run() restores it, so runs are isolated and don't see each other's mutations.

Per-run inputs

javascript
await rt.run("const d = require('fs').readFileSync('/tmp/in.json');", {
  extraFiles: [{ path: "/tmp/in.json", content: '{"value":42}' }],
});

Reset

reset() drops the snapshot; the next run re-warms. isWarm tells you the current state.

After a warm restore the exit code is unreliable — V8's platform thread aborts after output. Check stdout, not exitCode.