检查nodejspath是否存在
我只想知道一条路是否存在。 这是我的代码:
var path = require('path'); // exists path
尝试:
var path = require('path'); if (path.existsSync("/the/path")) { // or fs.existsSync // ... }
要么
fs.exists('/the/path', function (exists) { util.debug(exists ? "it's there" : "no exists"); });