MCPcopy Create free account
hub / github.com/cloudflare/agents / readFileBytes

Method readFileBytes

packages/shell/src/fs/in-memory-fs.ts:219–235  ·  view source on GitHub ↗
(path: string)

Source from the content-addressed store, hash-verified

217 }
218
219 async readFileBytes(path: string): Promise<Uint8Array> {
220 validatePath(path, "open");
221 if (normalizePath(path) === "/") {
222 throw new Error(
223 `EISDIR: illegal operation on a directory, read '${path}'`
224 );
225 }
226 const loc = this.locate(path, true, "open");
227 if (!loc) throw this.missing("open", path);
228 if (loc.node.kind === "dir" || loc.node.kind === "symlink") {
229 throw new Error(
230 `EISDIR: illegal operation on a directory, read '${path}'`
231 );
232 }
233 if (loc.node.kind === "lazy") return this.forceLazy(loc);
234 return loc.node.bytes;
235 }
236
237 async writeFile(
238 path: string,

Callers 1

readFileMethod · 0.95

Calls 5

locateMethod · 0.95
missingMethod · 0.95
forceLazyMethod · 0.95
validatePathFunction · 0.90
normalizePathFunction · 0.90

Tested by

no test coverage detected