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

Function sendStream

packages/platform/node/src/NodeHttpClient.ts:797–819  ·  view source on GitHub ↗
(
  nodeRequest: Http.ClientRequest,
  request: HttpClientRequest,
  stream: Stream.Stream<Uint8Array, Error.HttpClientError>
)

Source from the content-addressed store, hash-verified

795 })
796
797const sendStream = (
798 nodeRequest: Http.ClientRequest,
799 request: HttpClientRequest,
800 stream: Stream.Stream<Uint8Array, Error.HttpClientError>
801): Effect.Effect<void, Error.HttpClientError> =>
802 Stream.run(
803 stream,
804 NodeSink.fromWritable({
805 evaluate: () => nodeRequest,
806 // The upload fiber owns destruction after observing body failures.
807 endOnDone: false,
808 onError: (cause) =>
809 new Error.HttpClientError({
810 reason: new Error.TransportError({
811 request,
812 cause
813 })
814 })
815 })
816 ).pipe(Effect.andThen(() => {
817 nodeRequest.end()
818 return waitForFinish(nodeRequest, request)
819 }))
820
821/**
822 * Encodes form data as multipart with the global `Response`, so the encoding

Callers 1

sendBodyFunction · 0.85

Calls 4

waitForFinishFunction · 0.85
pipeMethod · 0.65
runMethod · 0.65
endMethod · 0.65

Tested by

no test coverage detected