Skip to content

Instantly share code, notes, and snippets.

@aerith
Created July 7, 2010 09:56
Show Gist options
  • Save aerith/466511 to your computer and use it in GitHub Desktop.
Save aerith/466511 to your computer and use it in GitHub Desktop.
var sys = require('sys');
process.stdout.write(sys.inspect(pathExistsSync('test'), true, null) + "\n");
process.stdout.write(sys.inspect(pathExistsSync('--test--'), true, null) + "\n");
function pathExistsSync (path) {
var fs = require('fs');
try {
var stat = fs.statSync(path);
} catch (error) {
return (error.errno !== process.ENOENT);
}
return true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment