From d6503b6b6f5cb9df877de0e571d83e947fb3bebd Mon Sep 17 00:00:00 2001 From: Forbes Lindesay Date: Mon, 27 Aug 2012 03:50:27 +0100 Subject: [PATCH] Add node v0.6 support --- lib/fs.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/fs.js b/lib/fs.js index 3a5017b..7ca3d30 100644 --- a/lib/fs.js +++ b/lib/fs.js @@ -1,3 +1,4 @@ +var pathLib = require('path'); var fs = require('fs'); var Q = require('q'); @@ -5,9 +6,14 @@ var Q = require('q'); // => bool module.exports.exists = function exists(path) { return Q.ncall(function exists(cb) { - fs.exists(path, function (exists) { + if (fs.exists) { + fs.exists(path, then); + } else { + pathLib.exists(path, then) + } + function then(exists) { cb(null, exists); - }); + } }); }