downloadWithResume

fun downloadWithResume(url: String, targetFile: File, label: String): Boolean

Downloads a file from url to targetFile with HTTP Range resume support.

If the target file already exists partially (e.g., from a previous interrupted download), it sends a Range: bytes=<existing>- header so the server continues from where it left off. If the server does not support Range requests (no 206 response), the file is re-downloaded from the beginning.

Return

true if the download succeeded (or the file already existed at full size).

The method also creates a marker file (<targetFile>.complete) upon successful completion, which is used to quickly check.

Parameters

url

The URL to download.

targetFile

The destination file.

label

A human-readable label for log messages (e.g., "GGUF model").