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
Native modules (in
native/): Direct C implementations exposed to JavaScript- Examples: blob, stream, dom, fs, process, child-process, sockets
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/
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)
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
WebAssemblyglobal (opt-in) - loaders/wasm —
.wasmES 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):
| json | xml | path | |
|---|---|---|---|
| comparison | api-compare-json.md | api-compare-xml.md | api-compare-path.md |
| implementation split | api-implement-json.md | api-implement-xml.md | api-implement-path.md |
| interfaces | api-interface-json.md | api-interface-xml.md | api-interface-path.md |
General Documentation
- grammar.md — JavaScript grammar specification
- runtime-compat.md — how much of Node's, Bun's and Deno's surface qjsm has, member counts per module and global
- qjsm.md — the
qjsminterpreter - qjsm-layout.md — working document: a configurable, reported module layout and build info for qjsm
- api-event-model.md — the source/sink event model of the json and xml engines
- event-model-state.md — where the event model stands
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.