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

Function fromWritableChannel

packages/platform-node-shared/src/internal/sink.ts:19–39  ·  view source on GitHub ↗
(
  writable: LazyArg<Writable | NodeJS.WritableStream>,
  onError: (error: unknown) => OE,
  options?: FromWritableOptions
)

Source from the content-addressed store, hash-verified

17
18/** @internal */
19export const fromWritableChannel = <IE, OE, A>(
20 writable: LazyArg<Writable | NodeJS.WritableStream>,
21 onError: (error: unknown) => OE,
22 options?: FromWritableOptions
23): Channel.Channel<Chunk.Chunk<never>, Chunk.Chunk<A>, IE | OE, IE, void, unknown> =>
24 Channel.flatMap(
25 Effect.zip(
26 Effect.sync(() => writable()),
27 Deferred.make<void, IE | OE>()
28 ),
29 ([writable, deferred]) =>
30 Channel.embedInput(
31 writableOutput(writable, deferred, onError),
32 writeInput<IE, A>(
33 writable,
34 (cause) => Deferred.failCause(deferred, cause),
35 options,
36 Deferred.complete(deferred, Effect.void)
37 )
38 )
39 )
40
41const writableOutput = <IE, E>(
42 writable: Writable | NodeJS.WritableStream,

Callers 1

fromWritableFunction · 0.85

Calls 7

writableOutputFunction · 0.85
writeInputFunction · 0.85
syncMethod · 0.80
failCauseMethod · 0.80
completeMethod · 0.80
zipMethod · 0.65
makeMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…