Skip to main content

Language Selection

Auto-Detection

When no --language flag is provided, wasmrun detects the project language by checking for marker files:

FileDetected LanguageRuntime
package.jsonnodejsQuickJS (from wasmhub)
requirements.txtpythonRustPython (from wasmhub)
pyproject.tomlpythonRustPython (from wasmhub)
Cargo.tomlrustRust WASM runtime
go.modgoGo WASM runtime

Detection is checked in this order. The first match wins.

# Has package.json → detected as nodejs
wasmrun os ./my-node-app
# 🔍 Detected: nodejs project

# Has requirements.txt → detected as python
wasmrun os ./my-python-app
# 🔍 Detected: python project

If no marker files are found:

Could not auto-detect language for project: ./my-project
Please specify --language

Manual Override

Use -l or --language to force a specific language:

wasmrun os ./my-app --language nodejs
wasmrun os ./my-app -l python

Supported Values

ValueAliasesRuntime
nodejsnode, js, javascriptQuickJS
pythonpyRustPython
# All equivalent
wasmrun os ./app --language nodejs
wasmrun os ./app --language node
wasmrun os ./app --language js
wasmrun os ./app --language javascript

When to Override

Override is useful when:

  • The project has multiple language markers (e.g., both package.json and requirements.txt)
  • Auto-detection picks the wrong language
  • You want to test the same project with a different runtime
# Project has both package.json and requirements.txt
# Force Python
wasmrun os ./hybrid-project --language python

Runtime Fetching

Language runtimes are WASM binaries from wasmhub. They're fetched on first use and cached at ~/.wasmrun/runtimes/.

~/.wasmrun/runtimes/
├── quickjs.wasm # Node.js/JavaScript runtime
├── quickjs.wasm.sha256 # Checksum
├── rustpython.wasm # Python runtime
└── rustpython.wasm.sha256

Language Name Mapping

wasmrun maps detected language names to wasmhub runtime names:

Detected Languagewasmhub Runtime
nodejsquickjs
pythonrustpython
rustrust
gogo

Cache Management

Runtimes are cached indefinitely. To force a re-download:

# Remove cached runtime
rm ~/.wasmrun/runtimes/quickjs.wasm*

# Next run will re-fetch
wasmrun os ./my-app

Integrity

Every download is validated with a SHA-256 checksum. If a cached file is corrupted, wasmrun detects the mismatch and re-downloads automatically.

Runtime API

Check runtime status via the REST API:

# Get detected language and cache status
curl http://localhost:8420/api/runtimes
{
"detected_language": "nodejs",
"wasmhub_runtime": "quickjs",
"cached": true,
"cached_version": "0.1.4",
"available_languages": ["quickjs", "rustpython", "rust", "go"]
}
# Download the runtime binary directly
curl http://localhost:8420/api/runtime/nodejs -o runtime.wasm

See Also