Back to docs
Recipe: Resumable & chunked uploads
Upload large binaries over unreliable connections with automatic resume, chunk-level integrity, and server-side reassembly.
Overview
The client splits a file into fixed-size chunks (default 8 MiB), uploads each chunk with a sequence index and SHA-256 hash, and asks the server which chunks it already has on reconnect. The server reassembles the file once all chunks arrive.
Client flow
- Hash the full file to obtain a content fingerprint.
- POST
/api/uploads/initwith filename, total size, chunk size, and fingerprint. - For each chunk, PUT
/api/uploads/chunkwith index, hash, and binary body. - On interruption, GET
/api/uploads/statusto retrieve the set of completed chunk indices and resume from the first missing chunk. - After the final chunk, POST
/api/uploads/completeto trigger reassembly and final integrity verification.
Server guarantees
- Chunks are written to temporary storage keyed by upload ID.
- Duplicate chunk uploads are idempotent — the server silently discards re-sent chunks whose hash matches the stored copy.
- Reassembly validates the concatenated file against the original fingerprint before promoting it to permanent storage.
- Incomplete uploads expire after 24 hours; a background job purges orphaned chunks.
Recommended chunk size
8 MiB balances parallelism (up to 4 concurrent chunks) against per-chunk overhead. For connections with high packet loss, drop to 2 MiB and reduce concurrency to 2.
This recipe is used by the Meridian loader to deliver signed payloads over spotty residential links. The same pattern works for any binary asset larger than ~50 MiB.