I prefer this way of handling this. You can check if the file exists synchronously:
var file = 'info.json';
var content = '';
// Check that the file exists locally
if(!fs.existsSync(file)) {
console.log("File not found");
}
// The file *does* exist
else {
// Read the file and do anything you want
content = fs.readFileSync(file, 'utf-8');
}
Note: if your program also deletes files, this has a race condition as noted in the comments. If however you only write or overwrite files, without deleting them, then this is totally fine.