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

Method readlink

packages/shell/src/filesystem.ts:460–473  ·  view source on GitHub ↗
(path: string)

Source from the content-addressed store, hash-verified

458 }
459
460 async readlink(path: string): Promise<string> {
461 await this.ensureInit();
462 const normalized = normalizePath(path);
463 const T = this.tableName;
464 const rows = await this.sql.query<{
465 type: string;
466 target: string | null;
467 }>(`SELECT type, target FROM ${T} WHERE path = ?`, normalized);
468 const r = rows[0];
469 if (!r) throw new Error(`ENOENT: no such file or directory: ${path}`);
470 if (r.type !== "symlink" || !r.target)
471 throw new Error(`EINVAL: not a symlink: ${path}`);
472 return r.target;
473 }
474
475 async lstat(path: string): Promise<FileStat | null> {
476 await this.ensureInit();

Callers 1

cpMethod · 0.95

Calls 2

ensureInitMethod · 0.95
normalizePathFunction · 0.70

Tested by

no test coverage detected