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

Function toUint8Array

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

Source from the content-addressed store, hash-verified

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