Skip to content

Commit

Permalink
fix exists fn
Browse files Browse the repository at this point in the history
  • Loading branch information
mhkeller committed Nov 30, 2015
1 parent c7f3e57 commit 3861d35
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,15 @@ helpers.discernFileFormatter = function (fileName) {
*
*/
helpers.exists = function (filename, cb) {
fs.access(function (err) {
cb(err, err !== null)
fs.access(filename, function (err) {
var exists
if (err && err.code == 'ENOENT') {
exists = false
err = null
} else if (!err) {
exists = true
}
cb(err, exists)
})
}

Expand Down

0 comments on commit 3861d35

Please sign in to comment.