MCPcopy Create free account
hub / github.com/Snapchat/Valdi / getAllFilePaths

Function getAllFilePaths

npm_modules/cli/src/utils/fileUtils.ts:94–113  ·  view source on GitHub ↗
(directoryPath: string)

Source from the content-addressed store, hash-verified

92}
93
94export function getAllFilePaths(directoryPath: string): string[] {
95 directoryPath = resolveFilePath(directoryPath);
96
97 const files: string[] = [];
98 function traverseDirectories(dir: string) {
99 fs.readdirSync(dir, { withFileTypes: true }).forEach(file => {
100 const fullPath = path.join(dir, file.name);
101 if (file.isDirectory()) {
102 traverseDirectories(fullPath);
103 return;
104 }
105
106 files.push(fullPath);
107 });
108 }
109
110 traverseDirectories(directoryPath);
111
112 return files;
113}
114
115export function isDirectoryEmpty(directoryPath: string): boolean {
116 const absPath = resolveFilePath(directoryPath);

Callers 1

Calls 2

resolveFilePathFunction · 0.85
traverseDirectoriesFunction · 0.85

Tested by

no test coverage detected