How to use the graceful-fs.exists function in graceful-fs

To help you get started, we’ve selected a few graceful-fs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github hexojs / hexo / lib / loaders / plugins.js View on Github external
function(next){
      fs.exists(pluginDir, function(exist){
        if (exist){
          next();
        } else {
          callback();
        }
      });
    },
    function(next){
github onmyway133 / PushNotifications / node_modules / fs-extra / lib / output / index.js View on Github external
function outputFile (file, data, encoding, callback) {
  if (typeof encoding === 'function') {
    callback = encoding
    encoding = 'utf8'
  }

  var dir = path.dirname(file)
  fs.exists(dir, function (itDoes) {
    if (itDoes) return fs.writeFile(file, data, encoding, callback)

    mkdir.mkdirs(dir, function (err) {
      if (err) return callback(err)

      fs.writeFile(file, data, encoding, callback)
    })
  })
}
github hapticdata / Sketchplate / bin / postinstall.js View on Github external
config.restoreUserReadme(function(err){
        userConfig = config.getUserConfig();
        l('templates located in '.green + userConfig.templatesPath);

        //check if the template already exists
        fs.exists( path.join(userConfig.templatesPath, template.name), function( exists ){
            if( exists ){
                //template is already installed, skip installing it
                onComplete();
                return;
            }
            //install amd-sketch template
            sketchplate.installTemplate( userConfig, template.repo, template.name, function( err ){
                l('installed '.green + template.repo + ' as template '.green + template.name );
                onComplete();
            });
            l('fetching '.cyan + template.repo);
        });
    });
});
github uber-archive / idl / bin / idl.js View on Github external
function onSourceShasums(err, shasums) {
        if (err) {
            return cb(err);
        }
        newShasums = shasums;

        fs.exists(destination, onExists);

        function onExists(exists) {
            if (exists) {
                shasumFiles(destination, onDestinationShasums);
            } else {
                onDestinationShasums(null, {});
            }
        }
    }
github FredHutch / Oncoscape / client / node_modules / fs-extra / lib / json / output-json.js View on Github external
function outputJson (file, data, options, callback) {
  if (typeof options === 'function') {
    callback = options
    options = {}
  }

  var dir = path.dirname(file)

  fs.exists(dir, function (itDoes) {
    if (itDoes) return jsonFile.writeFile(file, data, options, callback)

    mkdir.mkdirs(dir, function (err) {
      if (err) return callback(err)
      jsonFile.writeFile(file, data, options, callback)
    })
  })
}
github facebookarchive / commoner / lib / util.js View on Github external
return makePromise(function(callback) {
        fs.exists(fullPath, function(exists) {
            callback(null, exists);
        });
    });
};
github smartcontractkit / chainlink / examples / echo_server / node_modules / fs-extra / lib / ensure / link.js View on Github external
fs.lstat(srcpath, function (err, stat) {
      if (err) {
        err.message = err.message.replace('lstat', 'ensureLink')
        return callback(err)
      }

      var dir = path.dirname(dstpath)
      fs.exists(dir, function (dirExists) {
        if (dirExists) return makeLink(srcpath, dstpath)
        mkdir.mkdirs(dir, function (err) {
          if (err) return callback(err)
          makeLink(srcpath, dstpath)
        })
      })
    })
  })
github gameclosure / devkit-core / src / build / util / fs.js View on Github external
return new Promise(function (resolve) {
    fs.exists(filename, function (exists) {
      resolve(exists);
    });
  });
};
github mautic / documentation / lib / generate / fs.js View on Github external
exists: function(path) {
        var d = Q.defer();
        fs.exists(path, d.resolve);
        return d.promise;
    },
    readFileSync: fs.readFileSync.bind(fs)
github fossasia / susper.com / node_modules / fs-extra / lib / fs / index.js View on Github external
return new Promise(resolve => {
    return fs.exists(filename, resolve)
  })
}