Skip to main content

Provide a VSCode instance in a sandbox

Deno Sandbox 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.exposeVscode() 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.exposeVscode();

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

For more information, see the Deno Sandbox documentation.

Did you find what you needed?

Privacy policy