Skip to content

Instantly share code, notes, and snippets.

@mrenouf
Created December 29, 2025 17:55
Show Gist options
  • Select an option

  • Save mrenouf/ce82af4fa7012982740783101ff13b05 to your computer and use it in GitHub Desktop.

Select an option

Save mrenouf/ce82af4fa7012982740783101ff13b05 to your computer and use it in GitHub Desktop.
import import kotlinx.io.Source
import kotlinx.io.readLine
import kotlinx.serialization.json.Json
private inline fun <reified T> jsonlFlowOf(json: Json, source: Source): Flow<T> {
return flow {
val line = source.readLine() ?: return@flow
emit(json.decodeFromString(line))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment