INNER CODE UNIT · JavaScript
readFileIfExists
o19s/quepid · build_css.js:23
function readFileIfExists(filePath) {
try {
if (fs.existsSync(filePath)) {
return fs.readFileSync(filePath, 'utf8');
}
} catch (error) {
console.warn(`Warning: Could not read ${filePath}:`, error.message);
}
return '';
}
function copyFileIfExists(src, dest) {
try {
if (fs.existsSync(src)) {
ensureDirectoryExists(path.dirname(dest));
fs.copyFileSync(src, dest);
return true;
}