ResumableUpload

sealed interface ResumableUpload(source)

Represents a resumable upload. Can be paused, resumed or cancelled. The upload urls are automatically cashed, so you can resume the upload after your program crashed or the network reconnected without losing the upload progress. You can customize the caching in Storage.Config

Properties

Link copied to clipboard
abstract val fingerprint: Fingerprint

The upload fingerprint

Link copied to clipboard
abstract val stateFlow: StateFlow<ResumableUploadState>

The current upload progress as a StateFlow. The UploadStatus contains the total bytes sent and the total size of the upload. At the end of the upload, the UploadStatus will be UploadStatus.Success.

Functions

Link copied to clipboard
abstract suspend fun cancel()

Cancels this upload and removes the upload url from the cache.

Link copied to clipboard
abstract suspend fun pause()

Pauses this upload after the current chunk has been uploaded. Can be resumed using startOrResumeUploading. If the upload is already paused, this method does nothing.

Link copied to clipboard
abstract suspend fun startOrResumeUploading()

Starts or resumes this upload. Location url may be retrieved from the cache, so can start of after your program crashed or the network reconnected.