DownloadRequest

data class DownloadRequest(val url: String, val destination: String, val expectedSha256: String? = null, val expectedSizeBytes: Long? = null, val headers: Map<String, String> = emptyMap())(source)

A model to download.

Constructors

Link copied to clipboard
constructor(url: String, destination: String, expectedSha256: String? = null, expectedSizeBytes: Long? = null, headers: Map<String, String> = emptyMap())

Types

Link copied to clipboard
object Companion

Constants and factory functions of DownloadRequest.

Properties

Link copied to clipboard

final file path. Bytes are written to "$destination.part" and atomically moved here only after the size and SHA-256 checks pass, so destination is never partially written.

Link copied to clipboard

lowercase or uppercase hex SHA-256; when set, a mismatch deletes the partial file and fails with ChecksumMismatchException, and an existing destination is reused only if it matches.

Link copied to clipboard

when set, a different size (announced by the server or written) fails with DownloadSizeMismatchException.

Link copied to clipboard

extra request headers (for example Authorization).

Link copied to clipboard

Path of the partial file used while downloading.

Link copied to clipboard
val url: String

HTTP(S) URL.