Upload files and directories
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.
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", ".");
For more information, see the Deno Sandbox documentation.