(handler: (_: Uint8Array) => Effect.Effect<_, E, R> | void, opts?: {
readonly onOpen?: Effect.Effect<void> | undefined
})
| 490 | |
| 491 | const encoder = new TextEncoder() |
| 492 | const run = <_, E, R>(handler: (_: Uint8Array) => Effect.Effect<_, E, R> | void, opts?: { |
| 493 | readonly onOpen?: Effect.Effect<void> | undefined |
| 494 | }) => |
| 495 | runRaw((data) => |
| 496 | typeof data === "string" |
| 497 | ? handler(encoder.encode(data)) |
| 498 | : data instanceof Uint8Array |
| 499 | ? handler(data) |
| 500 | : handler(new Uint8Array(data)), opts) |
| 501 | |
| 502 | const write = (chunk: Uint8Array | string | CloseEvent) => |
| 503 | latch.whenOpen(Effect.sync(() => { |