Sandboxes.create(), never
constructed directly. Every method is safe to call concurrently except the lifecycle ones.
Properties
exec
Promise<ExecResult>. Runs the command through a shell and waits for all of it.
ExecOptions
ExecResult
writeFile
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
Promise<Buffer>. Also a host read.
exists
boolean. Synchronous, and does not read the file.
hostPath
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
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
Promise<void>. Immediate, no grace period.