docs: function ensureDir(dir, mode, callback) {
      var deferred = Q.defer();
  
      if (mode && typeof mode === 'function') {
          callback = mode;
          mode = null;
      }
  
      mode = mode || parseInt('0777', 8) & (~process.umask());
  
  
      _ensureDir(dir, mode, function (err) {
          if (err) {
              deferred.reject(err);
          } else {
              deferred.resolve();
          }
      });
  
      return deferred.promise.nodeify(callback);
  }