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

Function toUint8Array

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

Source from the content-addressed store, hash-verified

509};
510
511const toUint8Array = (value: unknown): Uint8Array | null => {
512 if (value instanceof Uint8Array) return value;
513 if (value instanceof ArrayBuffer) return new Uint8Array(value);
514 if (ArrayBuffer.isView(value)) {
515 const view = value as ArrayBufferView;
516 return new Uint8Array(view.buffer, view.byteOffset, view.byteLength);
517 }
518 if (Array.isArray(value) && value.every((v) => typeof v === "number")) {
519 return new Uint8Array(value as readonly number[]);
520 }
521 return null;
522};
523
524const readNestedBodyBase64 = (value: unknown): unknown =>
525 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