Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return new Promise((resolve, reject) =>
{
walker(startPath)
.on("file", (file, stat) =>
{
promisedChanges.push(
copyFile(file, pathModule.join(targetPath, pathModule.relative(startPath, file)), replacementCallback)
)
})
.on("error", (error, entry) =>
{
console.error(chalk.red(`Error ${error} on entry ${entry}`))
})
.on("end", async () => {
await Promise.all(promisedChanges)
resolve()
})
})
}
private static recReaddir(
dir: string,
dirCallback: (normalizedPath: string, stats: fs.Stats) => void,
fileCallback: (normalizedPath: string, stats: fs.Stats) => void,
endCallback: Function,
errorCallback: Function,
ignored?: Matcher,
) {
walker(dir)
.filterDir(
(currentDir: string) => !ignored || !anymatch(ignored, currentDir),
)
.on('dir', FSEventsWatcher.normalizeProxy(dirCallback))
.on('file', FSEventsWatcher.normalizeProxy(fileCallback))
.on('error', errorCallback)
.on('end', () => {
endCallback();
});
}