Skip to content

Classes

Filesystem

sbx.files: the sandbox filesystem. Relative paths resolve against /work.

new Filesystem(sbx): Filesystem

Sandbox

Filesystem

download(remotePath, localPath): Promise<void>

Copy a file from the sandbox, creating local parent directories.

string

string

Promise<void>


downloadDir(remoteDir, localDir): Promise<void>

Copy a directory tree from the sandbox into localDir. Nothing is written outside it: absolute names and “..” are refused, an entry is never written through a symbolic link, and a link that leads outside localDir (directly or through other links) is removed and reported as an error.

string

string

Promise<void>


exists(path): Promise<boolean>

Whether a path exists (a dangling symlink counts).

string

Promise<boolean>


getInfo(path): Promise<EntryInfo>

Describe a path without following a final symlink.

string

Promise<EntryInfo>


list(path?): Promise<EntryInfo[]>

Entries of a directory (one level), sorted by name.

string = "."

Promise<EntryInfo[]>


makeDir(path): Promise<boolean>

Create a directory and its parents. Resolves false if it already existed.

string

Promise<boolean>


read(path, opts?): Promise<string>

A file’s contents as text (default), bytes or a Blob. Rejects with FileNotFoundError if missing.

string

"text"

Promise<string>

read(path, opts): Promise<Uint8Array<ArrayBufferLike>>

A file’s contents as text (default), bytes or a Blob. Rejects with FileNotFoundError if missing.

string

"bytes"

Promise<Uint8Array<ArrayBufferLike>>

read(path, opts): Promise<Blob>

A file’s contents as text (default), bytes or a Blob. Rejects with FileNotFoundError if missing.

string

"blob"

Promise<Blob>


remove(path): Promise<void>

Delete a file or directory tree. Rejects with FileNotFoundError if missing.

string

Promise<void>


rename(oldPath, newPath): Promise<EntryInfo>

Move a file or directory (creating the destination’s parents); describes the result.

string

string

Promise<EntryInfo>


upload(localPath, remotePath): Promise<WriteInfo>

Copy a local file into the sandbox (keeping its permission bits).

string

string

Promise<WriteInfo>


uploadDir(localDir, remoteDir): Promise<void>

Copy a local directory tree into remoteDir (created if missing) as one tar. Symlinks are copied as links; files are owned by root.

string

string

Promise<void>


write(path, data): Promise<WriteInfo>

Create or replace a file atomically (mode 0644), creating parent directories; any size works (over 15 MiB is staged in pieces). With an array, writes several files in one upload.

string

string | ArrayBuffer | Uint8Array<ArrayBufferLike> | Blob

Promise<WriteInfo>

write(files): Promise<WriteInfo[]>

Create or replace a file atomically (mode 0644), creating parent directories; any size works (over 15 MiB is staged in pieces). With an array, writes several files in one upload.

WriteEntry[]

Promise<WriteInfo[]>


writeFiles(files): Promise<WriteInfo[]>

Write several files in one upload, creating parent directories.

WriteEntry[]

Promise<WriteInfo[]>