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