Skip to main content

Provide a VSCode instance in a sandbox

Deno Sandboxes provide a sandboxed environment for evaluating JavaScript code. This is useful for evaluating code that is not trusted or for testing code that is not safe to run in the main runtime.

The sandbox.vscode() method can be used to provide a VSCode instance in a sandbox.

This example shows how to start a VSCode instance in a sandbox and print the url of the running instance which you can then open in your browser.

import { Sandbox } from "@deno/sandbox";

await using sandbox = await Sandbox.create();

// Start a VSCode instance
const vscode = await sandbox.vscode();

console.log(vscode.url); // print the url of the running instance
await vscode.status; // wait until it exits

For more information about Sandboxes, see the Sandboxes documentation.

Did you find what you needed?

Privacy policy