{ } qjs-modules

qjs-modules — API Reference

This directory contains comprehensive API documentation for qjs-modules.

Structure

The documentation is organized into three categories:

  • native/ — Native C modules (quickjs-*.c). These are the primary implementations for modules that have native bindings.
  • js/ — Pure JavaScript modules (lib/*.js). These are either polyfills for standard APIs or wrappers around native modules.
  • Root files — General documentation (README, grammar, api-compatibility)

Module Classification

  1. Native modules (in native/): Direct C implementations exposed to JavaScript

    • Examples: blob, stream, dom, fs, process, child-process, sockets
  2. JavaScript polyfills (in js/): Standalone JS implementations of standard APIs

    • Examples: events, url, timers, console (WHATWG/W3C/HTML5 standards)
    • Some polyfills also have native counterparts (deep, misc, pointer, predicate, xml) — documented in native/
  3. JavaScript wrappers (in js/): JS code that wraps native modules to provide higher-level APIs

    • Examples: assert, fsPromises, util, dom (wraps native modules with JS convenience)
  4. Prototype extensions (in js/): Extend built-in JavaScript prototypes

    • Examples: extendArray, extendString, extendObject, etc.

Documentation Index

Native Modules (native/)

See native/README.md for the complete list of native C modules.

Key modules:

  • blob — WHATWG Blob API
  • stream — WHATWG Streams API
  • dom — W3C DOM API
  • child-process — Node.js child_process
  • sockets — BSD sockets
  • deep — Deep object comparison and cloning
  • inspect — Object inspection and formatting
  • wasm — WebAssembly JS API over wasm3 or WAMR

JavaScript Modules (js/)

See js/README.md for the complete list of JavaScript modules.

Key modules:

  • events — Node.js EventEmitter
  • url — WHATWG URL API
  • timers — HTML5 Timers API
  • console — WHATWG Console API
  • assert — Node.js assert module
  • fs — Node.js fs module
  • fsPromises — Promise-based fs API (also fs/promises)
  • webassembly — the WebAssembly global (opt-in)
  • loaders/wasm — .wasm ES module loader (opt-in)
  • wasi — node:wasi (WASI preview1), portable across qjsm, node, bun, deno
  • globals — opt-in web/Node globals (URL, structuredClone, crypto, ...)
  • jsonStreams — Deno's JsonParseStream, ConcatenatedJsonParseStream, JsonStringifyStream
  • readline — Node's readline
  • readlinePromises — readline/promises
  • string_decoder — Node's string_decoder (StringDecoder)
  • textLineStream — Deno's TextLineStream
  • timersPromises — timers/promises

API Compatibility

See api-compatibility.md for:

  • Classification of all modules by standard compliance
  • Standards compatibility tracking (WHATWG, W3C, Node.js, etc.)
  • Roadmap for improving standards compliance

Per-module studies of json and xml (comparison with Browser/Bun/Node/Deno and packages, how the implementation is split into include/ + src/ pieces, and the interfaces between them):

General Documentation

Export lists

The last section of every module page, "Export list", is generated from the running qjsm and rewritten by utilities/doc-api.js:

utilities/api-surface.sh -m "$PWD/lib;$PWD/build/$(cc -dumpmachine)" -o /tmp/surface
qjsm utilities/doc-api.js /tmp/surface .

Text above the "Export list" heading is written by hand.