Read small files

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

raw = machine.files.read("/workspace/result.bin", format="bytes")
stream = machine.files.read("/workspace/large.log", format="stream")
for chunk in stream:
    process_chunk(chunk)
const text = await machine.files.read("/workspace/result.txt");
console.log(text);

const raw = await machine.files.readBytes("/workspace/result.bin");
nullspace machine file read mch_... /workspace/result.txt
nullspace machine file read mch_... /workspace/result.bin --encoding base64 --json
curl -X POST "${NULLSPACE_API_URL}/v1/machines/mch_123/files/read" \
  -H "Authorization: Bearer ${NULLSPACE_API_KEY}" \
  -H "Content-Type: application/json" \
  -d '{"path": "/workspace/result.txt"}'

curl -X POST "${NULLSPACE_API_URL}/v1/machines/mch_123/files/read" \
  -H "Authorization: Bearer ${NULLSPACE_API_KEY}" \
  -H "Content-Type: application/json" \
  -d '{"path": "/workspace/result.bin", "encoding": "base64"}'
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 = machine.files.download_url("/workspace/report.csv")
print(url)
const url = await machine.files.downloadUrl("/workspace/report.csv");
console.log(url);
nullspace machine file download-url mch_... /workspace/report.csv
curl -X POST "${NULLSPACE_API_URL}/v1/machines/mch_123/files/download-url" \
  -H "Authorization: Bearer ${NULLSPACE_API_KEY}" \
  -H "Content-Type: application/json" \
  -d '{"path": "/workspace/report.csv"}'
The signed URL is useful when a browser or another service needs to fetch the file directly. Use machine.download_url(path) as a convenience wrapper around machine.files.download_url(path). Pass user= to read and signed URL helpers when the path should be resolved for a specific machine user.

Durable shared volumes

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