Skip to content

Commit

Permalink
Optimise conversion from Blob to Stream
Browse files Browse the repository at this point in the history
Motivated by http4s/http4s#7539
  • Loading branch information
Baccata committed Oct 11, 2024
1 parent ae5b9de commit 6d47764
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,8 @@ package object kernel {

private def toStream[F[_]](
blob: Blob
): Stream[F, Byte] = Stream.chunk(Chunk.array(blob.toArray))
): Stream[F, Byte] =
// Optimisation motivated by https://github.com/http4s/http4s/issues/7539
if (blob.isEmpty) Stream.empty else Stream.chunk(Chunk.array(blob.toArray))

}

0 comments on commit 6d47764

Please sign in to comment.