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

Function fromReadableChannel

packages/platform/node-shared/src/NodeStream.ts:54–68  ·  view source on GitHub ↗
(options: {
  readonly evaluate: LazyArg<Readable | NodeJS.ReadableStream>
  readonly onError?: (error: unknown) => E
  readonly chunkSize?: number | undefined
  readonly closeOnDone?: boolean | undefined
})

Source from the content-addressed store, hash-verified

52 * @since 4.0.0
53 */
54export const fromReadableChannel = <A = Uint8Array, E = Cause.UnknownError>(options: {
55 readonly evaluate: LazyArg<Readable | NodeJS.ReadableStream>
56 readonly onError?: (error: unknown) => E
57 readonly chunkSize?: number | undefined
58 readonly closeOnDone?: boolean | undefined
59}): Channel.Channel<Arr.NonEmptyReadonlyArray<A>, E> =>
60 Channel.fromTransform((_, scope) =>
61 readableToPullUnsafe({
62 scope,
63 readable: options.evaluate(),
64 onError: options.onError ?? defaultOnError as any,
65 chunkSize: options.chunkSize,
66 closeOnDone: options.closeOnDone
67 })
68 )
69
70/**
71 * Creates a `Channel` over a Node `Duplex`, writing upstream chunks with

Callers 1

fromReadableFunction · 0.85

Calls 2

readableToPullUnsafeFunction · 0.85
evaluateMethod · 0.65

Tested by

no test coverage detected