import fs from 'fs/promises';
export async function pathExists(path, type) {
    try {
        const stats = await fs.stat(path);
        if (type === 'file') {
            return stats.isFile();
        }
        if (type === 'directory') {
            return stats.isDirectory();
        }
        return true;
    }
    catch {
        return false;
    }
}
export async function readJson(path) {
    const raw = await fs.readFile(path, 'utf8');
    return JSON.parse(raw);
}
