MCPcopy Create free account
hub / github.com/Dart-Code/Dart-Code / readDirAsync

Function readDirAsync

src/shared/utils/fs.ts:143–158  ·  view source on GitHub ↗
(logger: Logger, folder: string)

Source from the content-addressed store, hash-verified

141}
142
143function readDirAsync(logger: Logger, folder: string): Promise<fs.Dirent[]> {
144 return new Promise<fs.Dirent[]>((resolve) => fs.readdir(folder,
145 { withFileTypes: true },
146 (err, files) => {
147 // We will generate errors if we don't have access to this folder
148 // so just skip over it.
149 if (err) {
150 // eslint-disable-next-line @typescript-eslint/no-base-to-string
151 logger.warn(`Skipping folder ${folder} due to error: ${err}`);
152 resolve([]);
153 } else {
154 resolve(files);
155 }
156 },
157 ));
158}
159
160function statSyncSafe(file: string): fs.Stats | undefined {
161 try {

Callers 1

getChildFoldersFunction · 0.85

Calls 1

warnMethod · 0.65

Tested by

no test coverage detected