MCPcopy Index your code
hub / github.com/nodejs/node / getAccessibleFileSystemEntries

Function getAccessibleFileSystemEntries

test/fixtures/snapshot/typescript.js:7388–7433  ·  view source on GitHub ↗
(path)

Source from the content-addressed store, hash-verified

7386 }
7387 }
7388 function getAccessibleFileSystemEntries(path) {
7389 ts.perfLogger.logEvent("ReadDir: " + (path || "."));
7390 try {
7391 var entries = _fs.readdirSync(path || ".", { withFileTypes: true });
7392 var files = [];
7393 var directories = [];
7394 for (var _i = 0, entries_1 = entries; _i < entries_1.length; _i++) {
7395 var dirent = entries_1[_i];
7396 // withFileTypes is not supported before Node 10.10.
7397 var entry = typeof dirent === "string" ? dirent : dirent.name;
7398 // This is necessary because on some file system node fails to exclude
7399 // "." and "..". See https://github.com/nodejs/node/issues/4002
7400 if (entry === "." || entry === "..") {
7401 continue;
7402 }
7403 var stat = void 0;
7404 if (typeof dirent === "string" || dirent.isSymbolicLink()) {
7405 var name = ts.combinePaths(path, entry);
7406 try {
7407 stat = statSync(name);
7408 if (!stat) {
7409 continue;
7410 }
7411 }
7412 catch (e) {
7413 continue;
7414 }
7415 }
7416 else {
7417 stat = dirent;
7418 }
7419 if (stat.isFile()) {
7420 files.push(entry);
7421 }
7422 else if (stat.isDirectory()) {
7423 directories.push(entry);
7424 }
7425 }
7426 files.sort();
7427 directories.sort();
7428 return { files: files, directories: directories };
7429 }
7430 catch (e) {
7431 return ts.emptyFileSystemEntries;
7432 }
7433 }
7434 function readDirectory(path, extensions, excludes, includes, depth) {
7435 return ts.matchFiles(path, extensions, excludes, includes, useCaseSensitiveFileNames, process.cwd(), depth, getAccessibleFileSystemEntries, realpath);
7436 }

Callers 2

getNodeSystemFunction · 0.85
getDirectoriesFunction · 0.85

Calls 7

sortMethod · 0.80
statSyncFunction · 0.70
readdirSyncMethod · 0.45
isSymbolicLinkMethod · 0.45
isFileMethod · 0.45
pushMethod · 0.45
isDirectoryMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…