parser.js
function getFileString(filepath) {
  if (/(?:\/|\\)$/.test(filepath) || !fs.existsSync(filepath)) {
    console.log("\x1B[31mfile is not exist：" + filepath + "\x1B[0m");
    return null;
  } else {
    return fs.readFileSync(filepath).toString()
  }
}
function getFileString(filepath) {
  if (/(?:\/|\\)$/.test(filepath) || !fs.existsSync(filepath)) {
    console.log("\x1B[31mfile is not exist：" + filepath + "\x1B[0m");
    return null;
  } else {
    return fs.readFileSync(filepath).toString()
  }
}
function getFileString ( filepath ) { if ( / (?:\/|\\)$ / . test ( filepath ) || ! fs . existsSync ( filepath ) ) { console . log ( "\x1B[31mfile is not exist：" + f lepath + " x1B[0m"); return null ; } else { return fs . readFileSync ( filepath ) . toString ( ) } }
获取文件字符串
获取文件字符串