Ant runtime object, a Node.js-compatible process, standard Web APIs like fetch and crypto, and familiar timer functions. This page documents everything available at the top level of your scripts.
The Ant object
The Ant global exposes runtime metadata and a handful of utilities. It is always available — you never need to import it.
Runtime properties
The runtime version string, set at build time (e.g.
"0.1.0").The build target platform (e.g.
"x86_64-linux").The git hash of the build, useful for bug reports and diagnostics.
The build timestamp as an ISO string.
The host OS type (e.g.
"linux", "macos", "windows").Ant.typeof(value)
Ant.typeof gives you a more detailed type name than JavaScript’s built-in typeof. It distinguishes between arrays, promises, generators, and several runtime-internal types that typeof collapses to "object" or "function".
Returns a string type name for
value. Possible values:| Return value | Description |
|---|---|
'object' | Plain object |
'string' | String primitive |
'array' | Array instance |
'function' | JS function |
'cfunc' | Native C function |
'promise' | Promise instance |
'generator' | Generator object |
'undefined' | undefined |
'null' | null |
'boolean' | Boolean primitive |
'number' | Number primitive |
'bigint' | BigInt primitive |
'symbol' | Symbol primitive |
'err' | Error object |
'typedarray' | Typed array (e.g. Uint8Array) |
'ffi' | FFI handle |
'ntarg' | Native argument object |
Ant.inspect(...args)
Ant.inspect is an alias for console.inspect. It pretty-prints values to stdout, showing the full structure of objects and arrays.
The process global
Ant provides a Node.js-compatible process global. It is populated by the runtime before your script runs.
Version and compatibility
Node.js compatibility version string (
"v25.9.0"). Present for compatibility with modules that check process.version.Versions of all embedded libraries. Keys include:
ant, node, brotli, llhttp, nghttp2, simdjson, pcre2, libffi, lmdb, utf8proc, zlib, v8, uv, modules, napi, wamr, boringssl.Feature flags for the runtime:
uv: true— libuv event loop is activetls: 'BoringSSL'— TLS providertypescript: 'transform'— TypeScript is stripped at load time
Process utilities
Command-line arguments.
argv[0] is "ant", argv[1] is your script path.Environment variables as key-value strings.
The operating system platform (e.g.
"linux", "darwin", "win32").Returns the current working directory as a string.
Exits the process. Optional exit code defaults to
0.Web standard globals
Ant includes a comprehensive set of Web APIs at the global scope, matching what browsers and WinterTC-compliant runtimes expose.Network
| Global | Description |
|---|---|
fetch(url, init?) | WinterTC-compatible HTTP client. See the fetch page. |
Request | Represents an HTTP request. |
Response | Represents an HTTP response. |
Headers | HTTP headers collection. |
URL handling
| Global | Description |
|---|---|
URL | WHATWG URL parser. |
URLSearchParams | Query string builder and parser. |
Text encoding
| Global | Description |
|---|---|
TextEncoder | Encodes strings to Uint8Array (UTF-8). |
TextDecoder | Decodes Uint8Array back to a string. |
Timers
| Global | Description |
|---|---|
setTimeout(fn, ms) | Calls fn once after ms milliseconds. |
setInterval(fn, ms) | Calls fn repeatedly every ms milliseconds. |
clearTimeout(id) | Cancels a setTimeout. |
clearInterval(id) | Cancels a setInterval. |
Async utilities
| Global | Description |
|---|---|
Promise | Standard ES Promise. |
queueMicrotask(fn) | Schedules fn in the microtask queue. |
structuredClone(value) | Deep-clones a value using the structured clone algorithm. |
Cryptography
crypto exposes the Web Crypto API as a global. See the crypto page for full details.
Storage
| Global | Description |
|---|---|
localStorage | Persistent key-value storage (survives process restart). |
sessionStorage | In-memory key-value storage (cleared on exit). |
WebAssembly
WebAssembly is available globally. Ant uses the WAMR (WebAssembly Micro Runtime) engine.
Module meta
When running a file directly, Ant sets two convenience globals:| Global | Description |
|---|---|
__dirname | Directory of the current file (absolute path). |
__filename | Full path of the current file. |
console
The console global matches the browser interface with one addition — console.inspect for structured pretty-printing.
| Method | Description |
|---|---|
console.log(...args) | Logs to stdout. |
console.error(...args) | Logs to stderr. |
console.warn(...args) | Logs a warning to stderr. |
console.info(...args) | Logs informational output. |
console.debug(...args) | Logs debug output. |
console.inspect(...args) | Pretty-prints values with full structure. |