PhantomJS isExecutable 使用方法


发布日期 : 2024-05-30 05:41:11 UTC

访问量: 9 次浏览

PhantomJS isExecutable

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.