MCPcopy Create free account
hub / github.com/anus-dev/ANUS / findFile

Function findFile

scripts/telemetry_utils.js:76–92  ·  view source on GitHub ↗
(startPath, filter)

Source from the content-addressed store, hash-verified

74}
75
76export function findFile(startPath, filter) {
77 if (!fs.existsSync(startPath)) {
78 return null;
79 }
80 const files = fs.readdirSync(startPath);
81 for (const file of files) {
82 const filename = path.join(startPath, file);
83 const stat = fs.lstatSync(filename);
84 if (stat.isDirectory()) {
85 const result = findFile(filename, filter);
86 if (result) return result;
87 } else if (filter(file)) {
88 return filename;
89 }
90 }
91 return null;
92}
93
94export function fileExists(filePath) {
95 return fs.existsSync(filePath);

Callers 1

ensureBinaryFunction · 0.85

Calls 1

filterFunction · 0.85

Tested by

no test coverage detected