'use strict';

var fs = require('fs');

/**
 * Check the existence of the file
 */
function checkFileExistsSync(filepath){
  let flag = true;

  try {
    fs.accessSync(filepath, fs.F_OK);
  } catch(e){
    flag = false;
  }

  return flag;
};

module.exports = {
 checkFileExistsSync: checkFileExistsSync
};

'use strict';

var fs = require('fs');

/**
 * Check the existence of the file
 */
function checkFileExistsSync(filepath){
  var flag = true;

  try {
    fs.accessSync(filepath, fs.F_OK);
  } catch(e){
    flag = false;
  }

  return flag;
};

module.exports = {
 checkFileExistsSync: checkFileExistsSync
};

Use var rather than let for pre-ES6 cross-compatibility
Use var rather than let for pre-ES6 cross-compatibility
