🤞🏽Used a promisified file exists function

This commit is contained in:
2022-04-06 23:08:21 -07:00
parent 25d56e9249
commit abc579a8fb
2 changed files with 13 additions and 3 deletions

View File

@@ -67,6 +67,15 @@ export const explodePath = (filePath: string): IExplodedPathResponse => {
};
};
// returns a promise which resolves true if file exists:
export const checkFileExists = (filepath) => {
return new Promise((resolve, reject) => {
fs.access(filepath, fs.constants.F_OK, error => {
resolve(!error);
});
});
}
export const getSizeOfDirectory = async (
directoryPath: string,
extensions: string[]