首页 Node.js核心模块手册

参数说明


exists(path)
path           被检查的 目录 或 文件 路径

返回值:是否存在 true/false

示例


var fs = require("fs");
var bol = fs.existsSync("./liboke/test.txt");
if(bol) console.log("存在");
else console.log("不存在");