Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
private async walkLocalDir(dir: string, ignore?: string | string[]) {
try {
return walkdir.async(dir, {
filter: (dir: string, files: string[]) => {
// NOTE: ignore 为空数组时会忽略全部文件
if (!ignore || !ignore.length) return files
return micromatch.not(files, ignore)
}
})
} catch (e) {
throw new CloudBaseError(e.message)
}
}
}
});
}
// walkdir supports mixing sync and async returns
if (!unread.length) {
return applyRules(dir, files);
}
return Promise.all(unread).then(() => {
// new ignore files have been read.
return applyRules(dir, files);
});
};
}
options.find_links = false;
return walkdir.async(entryDir, options, onStat);
};