Documentation Index
Fetch the complete documentation index at: https://hyperbrowser.ai/docs/llms.txt
Use this file to discover all available pages before exploring further.
Use the local filesystem API to inspect paths, read and write content, and manage files and directories inside a running sandbox.
Read And Write Files
await sandbox.files.writeText("/tmp/hello.txt", "hello from sandbox");
const text = await sandbox.files.readText("/tmp/hello.txt");
const bytes = await sandbox.files.readBytes("/tmp/hello.txt");
console.log(text);
console.log(bytes.toString("utf8"));
Batch writes are also supported:
await sandbox.files.write([
{ path: "/tmp/a.txt", data: "alpha" },
{ path: "/tmp/b.bin", data: Buffer.from([1, 2, 3]) },
]);
Use read() when you want to control offset, length, or representation.
Supported formats include:
List And Inspect Paths
const exists = await sandbox.files.exists("/tmp/hello.txt");
const info = await sandbox.files.getInfo("/tmp/hello.txt");
const entries = await sandbox.files.list("/tmp", { depth: 1 });
console.log(exists);
console.log(info.permissions, info.owner, info.group);
console.log(entries.map((entry) => entry.path));
Move, Copy, Remove, And Update Permissions
await sandbox.files.makeDir("/tmp/data", { parents: true });
await sandbox.files.writeText("/tmp/data/source.txt", "payload");
await sandbox.files.copy({
source: "/tmp/data/source.txt",
destination: "/tmp/data/copied.txt",
});
await sandbox.files.rename("/tmp/data/copied.txt", "/tmp/data/renamed.txt");
await sandbox.files.chmod({ path: "/tmp/data/renamed.txt", mode: "0644" });
await sandbox.files.remove("/tmp/data/source.txt");
Behavior Notes
The current filesystem implementation has a few practical guarantees worth knowing:
remove is idempotent for missing paths.
- Removing a symlink removes the link, not the target.
- Directory listings do not recurse through symlink loops.
- Recursive copies preserve symlinks instead of expanding them indefinitely.