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

Function fromWritableChannel

packages/platform/node-shared/src/NodeSink.ts:47–58  ·  view source on GitHub ↗
(
  options: {
    readonly evaluate: LazyArg<Writable | NodeJS.WritableStream>
    readonly onError: (error: unknown) => E
    readonly endOnDone?: boolean | undefined
    readonly encoding?: BufferEncoding | undefined
  }
)

Source from the content-addressed store, hash-verified

45 * @since 4.0.0
46 */
47export const fromWritableChannel = <IE, E, A = Uint8Array | string>(
48 options: {
49 readonly evaluate: LazyArg<Writable | NodeJS.WritableStream>
50 readonly onError: (error: unknown) => E
51 readonly endOnDone?: boolean | undefined
52 readonly encoding?: BufferEncoding | undefined
53 }
54): Channel.Channel<never, IE | E, void, NonEmptyReadonlyArray<A>, IE> =>
55 Channel.fromTransform((pull: Pull.Pull<NonEmptyReadonlyArray<A>, IE, unknown>) => {
56 const writable = options.evaluate() as Writable
57 return Effect.succeed(pullIntoWritable({ ...options, writable, pull }))
58 })
59
60/**
61 * Writes Effect chunks into a Node writable stream.

Callers 1

fromWritableFunction · 0.85

Calls 3

pullIntoWritableFunction · 0.85
evaluateMethod · 0.65
succeedMethod · 0.45

Tested by

no test coverage detected