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

Function readdir

lib/internal/fs/promises.js:1692–1720  ·  view source on GitHub ↗
(path, options)

Source from the content-addressed store, hash-verified

1690}
1691
1692async function readdir(path, options) {
1693 const h = vfsState.handlers;
1694 if (h !== null) {
1695 const promise = h.readdir(path, options);
1696 if (promise !== undefined) return await promise;
1697 }
1698 options = getOptions(options);
1699
1700 // Make shallow copy to prevent mutating options from affecting results
1701 options = copyObject(options);
1702
1703 path = getValidatedPath(path);
1704 if (options.recursive) {
1705 return readdirRecursive(path, options);
1706 }
1707 const result = await PromisePrototypeThen(
1708 binding.readdir(
1709 path,
1710 options.encoding,
1711 !!options.withFileTypes,
1712 kUsePromises,
1713 ),
1714 undefined,
1715 handleErrorFromBinding,
1716 );
1717 return options.withFileTypes ?
1718 getDirectoryEntriesPromise(path, result) :
1719 result;
1720}
1721
1722async function readlink(path, options) {
1723 const h = vfsState.handlers;

Callers 2

readdirMethod · 0.70
_rmchildrenFunction · 0.70

Calls 4

copyObjectFunction · 0.85
getOptionsFunction · 0.70
readdirRecursiveFunction · 0.70
readdirMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…