Files
Read, write, upload, download and watch files in a sandbox.
Every method shows the same operation in each SDK; pick a language once and every tab on the site follows it.
FileClient
Section titled “FileClient”Authenticated FilesystemService client bound to one sandbox.
list()
Section titled “list()”def list(self, path: str, *, depth: int=1, user: str | None=None) -> list[FileInfo]| Parameter | Type | Default |
|---|---|---|
path |
str |
|
depth |
int |
1 |
user |
str | None |
None |
Returns list[FileInfo]
sdk/python/svm/files.py:122async list(path: string, depth = 1, options: FileOptions = {}): Promise<FileInfo[]>| Parameter | Type | Default |
|---|---|---|
path |
string |
|
depth |
number |
1 |
options |
FileOptions |
{} |
Returns Promise<FileInfo[]>
sdk/typescript/src/files.ts:28func (f *FileClient) List(ctx context.Context, path string, depth uint32, options ...FileOption) ([]FileInfo, error)List returns directory entries at depth 1..8.
| Parameter | Type | Default |
|---|---|---|
ctx |
context.Context |
|
path |
string |
|
depth |
uint32 |
|
options |
...FileOption |
optional |
Returns ([]FileInfo, error)
sdk/go/files.go:233def list(path, depth = 1, user: nil)| Parameter | Type | Default |
|---|---|---|
path |
||
depth |
1 |
|
user |
nil |
sdk/ruby/lib/svm/envd_clients.rb:375public List<Map<String, Object>> list(String path, int depth)public List<Map<String, Object>> list(String path, int depth, FileOptions options)| Parameter | Type | Default |
|---|---|---|
path |
String |
|
depth |
int |
|
options |
FileOptions |
optional |
Returns List<Map<String, Object>>
sdk/java/src/main/java/dev/svm/sandbox/FileClient.java:115close()
Section titled “close()”def close(self) -> NoneClose the channel; a later call opens a new one. A watch_dir in flight ends (its iterator stops) and does not poll or reconnect again.
sdk/python/svm/files.py:76async close(): Promise<void>Close the gRPC channel; the next call opens a new one (see ProcessClient.close).
sdk/typescript/src/files.ts:71func (f *FileClient) Close() errorClose releases the data-plane transport this client shares with the sandbox’s other clients; the next call on any of them opens a new one.
Returns error
sdk/go/files.go:125def closeEnds this client’s calls in flight; a later call opens a new connection.
Source:sdk/ruby/lib/svm/envd_clients.rb:355public void close()Releases the data-plane connections; a later call on this client opens new ones.
Source:sdk/java/src/main/java/dev/svm/sandbox/FileClient.java:41constructor()
Section titled “constructor()”Not in the Python SDK’s FileClient.
constructor(private readonly access: SandboxAccess | AccessHandle, private readonly client: SandboxClient, private readonly sandboxId: string, private readonly allowInsecureHttp = false, private readonly retry?: RetryPolicy)| Parameter | Type | Default |
|---|---|---|
access |
SandboxAccess | AccessHandle |
|
client |
SandboxClient |
|
sandboxId |
string |
|
allowInsecureHttp |
boolean |
false |
retry |
RetryPolicy |
optional |
sdk/typescript/src/files.ts:17Not in the Go SDK’s FileClient.
Not in the Ruby SDK’s FileClient.
Not in the Java SDK’s FileClient.
download()
Section titled “download()”def download(self, path: str, dest: 'str | os.PathLike[str] | BinaryIO', *, expected_sha256: str | None=None, resume: bool=False, user: str | None=None, gzip: bool=False) -> TransferResultStream a file to dest (a path or a binary file) holding one chunk in memory.
A broken connection resumes from the last byte written; a file that changed meanwhile fails with TransferError. To a path the bytes go to <dest>.part, renamed when complete, and resume=True continues a partial one left by an earlier run. The size is checked, and expected_sha256 when given.
| Parameter | Type | Default |
|---|---|---|
path |
str |
|
dest |
'str | os.PathLike[str] | BinaryIO' |
|
expected_sha256 |
str | None |
None |
resume |
bool |
False |
user |
str | None |
None |
gzip |
bool |
False |
Returns TransferResult
Raises TransferError
sdk/python/svm/files.py:161async download(path: string, dest: string | ByteSink, options: DownloadOptions = {}): Promise<TransferResult>| Parameter | Type | Default |
|---|---|---|
path |
string |
|
dest |
string | ByteSink |
|
options |
DownloadOptions |
{} |
Returns Promise<TransferResult>
sdk/typescript/src/files.ts:50func (f *FileClient) Download(ctx context.Context, path string, w io.Writer, opts DownloadOptions) (TransferResult, error)Download streams a file to w. A broken connection resumes from the last byte written.
| Parameter | Type | Default |
|---|---|---|
ctx |
context.Context |
|
path |
string |
|
w |
io.Writer |
|
opts |
DownloadOptions |
Returns (TransferResult, error)
sdk/go/transfer.go:268def download(path, io, expected_sha256: nil, user: nil, gzip: false)Streams a file into io; a broken connection resumes from the last byte written. Raises TransferError when the bytes are not the file’s (wrong size, a file that changed meanwhile, a checksum that is not the expected one).
| Parameter | Type | Default |
|---|---|---|
path |
||
io |
||
expected_sha256 |
nil |
|
user |
nil |
|
gzip |
false |
Raises TransferError
sdk/ruby/lib/svm/envd_clients.rb:420public TransferResult download(String path, OutputStream out, String expectedSha256)public TransferResult download(String path, OutputStream out, String expectedSha256, FileOptions options)Streams a file into out; a broken connection resumes from the last byte written. Throws TransferException when the bytes are not the file’s.
| Parameter | Type | Default |
|---|---|---|
path |
String |
|
out |
OutputStream |
|
expectedSha256 |
String |
|
options |
FileOptions |
optional |
Returns TransferResult
sdk/java/src/main/java/dev/svm/sandbox/FileClient.java:201download_file()
Section titled “download_file()”Not in the Python SDK’s FileClient.
Not in the TypeScript SDK’s FileClient.
func (f *FileClient) DownloadFile(ctx context.Context, path, destPath string, opts DownloadOptions) (TransferResult, error)DownloadFile streams a file to destPath through “<destPath>.part”, renamed when complete. Resume continues a partial one left by an earlier run; a failed download keeps it for that.
| Parameter | Type | Default |
|---|---|---|
ctx |
context.Context |
|
path |
string |
|
destPath |
string |
|
opts |
DownloadOptions |
Returns (TransferResult, error)
sdk/go/transfer.go:280def download_file(path, dest, resume: false, expected_sha256: nil, user: nil, gzip: false)Downloads through “<dest>.part”, renamed when complete; resume continues a partial one left by an earlier run.
| Parameter | Type | Default |
|---|---|---|
path |
||
dest |
||
resume |
false |
|
expected_sha256 |
nil |
|
user |
nil |
|
gzip |
false |
sdk/ruby/lib/svm/envd_clients.rb:425public TransferResult downloadFile(String path, java.nio.file.Path dest, boolean resume, String expectedSha256)public TransferResult downloadFile(String path, java.nio.file.Path dest, boolean resume, String expectedSha256, FileOptions options)Downloads through “<dest>.part”, renamed when complete; resume continues a partial one left by an earlier run.
| Parameter | Type | Default |
|---|---|---|
path |
String |
|
dest |
java.nio.file.Path |
|
resume |
boolean |
|
expectedSha256 |
String |
|
options |
FileOptions |
optional |
Returns TransferResult
Raises SandboxException
sdk/java/src/main/java/dev/svm/sandbox/FileClient.java:209download_url()
Section titled “download_url()”def download_url(self, path: str, *, user: str | None=None, expires_in_seconds: int=300) -> FileUrlA signed URL that downloads path with a plain HTTP request, valid for expires_in_seconds (1..3600).
| Parameter | Type | Default |
|---|---|---|
path |
str |
|
user |
str | None |
None |
expires_in_seconds |
int |
300 |
Returns FileUrl
sdk/python/svm/files.py:336downloadUrl(path: string, options: { user?: string; expiresInSeconds?: number } = {}): Promise<FileUrl>| Parameter | Type | Default |
|---|---|---|
path |
string |
|
options |
{ user?: string; expiresInSeconds?: number } |
{} |
Returns Promise<FileUrl>
sdk/typescript/src/files.ts:67func (f *FileClient) DownloadURL(ctx context.Context, path string, o FileURLOptions) (FileURL, error)DownloadURL is a signed URL that downloads path with a plain HTTP GET.
| Parameter | Type | Default |
|---|---|---|
ctx |
context.Context |
|
path |
string |
|
o |
FileURLOptions |
Returns (FileURL, error)
sdk/go/files.go:169def download_url(path, user: nil, expires_in_seconds: 300)A signed URL that downloads the file at path with a plain HTTP GET: {“url” =>, “expires_at” =>}. Treat it as a secret.
| Parameter | Type | Default |
|---|---|---|
path |
||
user |
nil |
|
expires_in_seconds |
300 |
sdk/ruby/lib/svm/envd_clients.rb:492public Map<String, Object> downloadUrl(String path, String user, int expiresInSeconds)public Map<String, Object> downloadUrl(String path)A signed URL that downloads path with a plain HTTP request ({“url”, “expires_at”}); user may be null.
| Parameter | Type | Default |
|---|---|---|
path |
String |
|
user |
String |
optional |
expiresInSeconds |
int |
optional |
Returns Map<String, Object>
sdk/java/src/main/java/dev/svm/sandbox/FileClient.java:182exists()
Section titled “exists()”def exists(self, path: str, *, user: str | None=None) -> bool| Parameter | Type | Default |
|---|---|---|
path |
str |
|
user |
str | None |
None |
Returns bool
sdk/python/svm/files.py:113async exists(path: string, options: FileOptions = {}): Promise<boolean>| Parameter | Type | Default |
|---|---|---|
path |
string |
|
options |
FileOptions |
{} |
Returns Promise<boolean>
sdk/typescript/src/files.ts:27func (f *FileClient) Exists(ctx context.Context, path string, options ...FileOption) (bool, error)Exists reports false only for the typed missing-path error.
| Parameter | Type | Default |
|---|---|---|
ctx |
context.Context |
|
path |
string |
|
options |
...FileOption |
optional |
Returns (bool, error)
sdk/go/files.go:220def exists?(path, user: nil)| Parameter | Type | Default |
|---|---|---|
path |
||
user |
nil |
sdk/ruby/lib/svm/envd_clients.rb:367public boolean exists(String path)public boolean exists(String path, FileOptions options)| Parameter | Type | Default |
|---|---|---|
path |
String |
|
options |
FileOptions |
optional |
Returns boolean
sdk/java/src/main/java/dev/svm/sandbox/FileClient.java:103get_info()
Section titled “get_info()”def get_info(self, path: str, *, user: str | None=None) -> FileInfo| Parameter | Type | Default |
|---|---|---|
path |
str |
|
user |
str | None |
None |
Returns FileInfo
sdk/python/svm/files.py:110async getInfo(path: string, options: FileOptions = {}): Promise<FileInfo>| Parameter | Type | Default |
|---|---|---|
path |
string |
|
options |
FileOptions |
{} |
Returns Promise<FileInfo>
sdk/typescript/src/files.ts:26func (f *FileClient) GetInfo(ctx context.Context, path string, options ...FileOption) (FileInfo, error)GetInfo returns metadata for a file or directory.
| Parameter | Type | Default |
|---|---|---|
ctx |
context.Context |
|
path |
string |
|
options |
...FileOption |
optional |
Returns (FileInfo, error)
sdk/go/files.go:204def get_info(path, user: nil)| Parameter | Type | Default |
|---|---|---|
path |
||
user |
nil |
sdk/ruby/lib/svm/envd_clients.rb:363public Map<String, Object> getInfo(String path)public Map<String, Object> getInfo(String path, FileOptions options)The entry at path: name, type, path, size, mode, permissions, owner, group, modified_time, metadata.
| Parameter | Type | Default |
|---|---|---|
path |
String |
|
options |
FileOptions |
optional |
Returns Map<String, Object>
sdk/java/src/main/java/dev/svm/sandbox/FileClient.java:97initialize()
Section titled “initialize()”Not in the Python SDK’s FileClient.
Not in the TypeScript SDK’s FileClient.
Not in the Go SDK’s FileClient.
def initialize(channel, client: nil, sandbox_id: nil)client and sandbox_id are what the signed URLs (#upload_url, #download_url) are asked of; Sandbox#files passes them.
| Parameter | Type | Default |
|---|---|---|
channel |
||
client |
nil |
|
sandbox_id |
nil |
sdk/ruby/lib/svm/envd_clients.rb:350Not in the Java SDK’s FileClient.
make_dir()
Section titled “make_dir()”def make_dir(self, path: str, *, user: str | None=None) -> FileInfo| Parameter | Type | Default |
|---|---|---|
path |
str |
|
user |
str | None |
None |
Returns FileInfo
sdk/python/svm/files.py:128async makeDir(path: string, options: FileOptions = {}): Promise<FileInfo>| Parameter | Type | Default |
|---|---|---|
path |
string |
|
options |
FileOptions |
{} |
Returns Promise<FileInfo>
sdk/typescript/src/files.ts:31func (f *FileClient) MakeDir(ctx context.Context, path string, options ...FileOption) (FileInfo, error)MakeDir creates a directory and any missing parent directories.
| Parameter | Type | Default |
|---|---|---|
ctx |
context.Context |
|
path |
string |
|
options |
...FileOption |
optional |
Returns (FileInfo, error)
sdk/go/files.go:256def make_dir(path, user: nil)| Parameter | Type | Default |
|---|---|---|
path |
||
user |
nil |
sdk/ruby/lib/svm/envd_clients.rb:380public Map<String, Object> makeDir(String path)public Map<String, Object> makeDir(String path, FileOptions options)| Parameter | Type | Default |
|---|---|---|
path |
String |
|
options |
FileOptions |
optional |
Returns Map<String, Object>
sdk/java/src/main/java/dev/svm/sandbox/FileClient.java:124read()
Section titled “read()”def read(self, path: str, *, offset: int=0, limit: int=0, user: str | None=None, gzip: bool=False) -> bytesThe file’s bytes, resumed where a break left off. All in memory: use download for large files. gzip sends the data compressed over the wire (worth it for large, compressible files); the bytes you get are the same.
| Parameter | Type | Default |
|---|---|---|
path |
str |
|
offset |
int |
0 |
limit |
int |
0 |
user |
str | None |
None |
gzip |
bool |
False |
Returns bytes
sdk/python/svm/files.py:147async read(path: string, offset = 0, limit = 0, options: ReadOptions = {}): Promise<Uint8Array>| Parameter | Type | Default |
|---|---|---|
path |
string |
|
offset |
number |
0 |
limit |
number |
0 |
options |
ReadOptions |
{} |
Returns Promise<Uint8Array>
sdk/typescript/src/files.ts:36func (f *FileClient) Read(ctx context.Context, path string, offset, limit int64, options ...FileOption) ([]byte, error)Read reads bytes starting at offset, with limit zero meaning through EOF.
| Parameter | Type | Default |
|---|---|---|
ctx |
context.Context |
|
path |
string |
|
offset |
int64 |
|
limit |
int64 |
|
options |
...FileOption |
optional |
Returns ([]byte, error)
sdk/go/files.go:304def read(path, offset: 0, limit: 0, user: nil, gzip: false)The bytes of a file (from offset, up to limit; 0 means to the end), resuming where a break left off. All in memory: use #download for large files. gzip sends the data compressed over the wire (worth it for large, compressible files); the bytes you get are the same.
| Parameter | Type | Default |
|---|---|---|
path |
||
offset |
0 |
|
limit |
0 |
|
user |
nil |
|
gzip |
false |
sdk/ruby/lib/svm/envd_clients.rb:397public byte[] read(String path, long offset, long limit)public byte[] read(String path, long offset, long limit, FileOptions options)public byte[] read(String path)public byte[] read(String path, FileOptions options)The bytes of a file (from offset, up to limit; 0 means to the end), resuming where a break left off.
| Parameter | Type | Default |
|---|---|---|
path |
String |
|
offset |
long |
optional |
limit |
long |
optional |
options |
FileOptions |
optional |
Returns byte[]
sdk/java/src/main/java/dev/svm/sandbox/FileClient.java:141read_text()
Section titled “read_text()”def read_text(self, path: str, *, encoding: str='utf-8', user: str | None=None, gzip: bool=False) -> str| Parameter | Type | Default |
|---|---|---|
path |
str |
|
encoding |
str |
'utf-8' |
user |
str | None |
None |
gzip |
bool |
False |
Returns str
sdk/python/svm/files.py:158async readText(path: string, options: ReadOptions = {}): Promise<string>| Parameter | Type | Default |
|---|---|---|
path |
string |
|
options |
ReadOptions |
{} |
Returns Promise<string>
sdk/typescript/src/files.ts:39func (f *FileClient) ReadText(ctx context.Context, path string, options ...FileOption) (string, error)ReadText reads a whole file as text.
| Parameter | Type | Default |
|---|---|---|
ctx |
context.Context |
|
path |
string |
|
options |
...FileOption |
optional |
Returns (string, error)
sdk/go/files.go:323def read_text(path, user: nil, gzip: false)| Parameter | Type | Default |
|---|---|---|
path |
||
user |
nil |
|
gzip |
false |
sdk/ruby/lib/svm/envd_clients.rb:409public String readText(String path)public String readText(String path, FileOptions options)| Parameter | Type | Default |
|---|---|---|
path |
String |
|
options |
FileOptions |
optional |
Returns String
sdk/java/src/main/java/dev/svm/sandbox/FileClient.java:155remove()
Section titled “remove()”def remove(self, path: str, *, user: str | None=None) -> None| Parameter | Type | Default |
|---|---|---|
path |
str |
|
user |
str | None |
None |
sdk/python/svm/files.py:135async remove(path: string, options: FileOptions = {}): Promise<void>| Parameter | Type | Default |
|---|---|---|
path |
string |
|
options |
FileOptions |
{} |
sdk/typescript/src/files.ts:35func (f *FileClient) Remove(ctx context.Context, path string, options ...FileOption) errorRemove deletes a file or directory recursively.
| Parameter | Type | Default |
|---|---|---|
ctx |
context.Context |
|
path |
string |
|
options |
...FileOption |
optional |
Returns error
sdk/go/files.go:291def remove(path, user: nil)| Parameter | Type | Default |
|---|---|---|
path |
||
user |
nil |
sdk/ruby/lib/svm/envd_clients.rb:389public void remove(String path)public void remove(String path, FileOptions options)| Parameter | Type | Default |
|---|---|---|
path |
String |
|
options |
FileOptions |
optional |
sdk/java/src/main/java/dev/svm/sandbox/FileClient.java:136rename()
Section titled “rename()”def rename(self, source: str, destination: str, *, user: str | None=None) -> FileInfo| Parameter | Type | Default |
|---|---|---|
source |
str |
|
destination |
str |
|
user |
str | None |
None |
Returns FileInfo
sdk/python/svm/files.py:131async rename(source: string, destination: string, options: FileOptions = {}): Promise<FileInfo>| Parameter | Type | Default |
|---|---|---|
source |
string |
|
destination |
string |
|
options |
FileOptions |
{} |
Returns Promise<FileInfo>
sdk/typescript/src/files.ts:32func (f *FileClient) Rename(ctx context.Context, source, destination string, options ...FileOption) (FileInfo, error)Rename moves a file or directory to destination.
| Parameter | Type | Default |
|---|---|---|
ctx |
context.Context |
|
source |
string |
|
destination |
string |
|
options |
...FileOption |
optional |
Returns (FileInfo, error)
sdk/go/files.go:272def rename(source, destination, user: nil)| Parameter | Type | Default |
|---|---|---|
source |
||
destination |
||
user |
nil |
sdk/ruby/lib/svm/envd_clients.rb:384public Map<String, Object> rename(String source, String destination)public Map<String, Object> rename(String source, String destination, FileOptions options)| Parameter | Type | Default |
|---|---|---|
source |
String |
|
destination |
String |
|
options |
FileOptions |
optional |
Returns Map<String, Object>
sdk/java/src/main/java/dev/svm/sandbox/FileClient.java:130upload()
Section titled “upload()”def upload(self, path: str, source: 'bytes | os.PathLike[str] | BinaryIO', *, mode: int=420, owner: str='', group: str='', user: str | None=None, metadata: dict[str, str] | None=None, gzip: bool=False, verify_checksum: bool=False, _info: bool=False)Send bytes, a file path or a binary file in 1 MiB chunks. A broken connection sends it again from the start (the file is rewound), which is safe because the sandbox replaces the target atomically; the size sent and written must agree, and verify_checksum reads the file back to compare its SHA-256.
| Parameter | Type | Default |
|---|---|---|
path |
str |
|
source |
'bytes | os.PathLike[str] | BinaryIO' |
|
mode |
int |
420 |
owner |
str |
'' |
group |
str |
'' |
user |
str | None |
None |
metadata |
dict[str, str] | None |
None |
gzip |
bool |
False |
verify_checksum |
bool |
False |
_info |
bool |
False |
Raises FileUploadError
sdk/python/svm/files.py:219async upload(path: string, source: UploadSource, options: UploadOptions = {}): Promise<TransferResult>| Parameter | Type | Default |
|---|---|---|
path |
string |
|
source |
UploadSource |
|
options |
UploadOptions |
{} |
Returns Promise<TransferResult>
sdk/typescript/src/files.ts:53func (f *FileClient) Upload(ctx context.Context, path string, open func() (io.ReadCloser, error), opts UploadOptions) (TransferResult, error)Upload sends what open returns in 1 MiB chunks. A broken connection sends it again from the start, opening the source anew, which is safe because the sandbox replaces the target atomically; the size sent and written must agree.
| Parameter | Type | Default |
|---|---|---|
ctx |
context.Context |
|
path |
string |
|
open |
func() (io.ReadCloser, error) |
|
opts |
UploadOptions |
Returns (TransferResult, error)
sdk/go/transfer.go:329def upload(path, open, mode: 0o644, owner: "", group: "", verify_checksum: false, user: nil, metadata: nil, gzip: false)Sends what open returns (a callable giving a fresh IO each time) in 1 MiB chunks. A broken connection sends it again from the start, which is safe because the sandbox replaces the target atomically; the size sent and written must agree.
| Parameter | Type | Default |
|---|---|---|
path |
||
open |
||
mode |
0o644 |
|
owner |
"" |
|
group |
"" |
|
verify_checksum |
false |
|
user |
nil |
|
metadata |
nil |
|
gzip |
false |
Raises FileUploadError
sdk/ruby/lib/svm/envd_clients.rb:450public TransferResult upload(String path, Callable<InputStream> open, int mode, String owner, String group, boolean verifyChecksum)public TransferResult upload(String path, Callable<InputStream> open, int mode, String owner, String group, boolean verifyChecksum, FileOptions options)Sends what open returns in 1 MiB chunks. A broken connection sends it again from the start, which is safe because the sandbox replaces the target atomically; the size sent and written must agree.
| Parameter | Type | Default |
|---|---|---|
path |
String |
|
open |
Callable<InputStream> |
|
mode |
int |
|
owner |
String |
|
group |
String |
|
verifyChecksum |
boolean |
|
options |
FileOptions |
optional |
Returns TransferResult
Raises FileUploadException
sdk/java/src/main/java/dev/svm/sandbox/FileClient.java:266upload_bytes()
Section titled “upload_bytes()”Not in the Python SDK’s FileClient.
Not in the TypeScript SDK’s FileClient.
func (f *FileClient) UploadBytes(ctx context.Context, path string, content []byte, opts UploadOptions) (TransferResult, error)UploadBytes uploads content.
| Parameter | Type | Default |
|---|---|---|
ctx |
context.Context |
|
path |
string |
|
content |
[]byte |
|
opts |
UploadOptions |
Returns (TransferResult, error)
sdk/go/transfer.go:371def upload_bytes(path, content, **options)| Parameter | Type | Default |
|---|---|---|
path |
||
content |
||
**options |
optional |
sdk/ruby/lib/svm/envd_clients.rb:476public TransferResult uploadBytes(String path, byte[] content, int mode, String owner, String group, boolean verifyChecksum)public TransferResult uploadBytes(String path, byte[] content, int mode, String owner, String group, boolean verifyChecksum, FileOptions options)| Parameter | Type | Default |
|---|---|---|
path |
String |
|
content |
byte[] |
|
mode |
int |
|
owner |
String |
|
group |
String |
|
verifyChecksum |
boolean |
|
options |
FileOptions |
optional |
Returns TransferResult
sdk/java/src/main/java/dev/svm/sandbox/FileClient.java:254upload_file()
Section titled “upload_file()”Not in the Python SDK’s FileClient.
Not in the TypeScript SDK’s FileClient.
func (f *FileClient) UploadFile(ctx context.Context, path, filePath string, opts UploadOptions) (TransferResult, error)UploadFile uploads the local file at filePath.
| Parameter | Type | Default |
|---|---|---|
ctx |
context.Context |
|
path |
string |
|
filePath |
string |
|
opts |
UploadOptions |
Returns (TransferResult, error)
sdk/go/transfer.go:376def upload_file(path, file_path, **options)| Parameter | Type | Default |
|---|---|---|
path |
||
file_path |
||
**options |
optional |
sdk/ruby/lib/svm/envd_clients.rb:481public TransferResult uploadFile(String path, java.nio.file.Path localFile)public TransferResult uploadFile(String path, java.nio.file.Path localFile, FileOptions options)Uploads a local file to path (mode 0644), streamed in 1 MiB chunks.
| Parameter | Type | Default |
|---|---|---|
path |
String |
|
localFile |
java.nio.file.Path |
|
options |
FileOptions |
optional |
Returns TransferResult
sdk/java/src/main/java/dev/svm/sandbox/FileClient.java:247upload_url()
Section titled “upload_url()”def upload_url(self, path: str, *, user: str | None=None, expires_in_seconds: int=300) -> FileUrlA signed URL that uploads to path with a plain HTTP request, valid for expires_in_seconds (1..3600).
| Parameter | Type | Default |
|---|---|---|
path |
str |
|
user |
str | None |
None |
expires_in_seconds |
int |
300 |
Returns FileUrl
sdk/python/svm/files.py:332uploadUrl(path: string, options: { user?: string; expiresInSeconds?: number } = {}): Promise<FileUrl>| Parameter | Type | Default |
|---|---|---|
path |
string |
|
options |
{ user?: string; expiresInSeconds?: number } |
{} |
Returns Promise<FileUrl>
sdk/typescript/src/files.ts:64func (f *FileClient) UploadURL(ctx context.Context, path string, o FileURLOptions) (FileURL, error)UploadURL is a signed URL that uploads to path with a plain HTTP PUT.
| Parameter | Type | Default |
|---|---|---|
ctx |
context.Context |
|
path |
string |
|
o |
FileURLOptions |
Returns (FileURL, error)
sdk/go/files.go:164def upload_url(path, user: nil, expires_in_seconds: 300)A signed URL that uploads one file to path with a plain HTTP PUT, no SDK needed: {“url” =>, “expires_at” =>}. user owns the file; the URL works for expires_in_seconds (1 to 3600). Treat it as a secret.
| Parameter | Type | Default |
|---|---|---|
path |
||
user |
nil |
|
expires_in_seconds |
300 |
sdk/ruby/lib/svm/envd_clients.rb:487public Map<String, Object> uploadUrl(String path, String user, int expiresInSeconds)public Map<String, Object> uploadUrl(String path)A signed URL that uploads to path with a plain HTTP request ({“url”, “expires_at”}); user may be null.
| Parameter | Type | Default |
|---|---|---|
path |
String |
|
user |
String |
optional |
expiresInSeconds |
int |
optional |
Returns Map<String, Object>
sdk/java/src/main/java/dev/svm/sandbox/FileClient.java:179watch_dir()
Section titled “watch_dir()”def watch_dir(self, path: str, *, recursive: bool=False, resilient: bool=True, user: str | None=None, _stop=None) -> Iterator[FileEvent]Changes in a directory. resilient (the default) polls a watcher the sandbox keeps, so a break loses no event (up to 0.25 s late) and WatchLostError means the watcher is gone; otherwise events stream. close() on this client ends the iteration.
| Parameter | Type | Default |
|---|---|---|
path |
str |
|
recursive |
bool |
False |
resilient |
bool |
True |
user |
str | None |
None |
_stop |
None |
Returns Iterator[FileEvent]
Raises WatchLostError
sdk/python/svm/files.py:284async watchDir(path: string, onEvent: (event: FileEvent) => void, onError?: (error: Error) => void, recursive = false, resilient = true, options: FileOptions = {}): Promise<{ close(): void }>| Parameter | Type | Default |
|---|---|---|
path |
string |
|
onEvent |
(event: FileEvent) => void |
|
onError |
(error: Error) => void |
optional |
recursive |
boolean |
false |
resilient |
boolean |
true |
options |
FileOptions |
{} |
Returns Promise<{ close(): void }>
sdk/typescript/src/files.ts:57func (f *FileClient) WatchDir(ctx context.Context, path string, recursive bool, options ...WatchOption) (<-chan FileEvent, <-chan error, context.CancelFunc, error)WatchDir delivers filesystem events until ctx is canceled. By default it polls a watcher the sandbox keeps (up to a quarter second of delay), so a broken connection loses no event; a *WatchLostError on the error channel means the sandbox lost the watcher. WatchStream reads the events as a stream instead.
| Parameter | Type | Default |
|---|---|---|
ctx |
context.Context |
|
path |
string |
|
recursive |
bool |
|
options |
...WatchOption |
optional |
Returns (<-chan FileEvent, <-chan error, context.CancelFunc, error)
Raises WatchLostError
sdk/go/files.go:399def watch_dir(path, recursive: false, stream: false, count: nil, user: nil, &block)Yields filesystem events {“name”=>, “type”=>} until the block throws :stop (or count events were yielded). By default it polls a watcher the sandbox keeps (up to a quarter second of delay), so a broken connection loses no event; WatchLostError means the sandbox lost the watcher. stream: true reads a stream instead: no delay, but a broken connection ends the watch.
| Parameter | Type | Default |
|---|---|---|
path |
||
recursive |
false |
|
stream |
false |
|
count |
nil |
|
user |
nil |
|
&block |
optional |
Raises WatchLostError
sdk/ruby/lib/svm/envd_clients.rb:499public void watchDir(String path, boolean recursive, boolean stream, int count, Predicate<Map<String, Object>> onEvent)public void watchDir(String path, boolean recursive, boolean stream, int count, Predicate<Map<String, Object>> onEvent, FileOptions options)Hands filesystem events {“name”, “type”} to onEvent until it throws Stop-style by returning false, or count events were delivered (0 means no limit). By default it polls a watcher the sandbox keeps (up to a quarter second of delay), so a broken connection loses no event; WatchLostException means the sandbox lost the watcher. stream reads a stream instead: no delay, but a broken connection ends the watch.
| Parameter | Type | Default |
|---|---|---|
path |
String |
|
recursive |
boolean |
|
stream |
boolean |
|
count |
int |
|
onEvent |
Predicate<Map<String, Object>> |
|
options |
FileOptions |
optional |
Raises WatchLostException
sdk/java/src/main/java/dev/svm/sandbox/FileClient.java:301write()
Section titled “write()”def write(self, path: str, content: str | bytes, *, mode: int=420, owner: str='', group: str='', user: str | None=None, metadata: dict[str, str] | None=None, gzip: bool=False) -> FileInfoWrite a file. metadata (up to 16 string pairs) is stored with it and returned in FileInfo.metadata; a write replaces the file and its pairs. gzip sends the data compressed over the wire.
| Parameter | Type | Default |
|---|---|---|
path |
str |
|
content |
str | bytes |
|
mode |
int |
420 |
owner |
str |
'' |
group |
str |
'' |
user |
str | None |
None |
metadata |
dict[str, str] | None |
None |
gzip |
bool |
False |
Returns FileInfo
sdk/python/svm/files.py:208async write(path: string, content: string | Uint8Array, mode: number | UploadOptions = 0o644, owner = "", group = "", options: WriteOptions = {}): Promise<FileInfo>| Parameter | Type | Default |
|---|---|---|
path |
string |
|
content |
string | Uint8Array |
|
mode |
number | UploadOptions |
0o644 |
owner |
string |
"" |
group |
string |
"" |
options |
WriteOptions |
{} |
Returns Promise<FileInfo>
sdk/typescript/src/files.ts:42func (f *FileClient) Write(ctx context.Context, path string, content []byte, mode uint32, options ...FileOption) (FileInfo, error)Write atomically writes content in bounded chunks.
| Parameter | Type | Default |
|---|---|---|
ctx |
context.Context |
|
path |
string |
|
content |
[]byte |
|
mode |
uint32 |
|
options |
...FileOption |
optional |
Returns (FileInfo, error)
sdk/go/files.go:329def write(path, content, mode: 0o644, user: nil, metadata: nil, gzip: false)Writes a file. metadata (up to 16 string pairs) is stored with it and returned in the entry’s “metadata”; a write replaces the file and its pairs. gzip sends the data compressed over the wire.
| Parameter | Type | Default |
|---|---|---|
path |
||
content |
||
mode |
0o644 |
|
user |
nil |
|
metadata |
nil |
|
gzip |
false |
sdk/ruby/lib/svm/envd_clients.rb:405public Map<String, Object> write(String path, byte[] content)public Map<String, Object> write(String path, byte[] content, FileOptions options)public Map<String, Object> write(String path, String text)public Map<String, Object> write(String path, String text, FileOptions options)Writes a file (mode 0644). options.metadata() is stored with it and returned in the entry’s “metadata”; a write replaces the file and its pairs.
| Parameter | Type | Default |
|---|---|---|
path |
String |
|
content |
byte[] |
|
options |
FileOptions |
optional |
Returns Map<String, Object>
sdk/java/src/main/java/dev/svm/sandbox/FileClient.java:159write_batch()
Section titled “write_batch()”def write_batch(self, files: dict[str, str | bytes], *, concurrency: int=8, user: str | None=None, gzip: bool=False) -> list[FileInfo]Write many files at once, in order of files, all as user (the sandbox default when None).
| Parameter | Type | Default |
|---|---|---|
files |
dict[str, str | bytes] |
|
concurrency |
int |
8 |
user |
str | None |
None |
gzip |
bool |
False |
Returns list[FileInfo]
sdk/python/svm/files.py:270async writeBatch(files: Record<string, string | Uint8Array>, concurrency: number | BatchOptions = 8, options: Omit<BatchOptions, "concurrency"> = {}): Promise<FileInfo[]>| Parameter | Type | Default |
|---|---|---|
files |
Record<string, string | Uint8Array> |
|
concurrency |
number | BatchOptions |
8 |
options |
Omit<BatchOptions, "concurrency"> |
{} |
Returns Promise<FileInfo[]>
sdk/typescript/src/files.ts:46func (f *FileClient) WriteBatch(ctx context.Context, files map[string][]byte, mode uint32, options ...FileOption) ([]FileInfo, error)WriteBatch writes many files, eight at a time over the one connection (a serial loop costs a round trip per file). The entries come back in the order of the paths sorted; every write is attempted, and if any fails the first failure in that order is returned.
| Parameter | Type | Default |
|---|---|---|
ctx |
context.Context |
|
files |
map[string][]byte |
|
mode |
uint32 |
|
options |
...FileOption |
optional |
Returns ([]FileInfo, error)
sdk/go/files.go:349def write_batch(files, mode: 0o644, user: nil, gzip: false)Writes several files ({path => content}), all as user; returns their entries.
| Parameter | Type | Default |
|---|---|---|
files |
||
mode |
0o644 |
|
user |
nil |
|
gzip |
false |
sdk/ruby/lib/svm/envd_clients.rb:414public List<Map<String, Object>> writeBatch(Map<String, byte[]> files)public List<Map<String, Object>> writeBatch(Map<String, byte[]> files, FileOptions options)Writes several files ({path: content}); returns their entries.
| Parameter | Type | Default |
|---|---|---|
files |
Map<String, byte[]> |
|
options |
FileOptions |
optional |
Returns List<Map<String, Object>>
sdk/java/src/main/java/dev/svm/sandbox/FileClient.java:169FileInfo
Section titled “FileInfo”FileInfo is an envd filesystem entry.
Properties
Section titled “Properties”| Property | Type | Description |
|---|---|---|
group |
str |
|
is_dir |
bool |
Whether the entry is a directory (type is the protocol’s name, FILE\_TYPE\_DIRECTORY). |
is_file |
bool |
|
is_symlink |
bool |
|
metadata |
dict[str, str] |
|
mode |
int |
|
modified_at |
str | None |
|
name |
str |
|
owner |
str |
|
path |
str |
|
permissions |
str |
|
size |
int |
|
symlink_target |
str | None |
|
type |
str |
| Property | Type | Description |
|---|---|---|
group |
string |
|
metadata |
Record<string, string> |
The pairs stored on the file when it was written (write(..., { metadata })); empty for a file without any. |
mode |
number |
|
modifiedAt |
string |
|
name |
string |
|
owner |
string |
|
path |
string |
|
permissions |
string |
|
size |
number |
|
symlinkTarget |
string |
|
type |
string |
| Property | Type | Description |
|---|---|---|
Group |
string |
|
Metadata |
map[string]string |
Metadata is the key-value pairs stored on the file when it was written (WithMetadata); nil for a file without any. |
Mode |
uint32 |
|
ModifiedAt |
time.Time |
|
Name |
string |
|
Owner |
string |
|
Path |
string |
|
Permissions |
string |
|
Size |
int64 |
|
SymlinkTarget |
string |
|
Type |
string |
Not in the Ruby SDK.
Not in the Java SDK.
from_proto()
Section titled “from_proto()”def from_proto(cls, entry: pb.EntryInfo) -> 'FileInfo'| Parameter | Type | Default |
|---|---|---|
entry |
pb.EntryInfo |
Returns 'FileInfo'
sdk/python/svm/file_types.py:38Not in the TypeScript SDK’s FileInfo.
Not in the Go SDK’s FileInfo.
Not in the Ruby SDK.
Not in the Java SDK.
FileEvent
Section titled “FileEvent”FileEvent reports one filesystem change.
Properties
Section titled “Properties”| Property | Type | Description |
|---|---|---|
name |
str |
|
type |
str |
| Property | Type | Description |
|---|---|---|
name |
string |
|
type |
string |
| Property | Type | Description |
|---|---|---|
Name |
string |
|
Type |
string |
Not in the Ruby SDK.
Not in the Java SDK.
FileUrl
Section titled “FileUrl”Properties
Section titled “Properties”| Property | Type | Description |
|---|---|---|
expires_at |
str |
|
url |
str |
| Property | Type | Description |
|---|---|---|
expiresAt |
string |
|
url |
string |
Not in the Go SDK.
Not in the Ruby SDK.
Not in the Java SDK.
TransferResult
Section titled “TransferResult”TransferResult is what a transfer moved: its size and the SHA-256 of the bytes.
Properties
Section titled “Properties”| Property | Type | Description |
|---|---|---|
sha256 |
str |
|
size |
int |
| Property | Type | Description |
|---|---|---|
sha256 |
string |
|
size |
number |
| Property | Type | Description |
|---|---|---|
Entry |
FileInfo |
Entry is the file as the sandbox reports it after an upload. |
SHA256 |
string |
|
Size |
int64 |
| Property | Type | Description |
|---|---|---|
entry |
||
sha256 |
||
size |
| Property | Type | Description |
|---|---|---|
entry |
Map<String, Object> |
|
sha256 |
String |
|
size |
long |
Gunzipped
Section titled “Gunzipped”A ReadFile response stream of gzip chunks seen as the plain chunks read_ranges expects (each with .data).
Memory stays bounded however well the data compresses (output is taken one chunk at a time), and a stream that ends before the gzip trailer is a TransferError, not a shorter file. A broken connection is raised as the gRPC error it is, so the caller resumes from the plain bytes it has: a new request, a new gzip stream.
cancel()
Section titled “cancel()”def cancel(self) -> boolReturns bool
sdk/python/svm/transfer.py:160Not in the TypeScript SDK.
Not in the Go SDK.
Not in the Ruby SDK.
Not in the Java SDK.
TransferError
Section titled “TransferError”A transfer finished wrongly (size or checksum differs) or could not be retried safely. A SandboxError, as every error this package raises is.
Properties
Section titled “Properties”Python exposes these as methods; see below.
TypeScript exposes these as methods; see below.
| Property | Type | Description |
|---|---|---|
Message |
string |
Ruby exposes these as methods; see below.
Not in the Java SDK.
constructor()
Section titled “constructor()”Not in the Python SDK’s TransferError.
constructor(message: string)| Parameter | Type | Default |
|---|---|---|
message |
string |
sdk/typescript/src/errors.ts:145Not in the Go SDK’s TransferError.
Not in the Ruby SDK’s TransferError.
Not in the Java SDK.
error()
Section titled “error()”Not in the Python SDK’s TransferError.
Not in the TypeScript SDK’s TransferError.
func (e *TransferError) Error() stringReturns string
sdk/go/transfer.go:38Not in the Ruby SDK’s TransferError.
Not in the Java SDK.
Not in the Python SDK’s TransferError.
Not in the TypeScript SDK’s TransferError.
func (e *TransferError) Is(target error) bool| Parameter | Type | Default |
|---|---|---|
target |
error |
Returns bool
sdk/go/transfer.go:39Not in the Ruby SDK’s TransferError.
Not in the Java SDK.
FileUploadError
Section titled “FileUploadError”An upload to a sandbox did not complete correctly: the sandbox wrote a different size than was sent, the file’s checksum differs from what was sent, or the connection broke and the source cannot be read again (the reference vendor’s FileUploadError). A TransferError, so except TransferError still catches it. Downloads keep raising plain TransferError.
Properties
Section titled “Properties”Python exposes these as methods; see below.
TypeScript exposes these as methods; see below.
| Property | Type | Description |
|---|---|---|
Message |
string |
Ruby exposes these as methods; see below.
Not in the Java SDK.
constructor()
Section titled “constructor()”Not in the Python SDK’s FileUploadError.
constructor(message: string)| Parameter | Type | Default |
|---|---|---|
message |
string |
sdk/typescript/src/errors.ts:153Not in the Go SDK’s FileUploadError.
Not in the Ruby SDK’s FileUploadError.
Not in the Java SDK.
error()
Section titled “error()”Not in the Python SDK’s FileUploadError.
Not in the TypeScript SDK’s FileUploadError.
func (e *FileUploadError) Error() stringReturns string
sdk/go/transfer.go:50Not in the Ruby SDK’s FileUploadError.
Not in the Java SDK.
Not in the Python SDK’s FileUploadError.
Not in the TypeScript SDK’s FileUploadError.
func (e *FileUploadError) Is(target error) bool| Parameter | Type | Default |
|---|---|---|
target |
error |
Returns bool
sdk/go/transfer.go:51Not in the Ruby SDK’s FileUploadError.
Not in the Java SDK.
unwrap()
Section titled “unwrap()”Not in the Python SDK’s FileUploadError.
Not in the TypeScript SDK’s FileUploadError.
func (e *FileUploadError) Unwrap() errorReturns error
sdk/go/transfer.go:52Not in the Ruby SDK’s FileUploadError.
Not in the Java SDK.
FileUploadApiError
Section titled “FileUploadApiError”The server answered FILE_UPLOAD_FAILED: the file in the sandbox is not what was sent. A FileUploadError (so a TransferError) and, by its HTTP status, an InternalError; error_kind says file_upload.
detail()
Section titled “detail()”Not in the Python SDK’s FileUploadApiError.
Not in the TypeScript SDK.
Not in the Go SDK.
def self.detail(details, kind)ApiErrorA value from the details, whether they arrive as a list of {type, value} or as a mapping.
| Parameter | Type | Default |
|---|---|---|
details |
||
kind |
sdk/ruby/lib/svm/errors.rb:148Not in the Java SDK.
Not in the Python SDK’s FileUploadApiError.
Not in the TypeScript SDK.
Not in the Go SDK.
def self.for(code, message, status, request_id = nil, path: nil, **fields)ApiErrorThe most specific error class for a code. GUEST_UNRESPONSIVE, SANDBOX_UNREACHABLE and FILE_UPLOAD_FAILED name their classes from the code alone (never from the path). For NOT_FOUND the request’s path says what is missing (a sandbox, volume or secret); HTTP 507 is NotEnoughSpaceError; an unknown code stays a plain ApiError.
| Parameter | Type | Default |
|---|---|---|
code |
||
message |
||
status |
||
request_id |
nil |
|
path |
nil |
|
**fields |
optional |
Raises ApiError, NotEnoughSpaceError
sdk/ruby/lib/svm/errors.rb:137Not in the Java SDK.
initialize()
Section titled “initialize()”Not in the Python SDK’s FileUploadApiError.
Not in the TypeScript SDK.
Not in the Go SDK.
def initialize(code, message, status, request_id = nil, details: nil, retryable: nil, retry_after_seconds: nil)ApiError| Parameter | Type | Default |
|---|---|---|
code |
||
message |
||
status |
||
request_id |
nil |
|
details |
nil |
|
retryable |
nil |
|
retry_after_seconds |
nil |
sdk/ruby/lib/svm/errors.rb:11Not in the Java SDK.
WatchLostError
Section titled “WatchLostError”The sandbox no longer knows the watcher, so events may have been missed: list the directory again. A SandboxError, as every error this package raises is.
constructor()
Section titled “constructor()”Not in the Python SDK’s WatchLostError.
constructor(message: string)| Parameter | Type | Default |
|---|---|---|
message |
string |
sdk/typescript/src/transfer-error.ts:9Not in the Go SDK’s WatchLostError.
Not in the Ruby SDK’s WatchLostError.
Not in the Java SDK.
error()
Section titled “error()”Not in the Python SDK’s WatchLostError.
Not in the TypeScript SDK’s WatchLostError.
func (e *WatchLostError) Error() stringReturns string
sdk/go/transfer.go:57Not in the Ruby SDK’s WatchLostError.
Not in the Java SDK.
initialize()
Section titled “initialize()”Not in the Python SDK’s WatchLostError.
Not in the TypeScript SDK’s WatchLostError.
Not in the Go SDK’s WatchLostError.
def initialize(message = "the sandbox no longer has this watcher")| Parameter | Type | Default |
|---|---|---|
message |
"the sandbox no longer has this watcher" |
sdk/ruby/lib/svm/envd.rb:34Not in the Java SDK.
Not in the Python SDK’s WatchLostError.
Not in the TypeScript SDK’s WatchLostError.
func (e *WatchLostError) Is(target error) bool| Parameter | Type | Default |
|---|---|---|
target |
error |
Returns bool
sdk/go/transfer.go:58Not in the Ruby SDK’s WatchLostError.
Not in the Java SDK.