MCPcopy
hub / github.com/github/awesome-copilot / readText

Function readText

extensions/java-modernization-studio/scan.mjs:47–65  ·  view source on GitHub ↗
(path)

Source from the content-addressed store, hash-verified

45}
46
47async function readText(path) {
48 try {
49 const st = await stat(path);
50 if (!st.isFile()) return null;
51 if (st.size > MAX_READ_BYTES) {
52 const fh = await open(path, "r");
53 try {
54 const buf = Buffer.alloc(MAX_READ_BYTES);
55 const { bytesRead } = await fh.read(buf, 0, MAX_READ_BYTES, 0);
56 return buf.toString("utf8", 0, bytesRead);
57 } finally {
58 await fh.close();
59 }
60 }
61 return await readFile(path, "utf8");
62 } catch {
63 return null;
64 }
65}
66
67async function exists(path) {
68 try {

Callers 3

discoverSkillsFunction · 0.85
buildAssessmentFunction · 0.85
scanRepoFunction · 0.85

Calls 2

closeMethod · 0.80
openFunction · 0.50

Tested by

no test coverage detected