I noticed that the official node documentation says something startling about fs.exists:
\"fs.exists() is an anachronism and exists only
I think it because it's redundant. You can check if a file exists by trying to open it. It will give you ENOENT if it doesn't exist:
> fs.open('foo', 'r', function(err, fd) {
... console.log(err, fd);
...
})
undefined
> { [Error: ENOENT, open 'foo'] errno: 34, code: 'ENOENT', path: 'foo' } undefined