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

Function toUint8Array

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

Source from the content-addressed store, hash-verified

470};
471
472const toUint8Array = (value: unknown): Uint8Array | null => {
473 if (value instanceof Uint8Array) return value;
474 if (value instanceof ArrayBuffer) return new Uint8Array(value);
475 if (ArrayBuffer.isView(value)) {
476 const view = value as ArrayBufferView;
477 return new Uint8Array(view.buffer, view.byteOffset, view.byteLength);
478 }
479 if (Array.isArray(value) && value.every((v) => typeof v === "number")) {
480 return new Uint8Array(value as readonly number[]);
481 }
482 return null;
483};
484
485const readNestedBodyBase64 = (value: unknown): unknown =>
486 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