We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
utils.checkIfDirectoryExists()
1 parent d5908e8 commit 08fd2b7Copy full SHA for 08fd2b7
src/utils.ts
@@ -109,6 +109,16 @@ export function checkIfFileExists(filePath: string): boolean {
109
}
110
111
112
+export function checkIfDirectoryExists(directoryPath: string): boolean {
113
+ try {
114
+ // tslint:disable-next-line:no-bitwise
115
+ fs.accessSync(directoryPath, fs.constants.R_OK | fs.constants.O_DIRECTORY);
116
+ return true;
117
+ } catch (e) {
118
+ return false;
119
+ }
120
+}
121
+
122
export function getTimestampString() {
123
const time = new Date();
124
return `[${time.getHours()}:${time.getMinutes()}:${time.getSeconds()}]`;
0 commit comments