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

Function htmlStream

packages/effect/src/unstable/http/HttpServerResponse.ts:257–277  ·  view source on GitHub ↗
(
  strings: TemplateStringsArray,
  ...args: A
)

Source from the content-addressed store, hash-verified

255 * @since 4.0.0
256 */
257export const htmlStream = <
258 A extends ReadonlyArray<Template.InterpolatedWithStream>
259>(
260 strings: TemplateStringsArray,
261 ...args: A
262): Effect.Effect<
263 HttpServerResponse,
264 never,
265 Template.Interpolated.Context<A[number]>
266> =>
267 Effect.map(
268 Effect.context<Template.Interpolated.Context<A[number]>>(),
269 (context) =>
270 stream(
271 Stream.provideContext(
272 Stream.encodeText(Template.stream(strings, ...args)),
273 context
274 ),
275 { contentType: "text/html" }
276 )
277 )
278
279/**
280 * Creates a JSON HTTP response.

Callers

nothing calls this directly

Calls 4

contextMethod · 0.80
streamFunction · 0.70
streamMethod · 0.65
mapMethod · 0.45

Tested by

no test coverage detected