MCPcopy Create free account
hub / github.com/apache/cloudstack / walkDir

Function walkDir

systemvm/agent/noVNC/utils/convert.js:46–59  ·  view source on GitHub ↗
(basePath, cb, filter)

Source from the content-addressed store, hash-verified

44// walkDir *recursively* walks directories trees,
45// calling the callback for all normal files found.
46function walkDir(basePath, cb, filter) {
47 return readdir(basePath)
48 .then((files) => {
49 const paths = files.map(filename => path.join(basePath, filename));
50 return Promise.all(paths.map(filepath => lstat(filepath)
51 .then((stats) => {
52 if (filter !== undefined && !filter(filepath, stats)) return;
53
54 if (stats.isSymbolicLink()) return;
55 if (stats.isFile()) return cb(filepath);
56 if (stats.isDirectory()) return walkDir(filepath, cb, filter);
57 })));
58 });
59}
60
61function makeLibFiles(sourceMaps) {
62 // NB: we need to make a copy of babelOpts, since babel sets some defaults on it

Callers 1

makeLibFilesFunction · 0.85

Calls 5

filterFunction · 0.85
mapMethod · 0.80
isFileMethod · 0.65
isDirectoryMethod · 0.65
joinMethod · 0.45

Tested by

no test coverage detected