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

Method bytes

packages/effect/src/http/HttpServerRequest.ts:817–829  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

815
816 private bytesEffect: Effect.Effect<Uint8Array, HttpServerError> | undefined
817 private get bytes(): Effect.Effect<Uint8Array, HttpServerError> {
818 if (this.bytesEffect) {
819 return this.bytesEffect
820 }
821 this.bytesEffect = Effect.withFiber((fiber) => {
822 const maxBodySize = fiber.getRef(HttpIncomingMessage.MaxBodySize)
823 return this.readBytes(maxBodySize === undefined ? undefined : Number(maxBodySize))
824 }).pipe(
825 Effect.cached,
826 Effect.runSync
827 )
828 return this.bytesEffect
829 }
830
831 private readBytes(maxBytes: number | undefined): Effect.Effect<Uint8Array, HttpServerError> {
832 const body = this.source.body

Callers

nothing calls this directly

Calls 4

readBytesMethod · 0.95
getRefMethod · 0.80
pipeMethod · 0.65
NumberFunction · 0.50

Tested by

no test coverage detected