android-components / mozilla.components.browser.state.state.content / DownloadState

DownloadState

data class DownloadState (source)

Value type that represents a download request.

Constructors

Name Summary
<init> DownloadState(url: String, fileName: String? = null, contentType: String? = null, contentLength: Long? = null, userAgent: String? = null, destinationDirectory: String = Environment.DIRECTORY_DOWNLOADS, filePath: String = Environment.getExternalStoragePublicDirectory(destinationDirectory).path + "/" + fileName, referrerUrl: String? = null, skipConfirmation: Boolean = false, id: Long = Random.nextLong())
Value type that represents a download request.

Properties

Name Summary
contentLength val contentLength: Long?
The file size reported by the server.
contentType val contentType: String?
Content type (MIME type) to indicate the media type of the download.
destinationDirectory val destinationDirectory: String
The matching destination directory for this type of download.
fileName val fileName: String?
A canonical filename for this download.
filePath val filePath: String
The file path the file was saved at.
id val id: Long
The unique identifier of this download.
referrerUrl val referrerUrl: String?
The site that linked to this download.
skipConfirmation val skipConfirmation: Boolean
Whether or not the confirmation dialog should be shown before the download begins.
url val url: String
The full url to the content that should be downloaded.
userAgent val userAgent: String?
The user agent to be used for the download.

Extension Functions

Name Summary
loadResourceAsString fun Any.loadResourceAsString(path: String): String
Loads a file from the resources folder and returns its content as a string object.