Skip to main content

Documentation Index

Fetch the complete documentation index at: https://superradcompanyinc-mintlify-changelog-1777648095.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

See Filesystem for usage examples and extensible backends.

SandboxFs

Filesystem handle for a running sandbox. Obtained via sb.fs(). All operations go through the same host-guest channel as command execution — no SSH, no network involved. For bulk file operations, consider using volumes instead.
const fs = sandbox.fs();

await fs.write("/tmp/config.json", '{"debug": true}');
const content = await fs.readToString("/tmp/config.json");

copy()

copy(from: string, to: string): Promise<void>
Copy a file within the sandbox. Parameters
NameTypeDescription
fromstringSource path
tostringDestination path

copyFromHost()

copyFromHost(hostPath: string, guestPath: string): Promise<void>
Copy a file from the host machine into the sandbox. For transferring many files, consider a bind-mounted volume instead. Parameters
NameTypeDescription
hostPathstringPath on the host filesystem
guestPathstringDestination path inside the sandbox

copyToHost()

copyToHost(guestPath: string, hostPath: string): Promise<void>
Copy a file from the sandbox to the host machine. Parameters
NameTypeDescription
guestPathstringPath inside the sandbox
hostPathstringDestination path on the host

exists()

exists(path: string): Promise<boolean>
Check whether a path exists inside the sandbox. Parameters
NameTypeDescription
pathstringAbsolute path inside the guest
Returns
TypeDescription
Promise<boolean>true if the path exists

list()

list(path: string): Promise<FsEntry[]>
List the entries in a directory. Parameters
NameTypeDescription
pathstringAbsolute directory path inside the guest
Returns
TypeDescription
Promise<FsEntry[]>Directory entries

mkdir()

mkdir(path: string): Promise<void>
Create a directory. Parent directories must already exist. Parameters
NameTypeDescription
pathstringAbsolute directory path

read()

read(path: string): Promise<Uint8Array>
Read the entire contents of a file as raw bytes. Parameters
NameTypeDescription
pathstringAbsolute path inside the guest (e.g. "/app/config.json")
Returns
TypeDescription
Promise<Uint8Array>File contents as raw bytes

readStream()

readStream(path: string): Promise<FsReadStream>
Open a streaming reader for a file. Data is transferred in chunks of approximately 3 MiB each. Use this for files too large to fit in memory.
for await (const chunk of await fs.readStream("/var/log/syslog")) {
  process.stdout.write(chunk); // chunk is a Uint8Array
}
Parameters
NameTypeDescription
pathstringAbsolute path inside the guest
Returns
TypeDescription
Promise<FsReadStream>Async stream that yields chunks of file data

readToString()

readToString(path: string): Promise<string>
Read the entire contents of a file and decode as UTF-8. Parameters
NameTypeDescription
pathstringAbsolute path inside the guest
Returns
TypeDescription
Promise<string>File contents as a string

remove()

remove(path: string): Promise<void>
Remove a file. Parameters
NameTypeDescription
pathstringAbsolute file path

removeDir()

removeDir(path: string): Promise<void>
Remove a directory. Parameters
NameTypeDescription
pathstringAbsolute directory path

rename()

rename(from: string, to: string): Promise<void>
Rename or move a file or directory within the sandbox. Parameters
NameTypeDescription
fromstringCurrent path
tostringNew path

stat()

stat(path: string): Promise<FsMetadata>
Get detailed metadata for a file or directory. Parameters
NameTypeDescription
pathstringAbsolute path inside the guest
Returns
TypeDescription
Promise<FsMetadata>File metadata

write()

write(path: string, data: Uint8Array | string): Promise<void>
Write content to a file, creating it if it doesn’t exist and overwriting if it does. Parent directories must already exist. string payloads are encoded as UTF-8. Parameters
NameTypeDescription
pathstringAbsolute path inside the guest
dataUint8Array | stringFile content

writeStream()

writeStream(path: string): Promise<FsWriteSink>
Open a streaming writer for a file. Use for files too large to hold in memory; pair with await using so the sink closes itself.
await using sink = await fs.writeStream("/tmp/big.bin");
await sink.write(new Uint8Array(1 << 20));
Parameters
NameTypeDescription
pathstringAbsolute path inside the guest
Returns
TypeDescription
Promise<FsWriteSink>Streaming writer

Types

FsEntry

Metadata for a single directory entry, returned by list().
FieldTypeDescription
pathstringFile path
kindFsEntryKindType of entry
sizenumberFile size in bytes
modenumberUnix permission bits
modifiedDate | nullLast modified timestamp

FsEntryKind

type FsEntryKind = "file" | "directory" | "symlink" | "other";
ValueDescription
'file'Regular file
'directory'Directory
'symlink'Symbolic link
'other'Other entry type

FsMetadata

Detailed file metadata, returned by stat().
FieldTypeDescription
kindFsEntryKindType of entry
sizenumberFile size in bytes
modenumberUnix permission bits
readonlybooleanWhether the file is read-only
modifiedDate | nullLast modified timestamp
createdDate | nullCreation timestamp

FsReadStream

Async stream for reading a file in chunks. Obtained via readStream(). AsyncIterable<Uint8Array> and AsyncDisposable.
MethodReturnsDescription
recv()Promise<Uint8Array | null>Receive the next chunk. Returns null when the file has been fully read.
collect()Promise<Uint8Array>Drain the stream into a single buffer
[Symbol.asyncIterator]()AsyncIterator<Uint8Array>Use with for await...of
[Symbol.asyncDispose]()Promise<void>Stop reading; safe to use with await using

FsWriteSink

Streaming writer returned by writeStream(). AsyncDisposable.
MethodParametersDescription
write(data)Uint8Array | stringAppend a chunk
close()-Flush and close. Idempotent.
[Symbol.asyncDispose]()-Calls close()