()
| 33 | |
| 34 | private textEffect: Effect.Effect<string, E> | undefined |
| 35 | get text(): Effect.Effect<string, E> { |
| 36 | if (this.textEffect) { |
| 37 | return this.textEffect |
| 38 | } |
| 39 | this.textEffect = Effect.runSync(Effect.cached( |
| 40 | Effect.flatMap( |
| 41 | IncomingMessage.MaxBodySize, |
| 42 | (maxBodySize) => |
| 43 | NodeStream.toString(() => this.source, { |
| 44 | onFailure: this.onError, |
| 45 | maxBytes: Option.getOrUndefined(maxBodySize) |
| 46 | }) |
| 47 | ) |
| 48 | )) |
| 49 | return this.textEffect |
| 50 | } |
| 51 | |
| 52 | get unsafeText(): string { |
| 53 | return Effect.runSync(this.text) |