liveBook · Manning

Download resumption

As explained in Go in Practice, Second Edition

Download resumption is the continuation of a partially completed file transfer from the point at which previously received data ends.

Download resumption continues a partially completed transfer instead of wasting bandwidth by downloading the file from the beginning after a timeout. section 11.1.2

A practical implementation follows this sequence:

  • Set the HTTP Range header to request bytes beginning at the existing file length. section 11.1.2
  • Retry timed-out requests, limiting attempts and tuning the client timeout for the environment. section 11.1.2

Resuming a large archive

A program downloads file.zip, retries up to 100 times, and reports the number of bytes ultimately stored. If a timeout interrupts the transfer, the next request starts at the existing file length. section 11.1.2

How Go in Practice, Second Edition covers it

How deep it goes
Implements file-size inspection, Range construction, timeout configuration, and bounded retries.
Examples
Uses a local file.zip target, a remote archive URL, a 100-attempt retry limit, and a final byte-count report.
What it assumes
Assumes familiarity with files, HTTP requests, timeouts, and error handling while demonstrating the resume mechanism.
What you can do after
Apply it via Go's HTTP client to continue interrupted file transfers from their existing byte offset.
How it connects
Connects HTTP Range requests with timeouts, retries, and network-error detection.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Go in Practice, Second Edition. The section links point to the parts of the book it draws on.