Instructions for the fs.existsSync method in node.js


method description:

fs.exists ().

syntax:

fs.existsSync(path)

Since this method belongs to fs module, fs module (var fs= require(” fs ”) needs to be introduced before use.)

receive parameters:

The file path to be detected by path  .

source code:

fs.existsSync = function(path) {
  try {
    nullCheck(path);
    binding.stat(pathModule._makeLong(path));
    return true;
  } catch (e) {
    return false;
  }
};