| 123 | |
| 124 | private arrayBufferEffect: Effect.Effect<ArrayBuffer, E> | undefined |
| 125 | get arrayBuffer(): Effect.Effect<ArrayBuffer, E> { |
| 126 | if (this.arrayBufferEffect) { |
| 127 | return this.arrayBufferEffect |
| 128 | } |
| 129 | this.arrayBufferEffect = Effect.withFiber((fiber) => |
| 130 | NodeStream.toArrayBuffer(() => this.source, { |
| 131 | onError: this.onError, |
| 132 | maxBytes: fiber.getRef(IncomingMessage.MaxBodySize) |
| 133 | }) |
| 134 | ).pipe( |
| 135 | Effect.cached, |
| 136 | Effect.runSync |
| 137 | ) |
| 138 | this.textEffect = Effect.map(this.arrayBufferEffect, (_) => new TextDecoder().decode(_)) |
| 139 | return this.arrayBufferEffect |
| 140 | } |
| 141 | } |