Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
existsSync - Check if a file exist in NodeJS
fileExistSync - Check if a file exist in NodeJS
Twitter: @FGRibreau /
var fileExistSync = require('./fileExistSync');
var exist = fileExistSync('/var/folders/zm/jmjb49l172g6g/T/65b199');
Support for Nodev0.6
var fs = require('fs');
module.exports = fs.existsSync || function existsSync(filePath){
if(err.code == 'ENOENT') return false;
return true;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment