( self: Socket )
| 442 | * @since 4.0.0 |
| 443 | */ |
| 444 | export const toChannel = <IE>( |
| 445 | self: Socket |
| 446 | ): Channel.Channel< |
| 447 | NonEmptyReadonlyArray<Uint8Array>, |
| 448 | SocketError | IE, |
| 449 | void, |
| 450 | NonEmptyReadonlyArray<Uint8Array | string | CloseEvent>, |
| 451 | IE |
| 452 | > => { |
| 453 | const encoder = new TextEncoder() |
| 454 | return toChannelMap(self, (data) => typeof data === "string" ? encoder.encode(data) : data) |
| 455 | } |
| 456 | |
| 457 | /** |
| 458 | * Converts a `Socket` into a string `Channel`, decoding binary frames with the |
no test coverage detected