NodeAmiga — JavaScript runtime for AmigaOS

Version: 0.21.0  ·  Target: AmigaOS 2.0+ (MC68000 and up)  ·  Requires: 1 MB RAM, optionally bsdsocket.library for networking.

NodeAmiga is a Node.js-inspired JavaScript runtime written from scratch in C for classic Amigas. It lets you write programs in modern JavaScript and run them directly under AmigaOS — no cross-compiler needed. This guide describes what's available to you as an author of scripts.

Author: Juen / Project R3D + Appendix + Nah-Kolor (biuro@cdlabel.info)  ·  Docs: http://juen.in/NodeAmiga/  ·  Aminet: dev/lang/NodeAmiga.lha

Quick start

NodeAmiga hello.js           ; run a script file
NodeAmiga -e "console.log(2+2)"   ; one-liner
NodeAmiga                    ; interactive REPL

What's in this guide

SectionWhat you'll find
Global API Everything you can use without require()console, Math, JSON, Date, Promise, Buffer, fetch, setTimeout, typed arrays, Map/Set, regular expressions, and the process object.
Modules Everything you load with require('name'): standard-library modules (fs, http, net, path, url, buffer, os, events, stream, util, zlib, crypto, assert, querystring, readline, dns, timers, string_decoder, punycode) and Amiga-specific modules (gui, intuition, clipboard, arexx, amiga FFI, iff).
Examples The 44 demo scripts shipped in examples/, grouped by topic. For each one: what it demonstrates and which modules it touches.
Limitations & gotchas Where NodeAmiga differs from Node.js on a PC: language features that aren't supported, modules that return stubs, performance gotchas, and Amiga-specific quirks you should know about.

What JavaScript you can write

NodeAmiga supports the most useful subset of modern JavaScript:

See Limitations for what's NOT supported.

Two execution modes

NodeAmiga has two interchangeable JavaScript engines:

You rarely need to care which one runs your code. Use --tree on the command line if you want to force the tree-walker.

Packaging your script as a standalone executable

NodeAmiga can bundle your script plus any require()d files into a single executable that runs without the NodeAmiga binary beside it:

NodeAmiga -compile myapp.js MyApp

The resulting MyApp includes the NodeAmiga runtime plus your script bundled in a "NAJE" footer. Double-click it from Workbench, drop it on Aminet, or redistribute it freely.

Command-line reference

NodeAmiga                       ; interactive REPL
NodeAmiga script.js             ; run a file
NodeAmiga script.js arg1 arg2   ; with arguments (in process.argv)
NodeAmiga -e "code"             ; evaluate a string
NodeAmiga --ast script.js       ; print the parsed AST (for debugging)
NodeAmiga --tree script.js      ; force the tree-walker (no VM)
NodeAmiga --debug script.js     ; step-debugger; see below
NodeAmiga -compile in.js out    ; bundle into a standalone exe
NodeAmiga -v / -help             ; show version / usage

Inside --debug you get an interactive prompt with commands s (step), n (next), c (continue), o (out), b N (set breakpoint at line N), d N (delete breakpoint), l (list source), p expr (print variable), bt (backtrace), q (quit), h (help).

REPL features

When you run NodeAmiga with no arguments you get an interactive prompt. It supports: