( writer: Writer, chunk: NonEmptyReadonlyArray<Uint8Array | string | CloseEvent> )
| 575 | new SocketError({ reason: new SocketCloseError({ code, closeReason }) }) |
| 576 | |
| 577 | const writeChunk = ( |
| 578 | writer: Writer, |
| 579 | chunk: NonEmptyReadonlyArray<Uint8Array | string | CloseEvent> |
| 580 | ): Effect.Effect<void, SocketError> => { |
| 581 | for (let i = 0; i < chunk.length; i++) { |
| 582 | if (isCloseEvent(chunk[i])) { |
| 583 | return Effect.gen(function*() { |
| 584 | for (let index = 0; index <= i; index++) { |
| 585 | yield* writer.write(chunk[index]) |
| 586 | } |
| 587 | }) |
| 588 | } |
| 589 | } |
| 590 | return writer.writeAll(chunk as NonEmptyReadonlyArray<Uint8Array | string>) |
| 591 | } |
| 592 | |
| 593 | const toChannelWithReader = <A extends Uint8Array | string, IE>( |
| 594 | self: Socket, |
no test coverage detected