MCPcopy
hub / github.com/vercel-labs/just-bash / readBytesFrom

Function readBytesFrom

packages/just-bash/src/encoding.ts:117–128  ·  view source on GitHub ↗
(
  fs: {
    readFileBytes?(path: string): Promise<ByteString>;
    readFileBuffer(path: string): Promise<Uint8Array>;
  },
  path: string,
)

Source from the content-addressed store, hash-verified

115 * working.
116 */
117export async function readBytesFrom(
118 fs: {
119 readFileBytes?(path: string): Promise<ByteString>;
120 readFileBuffer(path: string): Promise<Uint8Array>;
121 },
122 path: string,
123): Promise<ByteString> {
124 if (typeof fs.readFileBytes === "function") {
125 return fs.readFileBytes(path);
126 }
127 return bytesFromUint8Array(await fs.readFileBuffer(path));
128}
129
130// ---------------------------------------------------------------------------
131// Stdout shape helpers.

Callers 6

readFilesFunction · 0.85
processHeadTailFilesFunction · 0.85
odExecuteFunction · 0.85
split.tsFile · 0.85
readFileBytesMethod · 0.85

Calls 3

bytesFromUint8ArrayFunction · 0.85
readFileBytesMethod · 0.65
readFileBufferMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…