(controller)
| 7251 | |
| 7252 | return new ReadableStream<A>({ |
| 7253 | start(controller) { |
| 7254 | fiber = runFork(runForEachChunk(self, (chunk) => { |
| 7255 | if (chunk.length === 0) return Effect.void |
| 7256 | return latch.whenOpen(Effect.sync(() => { |
| 7257 | latch.unsafeClose() |
| 7258 | for (const item of chunk) { |
| 7259 | controller.enqueue(item) |
| 7260 | } |
| 7261 | currentResolve!() |
| 7262 | currentResolve = undefined |
| 7263 | })) |
| 7264 | })) |
| 7265 | fiber.addObserver((exit) => { |
| 7266 | try { |
| 7267 | if (exit._tag === "Failure") { |
| 7268 | controller.error(Cause.squash(exit.cause)) |
| 7269 | } else { |
| 7270 | controller.close() |
| 7271 | } |
| 7272 | } catch { |
| 7273 | // ignore |
| 7274 | } |
| 7275 | }) |
| 7276 | }, |
| 7277 | pull() { |
| 7278 | return new Promise<void>((resolve) => { |
| 7279 | currentResolve = resolve |
nothing calls this directly
no test coverage detected