Usage

emjs <script.js>    # run a file
emjs -h               # show help
emjs --help
emjs                  # interactive REPL (stdin)

Run a script

./build/emjs ./tests/script/types.js

Pipe input

printf '%s\n' '1+2' 'let x=5; x+1;' | ./build/emjs

Interactive REPL

When started without arguments, emjs enters interactive mode:

Extensions in CLI

The CLI binary binds extension modules at startup based on CMake build flags (BUILD_CONSOLE, BUILD_MATH, etc.), so console.log, Math, and JSON are available out of the box when enabled.

Install to PATH

cmake --install build --prefix /usr/local
export PATH="/usr/local/bin:$PATH"
emjs --help
For embedding Emjs in your own binary instead of using the CLI, see the C++ API page.