Skip to main content
Obtained from Sandboxes.create(), never constructed directly. Every method is safe to call concurrently except the lifecycle ones.

Properties

exec

Returns Promise<ExecResult>. Runs the command through a shell and waits for all of it.
A non-zero exit resolves; it does not throw. See running commands.

ExecOptions

ExecResult

writeFile

Returns Promise<void>. Writes into the workspace — a host write, because the workspace is a bind mount. Parent directories are created. data is a Buffer or a string. Paths may include the /workspace prefix or omit it.

readFile

Returns Promise<Buffer>. Also a host read.

exists

Returns boolean. Synchronous, and does not read the file.

hostPath

Returns string — a workspace path as a path on the host. Traversal is refused, not normalised. A path containing a .. segment throws SandboxError("refused") before normalising, and the result is checked for containment afterwards as well. See the workspace.

stop

Returns Promise<void>. Stops the sandbox, leaving it able to be started again, and keeps the workspace. Returns once the engine agrees it has stopped — not when the signal was sent. graceMs defaults to the instance’s stopGraceMs.

kill

Returns Promise<void>. Immediate, no grace period.