Converting Stream to ReadableStream with side effects

Let's say I have a stream of values and I want to create ReadableStream from it, but also run some side effect for each element in the stream - regardless whether ReadableStream consumer will pull it. The only thing I figured out is something like this:

      const value = yield* stream.pipe(
        Stream.tap(Effect.log),
        Stream.buffer({ capacity: "unbounded" }),
        Stream.toReadableStreamEffect()
      );


But this feels somehow wrong 😄 Is there any solution I could use here?
Was this page helpful?