MCPcopy Create free account
hub / github.com/awslabs/llrt / array_buffer

Method array_buffer

modules/llrt_fetch/src/request.rs:423–436  ·  view source on GitHub ↗
(&self, ctx: Ctx<'js>)

Source from the content-addressed store, hash-verified

421 }
422
423 fn array_buffer(&self, ctx: Ctx<'js>) -> Result<Promise<'js>> {
424 let body = match self.take_body_sync(&ctx) {
425 Ok(b) => b,
426 Err(e) => return reject_with_error(&ctx, e),
427 };
428 let ctx_clone = ctx.clone();
429 Promise::wrap_future(&ctx, async move {
430 let bytes_opt = resolve_body_taken(&ctx_clone, body).await?;
431 if let Some(bytes) = bytes_opt {
432 return ArrayBuffer::new(ctx_clone, bytes);
433 }
434 ArrayBuffer::new(ctx_clone, Vec::<u8>::new())
435 })
436 }
437
438 fn bytes(&self, ctx: Ctx<'js>) -> Result<Promise<'js>> {
439 let body = match self.take_body_sync(&ctx) {

Callers

nothing calls this directly

Calls 4

reject_with_errorFunction · 0.85
resolve_body_takenFunction · 0.85
take_body_syncMethod · 0.80
cloneMethod · 0.45

Tested by

no test coverage detected