respondBytesWriter

suspend fun ApplicationCall.respondBytesWriter(contentType: ContentType? = null, status: HttpStatusCode? = null, contentLength: Long? = null, producer: suspend ByteWriteChannel.() -> Unit)(source)

Respond with a binary content producer.

The producer parameter will be called later when an engine is ready to produce content. You don't need to close it. The provided ByteWriteChannel will be closed automatically.

Report a problem

Parameters

contentType

An optional ContentType, defaults to "application/octet-stream"

status

An optional HttpStatusCode, defaults to HttpStatusCode.OK unless already assigned

contentLength

An optional value included in the Content-Length header, also truncating content

producer

A function producing content.