vertx / io.vertx.kotlin.coroutines / io.vertx.core.streams.ReadStream / toChannel

# toChannel

`fun <T> ReadStream<T>.toChannel(vertx: Vertx, capacity: Int = 256): ReceiveChannel<T>`

Adapts the current read stream to Kotlin ReceiveChannel.

The channel can be used to receive the read stream items, the stream is paused when the channel is full and resumed when the channel is half empty.

### Parameters

`vertx` - the related vertx instance

`capacity` - the channel buffering capacity

`fun <T> ReadStream<T>.toChannel(context: Context, capacity: Int = 256): ReceiveChannel<T>`

Adapts the current read stream to Kotlin ReceiveChannel.

The channel can be used to receive the read stream items, the stream is paused when the channel is full and resumed when the channel is half empty.

### Parameters

`context` - the vertx context

`capacity` - the channel buffering capacity