ktor-client-core / io.ktor.client.content / LocalFileContent

LocalFileContent

class LocalFileContent : ReadChannelContent

OutgoingContent representing a local file with a specified contentType, expires date and caching

Parameters

file - specifies the File to be served to a client

Constructors

<init>

LocalFileContent(file: File, contentType: ContentType = ContentType.defaultForFile(file))

OutgoingContent representing a local file with a specified contentType, expires date and caching

Properties

contentLength

val contentLength: Long

contentType

val contentType: ContentType

file

val file: File

specifies the File to be served to a client

Functions

readFrom

fun readFrom(): ByteReadChannel
fun readFrom(range: LongRange): ByteReadChannel

Extension Functions

wrapHeaders

fun OutgoingContent.wrapHeaders(block: (Headers) -> Headers): OutgoingContent

Generates a new OutgoingContent of the same abstract type but with OutgoingContent.headers transformed by the specified block.