agentsqripts
Version:
Comprehensive static code analysis toolkit for identifying technical debt, security vulnerabilities, performance issues, and code quality problems
26 lines (22 loc) • 536 B
JavaScript
/**
* @file File existence checking utility
* @description Single responsibility: Check if files exist
*/
const fs = require('fs');
/**
* Check if a file exists
* @param {string} filePath - Path to the file
* @returns {boolean} True if file exists, false otherwise
*/
function fileExists(filePath) {
if (typeof filePath !== 'string') {
throw new TypeError('File path must be a string');
}
try {
fs.accessSync(filePath);
return true;
} catch (error) {
return false;
}
}
module.exports = fileExists;