sbx.Files is the *Filesystem sub-object available on every Sandbox instance. All paths must be absolute paths within the sandbox filesystem.
sbx.Files.Read()
Read a file as a UTF-8 string from the sandbox.
string
required
Absolute path inside the sandbox.
string
default:"server default"
Unix user context for file operations. Server defaults to
"user" when not specified.(string, error)
sbx.Files.ReadBytes()
Read a file as raw bytes.
([]byte, error)
sbx.Files.Write()
Write a UTF-8 string to a file. Creates parent directories automatically.
string
required
Absolute path inside the sandbox.
string
required
Content to write.
(*WriteInfo, error)
sbx.Files.WriteBytes()
Write raw bytes to a file. Uses the binary-safe PUT /files/raw endpoint.
(*WriteInfo, error)
sbx.Files.WriteFiles()
Write multiple files in a single batch request. More efficient than calling Write() in a loop.
Data must be a string. Use WriteBytes for binary data.
[]WriteEntry
required
List of
WriteEntry values. Each has Path (string) and Data (string).error
sbx.Files.List()
List the contents of a directory.
string
required
Absolute path to the directory.
([]EntryInfo, error)
sbx.Files.Exists()
Check whether a file or directory exists.
(bool, error)
sbx.Files.GetInfo()
Get metadata about a single file or directory.
(*EntryInfo, error)
sbx.Files.Remove()
Remove a file or directory.
error
sbx.Files.Rename()
Rename or move a file or directory.
error
sbx.Files.MakeDir()
Create a directory (including parent directories if needed).
error
sbx.Files.Watch()
Not yet implemented. Returns an error until server-side streaming support is available.
*WatchHandle with an events channel.