MCPcopy Create free account
hub / github.com/Effect-TS/effect / writeChunk

Function writeChunk

packages/effect/src/socket/Socket.ts:577–591  ·  view source on GitHub ↗
(
  writer: Writer,
  chunk: NonEmptyReadonlyArray<Uint8Array | string | CloseEvent>
)

Source from the content-addressed store, hash-verified

575 new SocketError({ reason: new SocketCloseError({ code, closeReason }) })
576
577const 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
593const toChannelWithReader = <A extends Uint8Array | string, IE>(
594 self: Socket,

Callers 1

toChannelWithReaderFunction · 0.70

Calls 3

isCloseEventFunction · 0.85
writeMethod · 0.65
writeAllMethod · 0.45

Tested by

no test coverage detected