Download Lifecycle
How files are retrieved from the Cascade Supernode network.
Overview
Downloading a file from Cascade requires the action ID returned during upload. The process involves authentication, task creation, and streaming the reconstructed file.
Step 1: Authenticate
Every download request must be authenticated with an ADR-036 signature. The SDK signs the action_id string using the connected wallet:
This proves that the requester holds the private key for their Lumera address. For public files, any wallet can download; for private files, only authorized wallets are accepted.
Step 2: Request Download
The SDK sends a download request to the SN-API:
The SN-API responds with a task_id that tracks the download preparation.
The SDK retries this request up to 3 times for transient server errors (HTTP 500), as Supernodes may need time to locate and gather the required chunks.
Step 3: Monitor Progress
The SDK monitors download progress via Server-Sent Events (SSE):
In browser environments, this uses the native EventSource API. In Node.js, the SDK implements a custom fetch-based SSE parser.
Step 4: Stream the File
Once the task completes, the file is available as a binary stream:
The SDK returns a ReadableStream<Uint8Array> that your application can consume:
Download Task States
| Status | Meaning |
|---|---|
sdk:download_completed | File ready for streaming |
sdk:completed | Generic success |
sdk:download_failure | Reconstruction failed |
sdk:failed | Generic failure |
Convenience Methods
Basic Download
Download with Options
Private Download
For private files (identical call, but the auth signature restricts access):
SN-API Fallback
The SN-API client attempts versioned endpoints first (/api/v1/...), then falls back to legacy paths (/api/...) on 404. This ensures compatibility across SN-API versions.