/**
* Like `Stream.runForEachChunk`, but returns a scoped `Effect` so the
* finalization order can be controlled.
*
* @tsplus static effect/core/stream/Stream.Aspects runForEachChunkScoped
* @tsplus pipeable effect/core/stream/Stream runForEachChunkScoped
*/
export function runForEachChunkScoped(
f: (chunk: Chunk) => Effect
) {
return (self: Stream): Effect =>
self.runScoped(
Sink.forEachChunk(f)
)
}