ModelDownloader
Resumable, chunked model downloader using HTTP Range requests.
Data is requested in chunkSizeBytes ranges and appended to
<destination>.part. An interrupted download (network error, cancellation, app kill) resumes from the partial file's size.Network errors and HTTP 408/429/5xx are retried up to maxRetries times in a row with exponential backoff starting at initialRetryDelay; the counter resets after every chunk that makes progress.
Servers that ignore
Range(HTTP 200) restart the download from byte 0.The finished file's size and SHA-256 are verified before it is atomically moved to the destination; on a mismatch the partial file is deleted so the next attempt starts clean.
Collection is cancellable at chunk-read granularity; the partial file is kept for a later resume.
Constructors
Types
Constants and factory functions of ModelDownloader.
Functions
Downloads request, emitting DownloadEvents and ending with DownloadEvent.Completed.
Downloads request and returns the DownloadEvent.Completed event.