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

Function text

packages/platform/node/src/NodeHttpIncomingMessage.ts:75–91  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

73
74 private textEffect: Effect.Effect<string, E> | undefined
75 get text(): Effect.Effect<string, E> {
76 if (this.textEffect) {
77 return this.textEffect
78 }
79 this.textEffect = Effect.runSync(Effect.cached(
80 Effect.flatMap(
81 IncomingMessage.MaxBodySize,
82 (maxBodySize) =>
83 NodeStream.toString(() => this.source, {
84 onError: this.onError,
85 maxBytes: maxBodySize
86 })
87 )
88 ))
89 this.arrayBufferEffect = Effect.map(this.textEffect, (_) => new TextEncoder().encode(_).buffer)
90 return this.textEffect
91 }
92
93 get textUnsafe(): string {
94 return Effect.runSync(this.text)

Callers

nothing calls this directly

Calls 2

toStringMethod · 0.65
mapMethod · 0.45

Tested by

no test coverage detected