Skip to main content

Read small files

text = sandbox.files.read("/workspace/result.txt")
print(text)

raw = sandbox.files.read("/workspace/result.bin", format="bytes")
stream = sandbox.files.read("/workspace/large.log", format="stream")
for chunk in stream:
    process_chunk(chunk)
Use text reads for small UTF-8 files, format="bytes" for binary data, and format="stream" when callers should process chunks without loading the whole file in memory.

Signed download URL

url = sandbox.files.download_url("/workspace/report.csv")
print(url)
The signed URL is useful when a browser or another service needs to fetch the file directly. Use sandbox.download_url(path) as a convenience wrapper around sandbox.files.download_url(path). Pass user= to read and signed URL helpers when the path should be resolved for a specific sandbox user.

Durable shared volumes

Use volume download commands when the file lives on a shared volume rather than a sandbox:
nullspace volume download team-data /models/model.bin ./model.bin