MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / toUint8Array

Function toUint8Array

packages/plugins/openapi/src/sdk/invoke.ts:506–517  ·  view source on GitHub ↗
(value: unknown)

Source from the content-addressed store, hash-verified

504};
505
506const toUint8Array = (value: unknown): Uint8Array | null => {
507 if (value instanceof Uint8Array) return value;
508 if (value instanceof ArrayBuffer) return new Uint8Array(value);
509 if (ArrayBuffer.isView(value)) {
510 const view = value as ArrayBufferView;
511 return new Uint8Array(view.buffer, view.byteOffset, view.byteLength);
512 }
513 if (Array.isArray(value) && value.every((v) => typeof v === "number")) {
514 return new Uint8Array(value as readonly number[]);
515 }
516 return null;
517};
518
519const readNestedBodyBase64 = (value: unknown): unknown =>
520 typeof value === "object" &&

Callers 3

coerceFormDataRecordFunction · 0.85
applyRequestBodyFunction · 0.85
invoke.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected