writeTo

suspend fun Flow<ByteArray>.writeTo(file: Path, vararg options: OpenOption = arrayOf( StandardOpenOption.WRITE, StandardOpenOption.CREATE ))

Writes the content of this Flow of ByteArrays to the specified file.

Parameters

file

The file path to write to.

options

The options specifying how the file is opened. Defaults to StandardOpenOption.WRITE and StandardOpenOption.CREATE.

Example usage:

val file: Path = ...
val byteArrayFlow: Flow<ByteArray> = ...
byteArrayFlow.writeTo(file)