DownloadResult

sealed interface DownloadResult

Represents the state of a file download from initial bytes to completion.

Errors are propagated as exceptions on the Flow, not as sealed states, so collectors can use try/catch or catch { } operators (see kotlinx.coroutines.flow.catch).

Inheritors

Types

Link copied to clipboard
data class Complete(val bytes: ByteArray) : DownloadResult

Terminal success state. Always the last element emitted before Flow completion.

Link copied to clipboard
data class Progress(val bytesRead: Long, val contentLength: Long?) : DownloadResult

Emitted repeatedly as bytes are streamed from the server.