Skip to main content

API Reference

txiki.js provides a comprehensive set of APIs for building applications. The global tjs namespace contains core functionality, while additional features are available as importable standard library modules.

Global APIs

The tjs global object provides the following groups of APIs:

  • Filesystem — File I/O, directory operations, path manipulation, and file watching.
  • Networking — TCP, UDP, and Unix pipe sockets for building network applications.
  • HTTP Server — High-performance HTTP server with WebSocket support via tjs.serve().
  • Process — Spawn child processes, handle signals, and manage the current process.
  • System — Environment variables, OS information, and runtime metadata.
  • Engine — Low-level access to the JavaScript engine: bytecode compilation, serialization, and garbage collection.
  • Utilities — Console helpers, error formatting, and interactive prompts.

Standard Library

Additional functionality is available as ES modules that can be imported using the tjs: scheme:

ModuleDescription
tjs:assertAssertion functions for testing
tjs:ffiForeign Function Interface for calling native libraries
tjs:getoptsCommand-line argument parsing
tjs:hashingCryptographic hash functions
tjs:ipaddrIP address parsing and manipulation
tjs:pathFile path utilities (POSIX and Windows)
tjs:posix-socketLow-level POSIX socket API
tjs:sqliteSQLite3 database
tjs:uuidUUID generation and validation
tjs:wasiWebAssembly System Interface

In addition, txiki.js supports many Web Platform APIs such as fetch, WebSocket, setTimeout, TextEncoder, and more.