How resumable uploads work
Create the upload
Send a
POST request to the upload endpoint with file metadata (size, filename, environment ID). Tusky returns a unique upload URL in the Location header.Upload chunks
Send
PATCH requests to the upload URL with chunks of file data. Each chunk includes an Upload-Offset header indicating where in the file this chunk belongs.Resume on failure
If the connection drops mid-upload, send a
HEAD request to the upload URL to check how many bytes the server has received. Then resume by sending a PATCH with the next chunk from that offset.Why resumable uploads?
Reliability
Network interruptions don’t mean starting over. Resume from the last successful byte, even after a complete connection loss.
Large files
Upload files up to 2.5 GB without worrying about timeouts. Chunks are small enough to survive unstable connections.
Mobile friendly
Mobile networks are inherently unreliable. Resumable uploads ensure files get through even on spotty cellular connections.
Progress tracking
Track upload progress byte-by-byte. Show accurate progress bars and estimated completion times in your UI.
tus protocol overview
Tusky implements the tus v1.0.0 protocol with the Creation and Creation With Upload extensions. Every request must include theTus-Resumable: 1.0.0 header.
Key headers
| Header | Direction | Description |
|---|---|---|
Tus-Resumable | Request & Response | Protocol version. Always 1.0.0. |
Upload-Length | Request (POST) | Total file size in bytes. |
Upload-Offset | Request (PATCH) / Response | Current byte offset. Client sends where the chunk starts; server responds with the new offset after writing. |
Upload-Metadata | Request (POST) | Base64-encoded key-value pairs: filename, filetype, environmentId. |
Content-Type | Request (PATCH) | Must be application/offset+octet-stream for chunk data. |
Location | Response (POST) | The URL to send subsequent PATCH and HEAD requests to. |
Upload lifecycle
Using the SDK
The Tusky SDK handles resumable uploads automatically — chunking, offset tracking, and resume logic are all built in.Browser uploads with Uppy
For browser-based applications, Tusky integrates with Uppy — a modular file uploader that supports tus out of the box. Uppy adds a polished upload UI with drag-and-drop, progress bars, and powerful plugins.Golden Retriever
The Golden Retriever plugin protects users from data loss by caching selected files in the browser.- Automatic recovery: If the browser crashes, the tab closes, or the user navigates away, Golden Retriever restores the file selection and upload progress when the user returns.
- Storage layers: Uses IndexedDB for files under 5 MB and optional Service Worker for larger files. Metadata and state are stored in LocalStorage.
- Zero configuration: Install the plugin and it works automatically — no user action required.
Compressor
The Compressor plugin optimizes images before upload, reducing file sizes by up to 60%.- Automatic: Compresses JPEG and PNG images transparently before they are uploaded — no user action required.
- Configurable quality: Default quality is 0.6 (60%). Adjust to balance size vs. visual quality.
- Bandwidth savings: Particularly valuable for mobile users on slow or metered connections.
- Parallel processing: Compresses up to 10 images concurrently by default.
The Compressor plugin only affects image files. Non-image files pass through unmodified. The original file is replaced in the upload queue with the compressed version, and Uppy displays the total bytes saved.