Created
March 19, 2015 01:47
-
-
Save jdcauley/384d3c2872c7461962e8 to your computer and use it in GitHub Desktop.
Check for file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fs.stat('log.txt', function(err, stat) { | |
if(err == null) { | |
console.log('File exists'); | |
} else if(err.code == 'ENOENT') { | |
fs.writeFile('log.txt', 'Some log | |
'); | |
} else { | |
console.log('Some other error: ', err.code); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment