Newer
Older
framework / node_modules / find-cache-dir / node_modules / path-exists / index.js
@Tiago Leonardo Costa Dias Tiago Leonardo Costa Dias on 13 Mar 2024 298 bytes update
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;
	}
}