//文件操作
var fs = require('fs');
/**
* 验证文件是否存在
* @param {*} path
*/
function isFileExist(path) {
try{
fs.accessSync(path,fs.F_OK);
}catch(e){
return false;
}
return true;
}
//文件路径
var filePath = "D:\\软件包\\斗地主配牌助手\\LandCardConfig.json";
//验证文件是否存在
var bExistsSync = isFileExist(filePath);
if(bExistsSync){
console.log("文件存在!");
}
else{
console.log("文件不存在!");
}