MCPcopy
hub / github.com/di-sukharev/opencommit / getBytes

Function getBytes

out/cli.cjs:69449–69464  ·  view source on GitHub ↗
(value)

Source from the content-addressed store, hash-verified

69447 if (!options.type) {
69448 const type2 = bits[0]?.type;
69449 if (typeof type2 === "string") {
69450 options = { ...options, type: type2 };
69451 }
69452 }
69453 return new File2(bits, name, options);
69454}
69455async function getBytes(value) {
69456 let parts = [];
69457 if (typeof value === "string" || ArrayBuffer.isView(value) || // includes Uint8Array, Buffer, etc.
69458 value instanceof ArrayBuffer) {
69459 parts.push(value);
69460 } else if (isBlobLike(value)) {
69461 parts.push(await value.arrayBuffer());
69462 } else if (isAsyncIterableIterator(value)) {
69463 for await (const chunk of value) {
69464 parts.push(chunk);
69465 }
69466 } else {
69467 throw new Error(`Unexpected data type: ${typeof value}; constructor: ${value?.constructor?.name}; props: ${propsForError(value)}`);

Callers 1

toFileFunction · 0.85

Calls 5

isBlobLikeFunction · 0.85
isAsyncIterableIteratorFunction · 0.85
propsForErrorFunction · 0.85
pushMethod · 0.45
arrayBufferMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…