DownloadRequest
data class DownloadRequest(val id: String, val url: String, val savePath: String, val expectedChecksum: String? = null, val headers: Map<String, String> = emptyMap(), val resumable: Boolean = true)
Describes a file download to be performed in the background.
val download = DownloadRequest(
id = "avatar-download",
url = "https://cdn.example.com/avatar.jpg",
savePath = "/data/files/avatar.jpg",
expectedChecksum = "sha256:abc123...",
headers = mapOf("Authorization" to "Bearer token")
)
transferManager.download(download)Content copied to clipboard
Parameters
id
Unique task identifier.
url
URL to download from.
savePath
Local file path to save the downloaded file.
expectedChecksum
Optional SHA-256 checksum for verification (format: "sha256:hex").
headers
Optional HTTP headers to include.
resumable
Whether to support resume on interrupted downloads.