Skip to content

Filesystem ​

Every sandbox has an isolated filesystem. Use sandbox.files when your application needs to exchange data with it without constructing shell commands.

The SDK can:

Paths are resolved inside the sandbox. Prefer absolute paths in application code so the result does not depend on a working directory.

The filesystem exists for the lifetime of the sandbox. Use pause and resume or snapshots when data must survive between runs.

See the SDK reference for the complete JavaScript, Python sync/async, and Go filesystem APIs.

User and Go options ​

The filesystem user option selects the home directory used to resolve paths such as ~ and the owner of newly created objects. It does not isolate filesystem RPCs by OS permissions. See the read and write example for working with a selected user's home directory.

In Go, all filesystem methods accept an options pointer as their final argument. Pass nil for defaults. Set FileOptions.User for reads and simple filesystem operations. Use ListFilesOptions for listing, WriteFileOptions for uploads and batch writes, WatchOptions for watches, and FileURLOptions for signed URLs.

Set listing depth with ListFilesOptions.Depth and signed URL expiration with FileURLOptions.Expiration. ReadTo takes the writer before the options.

See the Go filesystem API for method signatures.