| 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) |