Upload files and directories
Deno Sandbox provides a sandboxed Linux microVM. This is useful for evaluating code that is not trusted or for testing code that is not safe to run in your main runtime.
Copy files from your machine into the sandbox using
sandbox.fs.upload(localPath, sandboxPath).
import { Sandbox } from "@deno/sandbox";
await using sandbox = await Sandbox.create();
// Upload a single file to a specific path in the sandbox
await sandbox.fs.upload("./README.md", "./readme-copy.md");
// Upload a local directory tree into the sandbox current directory
await sandbox.fs.upload("./my-project", ".");
Uploading files or entire directories with sandbox.fs.upload() lets you bring
your local artifacts into the sandbox environment before running commands there.
This is useful when your workflow depends on existing source folders,
configuration files, or test data—once uploaded, the sandbox can compile, test,
or process them without remote Git access or manual copy/pasting.
For more information, see the Deno Sandbox documentation.