downloadToFile

private suspend fun downloadToFile(url: String, destination: File, onProgress: suspend (Int) -> Unit): File(source)

Streams a remote model file to disk and records the exact received byte count.

Return

The completed destination file.

Author

Dmitriy Moroz

Parameters

url

Remote model archive URL.

destination

File that receives the streamed response body.

onProgress

Callback invoked with integer percent progress when content length is known.

Throws

when OkHttp returns a non-successful response.