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

Function stream

packages/effect/src/http/HttpServerResponse.ts:474–492  ·  view source on GitHub ↗
(
  body: Stream.Stream<Uint8Array, E>,
  options?: Options | undefined
)

Source from the content-addressed store, hash-verified

472 * @since 4.0.0
473 */
474export const stream = <E>(
475 body: Stream.Stream<Uint8Array, E>,
476 options?: Options | undefined
477): HttpServerResponse => {
478 const headers = options?.headers
479 ? Headers.fromInput(options.headers)
480 : Headers.empty
481 return makeResponse({
482 status: options?.status ?? 200,
483 statusText: options?.statusText,
484 headers,
485 cookies: options?.cookies,
486 body: Body.stream(
487 body,
488 getContentType(options, headers),
489 options?.contentLength
490 )
491 })
492}
493
494const HttpPlatformKey = Context.Service<
495 HttpPlatform,

Callers 1

htmlStreamFunction · 0.70

Calls 3

getContentTypeFunction · 0.85
makeResponseFunction · 0.70
streamMethod · 0.65

Tested by

no test coverage detected