mirror of
https://github.com/Snigdha-OS/documentation.git
synced 2025-09-07 19:25:13 +02:00
20 lines
298 B
JavaScript
20 lines
298 B
JavaScript
import fs, {promises as fsPromises} from 'node:fs';
|
|
|
|
export async function pathExists(path) {
|
|
try {
|
|
await fsPromises.access(path);
|
|
return true;
|
|
} catch {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
export function pathExistsSync(path) {
|
|
try {
|
|
fs.accessSync(path);
|
|
return true;
|
|
} catch {
|
|
return false;
|
|
}
|
|
}
|