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

Function getBytes2

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

Source from the content-addressed store, hash-verified

80394 if (!options.type) {
80395 const type2 = bits[0]?.type;
80396 if (typeof type2 === "string") {
80397 options = { ...options, type: type2 };
80398 }
80399 }
80400 return new File4(bits, name, options);
80401}
80402async function getBytes2(value) {
80403 let parts = [];
80404 if (typeof value === "string" || ArrayBuffer.isView(value) || // includes Uint8Array, Buffer, etc.
80405 value instanceof ArrayBuffer) {
80406 parts.push(value);
80407 } else if (isBlobLike2(value)) {
80408 parts.push(await value.arrayBuffer());
80409 } else if (isAsyncIterableIterator2(value)) {
80410 for await (const chunk of value) {
80411 parts.push(chunk);
80412 }
80413 } else {
80414 throw new Error(`Unexpected data type: ${typeof value}; constructor: ${value?.constructor?.name}; props: ${propsForError2(value)}`);

Callers 1

toFile2Function · 0.85

Calls 5

isBlobLike2Function · 0.85
isAsyncIterableIterator2Function · 0.85
propsForError2Function · 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…