import { readFileSync, existsSync, writeFileSync } from 'fs';
/**
 * Safely read a JSON file
 * @param filePath - Path to JSON file
 * @returns Parsed JSON or null on error
 */
export function readJsonFile(filePath) {
    if (!existsSync(filePath))
        return null;
    try {
        return JSON.parse(readFileSync(filePath, 'utf8'));
    }
    catch {
        return null;
    }
}
/**
 * Safely read a text file
 * @param filePath - Path to text file
 * @returns File contents or null on error
 */
export function readTextFile(filePath) {
    if (!existsSync(filePath))
        return null;
    try {
        return readFileSync(filePath, 'utf8');
    }
    catch {
        return null;
    }
}
/**
 * Write content to a file
 * @param filePath - Path to file
 * @param content - Content to write
 */
export function writeTextFile(filePath, content) {
    writeFileSync(filePath, content, 'utf8');
}
/**
 * Check if a path exists
 * @param filePath - Path to check
 * @returns True if path exists
 */
export function pathExists(filePath) {
    return existsSync(filePath);
}
//# sourceMappingURL=file-utils.js.map