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

Method arrayBuffer

packages/platform/node/src/NodeHttpClient.ts:324–341  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

322
323 private arrayBufferBody?: Effect.Effect<ArrayBuffer, Error.HttpClientError>
324 get arrayBuffer(): Effect.Effect<ArrayBuffer, Error.HttpClientError> {
325 if (this.arrayBufferBody) {
326 return this.arrayBufferBody
327 }
328 this.arrayBufferBody = Effect.tryPromise({
329 try: () => this.source.body.arrayBuffer(),
330 catch: (cause) =>
331 new Error.HttpClientError({
332 reason: new Error.DecodeError({
333 request: this.request,
334 response: this,
335 cause
336 })
337 })
338 }).pipe(Effect.cached, Effect.runSync)
339 this.textBody = Effect.map(this.arrayBufferBody, (_) => new TextDecoder().decode(_))
340 return this.arrayBufferBody
341 }
342
343 toJSON(): unknown {
344 return IncomingMessage.inspect(this, {

Callers 1

Calls 2

pipeMethod · 0.65
mapMethod · 0.45

Tested by

no test coverage detected