> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ns.rocks/llms.txt
> Use this file to discover all available pages before exploring further.

# Downloads

> Download machine files directly or through signed URLs.

## Read small files

<CodeGroup>
  ```python Python SDK theme={"theme":{"light":"one-light","dark":"one-dark-pro"}}
  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)
  ```

  ```typescript TypeScript SDK theme={"theme":{"light":"one-light","dark":"one-dark-pro"}}
  const text = await machine.files.read("/workspace/result.txt");
  console.log(text);

  const raw = await machine.files.readBytes("/workspace/result.bin");
  ```

  ```bash CLI theme={"theme":{"light":"one-light","dark":"one-dark-pro"}}
  nullspace machine file read mch_... /workspace/result.txt
  nullspace machine file read mch_... /workspace/result.bin --encoding base64 --json
  ```

  ```bash HTTP API theme={"theme":{"light":"one-light","dark":"one-dark-pro"}}
  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"}'
  ```
</CodeGroup>

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

<CodeGroup>
  ```python Python SDK theme={"theme":{"light":"one-light","dark":"one-dark-pro"}}
  url = machine.files.download_url("/workspace/report.csv")
  print(url)
  ```

  ```typescript TypeScript SDK theme={"theme":{"light":"one-light","dark":"one-dark-pro"}}
  const url = await machine.files.downloadUrl("/workspace/report.csv");
  console.log(url);
  ```

  ```bash CLI theme={"theme":{"light":"one-light","dark":"one-dark-pro"}}
  nullspace machine file download-url mch_... /workspace/report.csv
  ```

  ```bash HTTP API theme={"theme":{"light":"one-light","dark":"one-dark-pro"}}
  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"}'
  ```
</CodeGroup>

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:

```bash theme={"theme":{"light":"one-light","dark":"one-dark-pro"}}
nullspace volume download team-data /models/model.bin ./model.bin
```

## Related

* [Uploads](./uploads)
* [Volumes transfers](../volumes/transfers)
* [Filesystem reference](../reference/cli)
