我只想知道路径是否存在.这是我的代码:
var path = require('path'); // exists path
Run Code Online (Sandbox Code Playgroud)
Yaş*_*ÇLİ 11
尝试:
var path = require('path');
if (path.existsSync("/the/path")) { // or fs.existsSync
// ...
}
Run Code Online (Sandbox Code Playgroud)
要么
fs.exists('/the/path', function (exists) {
util.debug(exists ? "it's there" : "no exists");
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
11864 次 |
| 最近记录: |