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

Function fromWritableStream

packages/effect/src/Channel.ts:1745–1753  ·  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

1743 * @since 4.0.0
1744 */
1745export const fromWritableStream = <IE, E, A>(options: {
1746 readonly evaluate: LazyArg<WritableStream<A>>
1747 readonly onError: (error: unknown) => E
1748 readonly closeOnDone?: boolean | undefined
1749}): Channel<never, IE | E, void, Arr.NonEmptyReadonlyArray<A>, IE> =>
1750 fromTransform((pull: Pull.Pull<Arr.NonEmptyReadonlyArray<A>, IE, unknown>) => {
1751 const writable = options.evaluate()
1752 return Effect.succeed(pullIntoWritableStream({ ...options, writable, pull }))
1753 })
1754
1755/**
1756 * 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