How to Build an Upload CLI That Recovers from Crashes and Expired URLs
A developer identified a critical flaw in a resumable upload CLI: when a process crashed mid-upload and the signed resume URL expired before restart, recovery failed entirely. The fix involves storing only durable identifiers in the checkpoint file — such as the upload ID and file fingerprint — rather than the short-lived signed URL. On restart, the tool fetches a fresh authorization token, queries the server for the current offset, and reconciles it with the local checkpoint before resuming. Atomic file writes via a temp-file-and-rename pattern prevent corrupted checkpoints from blocking recovery. The approach also includes fingerprint checks to detect changed local files and user-facing commands to inspect or clear upload state, ensuring resumability is transparent rather than a hidden dependency.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in