scoop:scoop.http.client:0.1.0
src/download/http_download_options_builder.scoop
Selected production source · src/download/http_download_options_builder.scoop
1
package scoop.http.client3
import scoop.http.HttpField4
import scoop.http.HttpResponseHead5
import scoop.platform.fs.Path6
import scoop.url.Url7
import scoop.http.*8
import scoop.http.asyncio.*9
import scoop.asyncio.*11
/** Configures one complete value; execution remains explicit. */12
public fun httpDownloadOptions(13
configure: HttpDownloadOptionsBuilder.() -> Unit = {}14
): HttpDownloadOptions {15
val builder = HttpDownloadOptionsBuilder()16
builder.configure()17
return builder.snapshot()18
}20
public fun HttpDownloadOptions.copy(21
configure: HttpDownloadOptionsBuilder.() -> Unit = {}22
): HttpDownloadOptions {23
val builder = HttpDownloadOptionsBuilder()24
builder.replaceExisting = this.replaceExisting25
builder.syncOnCommit = this.syncOnCommit26
builder.bufferSize = this.bufferSize27
builder.onProgress = this.onProgress28
builder.configure()29
return builder.snapshot()30
}32
public class HttpDownloadOptionsBuilder internal constructor() {33
public var replaceExisting: Boolean = false34
public var syncOnCommit: Boolean = false35
public var bufferSize: Long = 8192L36
public var onProgress: suspend (HttpDownloadProgress) -> Unit = suspend { _ -> }37
internal fun snapshot(): HttpDownloadOptions =38
HttpDownloadOptions(replaceExisting, syncOnCommit, bufferSize, onProgress)39
}