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

Function handleDirents

lib/fs.js:1728–1743  ·  view source on GitHub ↗
({ result, currentPath, context })

Source from the content-addressed store, hash-verified

1726const processReaddirResult = (args) => (args.context.withFileTypes ? handleDirents(args) : handleFilePaths(args));
1727
1728function handleDirents({ result, currentPath, context }) {
1729 const { 0: names, 1: types } = result;
1730 const { length } = names;
1731
1732 for (let i = 0; i < length; i++) {
1733 // Avoid excluding symlinks, as they are not directories.
1734 // Refs: https://github.com/nodejs/node/issues/52663
1735 const fullPath = pathModule.join(currentPath, names[i]);
1736 const dirent = getDirent(currentPath, names[i], types[i]);
1737 ArrayPrototypePush(context.readdirResults, dirent);
1738
1739 if (dirent.isDirectory() || binding.internalModuleStat(fullPath) === 1) {
1740 ArrayPrototypePush(context.pathsQueue, fullPath);
1741 }
1742 }
1743}
1744
1745function handleFilePaths({ result, currentPath, context }) {
1746 for (let i = 0; i < result.length; i++) {

Callers 1

processReaddirResultFunction · 0.85

Calls 3

getDirentFunction · 0.50
joinMethod · 0.45
isDirectoryMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…