/** * Converts the stream to a scoped queue of chunks. After the scope is closed, * the queue will never again produce values and should be discarded. * * @tsplus static effect/core/stream/Stream.Aspects toQueue * @tsplus pipeable effect/core/stream/Stream toQueue */ export function toQueue(capacity = 2) { return (self: Stream): Effect>> => Effect.acquireRelease( Queue.bounded>(capacity), (queue) => queue.shutdown ).tap((queue) => self.runIntoQueueScoped(queue).forkScoped) }