Modules, Runtime & Tooling

Node.js Runtime & Evented I/O

Node.js runs JavaScript outside the browser and provides host APIs for files, networking, processes, diagnostics, packages, and server-side execution. Its I/O model is evented: many operations are asynchronous so the process can keep handling other work.
  • Node is a runtime, not the language
  • Evented I/O keeps one process responsive
  • CPU-heavy JavaScript still blocks the event loop
  • Node has browser-like APIs but not a browser environment
  • Operational Node code needs runtime discipline
Node runtime layers
The language is only one layer; Node adds runtime APIs and OS integration.
Async file I/O
import { readFile } from "node:fs/promises"

export async function readConfig(path: string) {
  const text = await readFile(path, "utf8")
  return JSON.parse(text) as unknown
}
The file operation is asynchronous; parsing is synchronous and can still throw.
Node vs language concepts
ConceptOwned byExample
Syntax and semanticsECMAScriptlet, class, Promise, modules
EngineV8Parses and executes JavaScript
Runtime APIsNodefs, process, Buffer, streams
Package toolingNode/npm ecosystemnpm scripts, node_modules
OS integrationHost systemsignals, sockets, files
Sources
  • Node.js Documentation and Learn Node.jsIntroduction to Node.js; asynchronous work; diagnostics
  • MDN JavaScript Guide and ReferenceJavaScript modules
  • The Modern JavaScript TutorialModules