PhantomJS isExecutable
此方法检查给定的文件是否可执行。如果可执行,则返回true;否则返回false。
语法
其语法如下所示 –
var fs=require('fs');
fs.isExecutable(filename);
示例
下面的示例展示了使用 isExecutable 方法的示例。
命令 - Phantomjs isexecutable.js touch.js
var fs=require('fs');
var system = require('system');
var path = system.args[1];
if (fs.isExecutable(path)) {
console.log(path+" is executable.");
} else {
console.log(path+" is NOT executable.");
}
phantom.exit();
上面的程序生成以下 输出 。
touch.js is NOT executable.