ModelDownloader

Streams a model file to local storage with progress. Follows redirects manually so a Hugging Face resolve URL (which 302s to a signed CDN link) works, and only sends the auth token to the first host — never to the CDN.

Functions

Link copied to clipboard
suspend fun download(urlString: String, dest: File, token: String?, onProgress: (downloaded: Long, total: Long) -> Unit): Result<Unit>
Link copied to clipboard
suspend fun installLocal(context: Context, uri: Uri, dest: File): Result<Unit>

Copies a model file the user already has on-device (picked via SAF) into place.