toByteStream

fun <Error class: unknown class><ByteArray>.toByteStream(scope: <Error class: unknown class>, contentLength: Long? = null): ByteStream

Create a ByteStream from a Flow of byte arrays.

Parameters

scope

the CoroutineScope to use for launching a coroutine to do the collection in.

contentLength

the overall content length of the Flow (if known). If set this will be used as ByteStream.contentLength. Some APIs require a known Content-Length header and since the total size of the flow can't be calculated without collecting it callers should set this parameter appropriately in those cases.