JavaScript
Execute JavaScript or TypeScript in a secure and isolated sandbox
This page is about the JavaScript interpreter environment inside the Riza Code Interpreter API. If you’re looking to call the API from Node, see the API Client Libraries guide.
Runtime
Our JavaScript engine is powered by Boa. TypeScript transpilation is handled automatically via swc.
Limitations
We inherit all the limitations of the Boa JavaScript engine, and in particular our interpreter is not Node or Deno. We are working on supplementing the Boa environment with node-compatible objects.
See our roadmap for planned future improvements.
Output
You can write to stdout
and stderr
with the typical console
functions. Directly
writing to process.stdout
or process.stderr
will not work, as both are undefined
.
Input
You can read from process.stdin
, process.argv
and process.env
to get input data.
Note that process.stdin
is just a string, not a stream as it is in Node.
HTTP
You can make HTTP requests using fetch
.
Network access is blocked by default, so you need to allow HTTP traffic to
individual hosts using the allow_http_hosts
parameter. See the HTTP
guide for a full example.
Libraries
JSON
Both JSON.stringify()
and JSON.parse()
are available.