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

Function fromWritableStream

packages/effect/src/Channel.ts:1867–1875  ·  view source on GitHub ↗
(options: {
  readonly evaluate: LazyArg<WritableStream<A>>
  readonly onError: (error: unknown) => E
  readonly closeOnDone?: boolean | undefined
})

Source from the content-addressed store, hash-verified

1865 * @since 4.0.0
1866 */
1867export const fromWritableStream = <IE, E, A>(options: {
1868 readonly evaluate: LazyArg<WritableStream<A>>
1869 readonly onError: (error: unknown) => E
1870 readonly closeOnDone?: boolean | undefined
1871}): Channel<never, IE | E, void, Arr.NonEmptyReadonlyArray<A>, IE> =>
1872 fromTransform((pull: Pull.Pull<Arr.NonEmptyReadonlyArray<A>, IE, unknown>) => {
1873 const writable = options.evaluate()
1874 return Effect.succeed(pullIntoWritableStream({ ...options, writable, pull }))
1875 })
1876
1877/**
1878 * Creates a channel backed by a Web `TransformStream`, writing upstream values

Callers

nothing calls this directly

Calls 4

pullIntoWritableStreamFunction · 0.85
fromTransformFunction · 0.70
evaluateMethod · 0.65
succeedMethod · 0.45

Tested by

no test coverage detected