MCPcopy
hub / github.com/Effect-TS/effect / toChannel

Function toChannel

packages/platform/src/Socket.ts:241–253  ·  view source on GitHub ↗
(
  self: Socket
)

Source from the content-addressed store, hash-verified

239 * @category combinators
240 */
241export const toChannel = <IE>(
242 self: Socket
243): Channel.Channel<
244 Chunk.Chunk<Uint8Array>,
245 Chunk.Chunk<Uint8Array | string | CloseEvent>,
246 SocketError | IE,
247 IE,
248 void,
249 unknown
250> => {
251 const encoder = new TextEncoder()
252 return toChannelMap(self, (data) => typeof data === "string" ? encoder.encode(data) : data)
253}
254
255/**
256 * @since 1.0.0

Callers 1

toChannelWithFunction · 0.70

Calls 2

toChannelMapFunction · 0.85
encodeMethod · 0.80

Tested by

no test coverage detected