PhantomJS isExecutable

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.

Python教程

Java教程

Web教程

数据库教程

图形图像教程

大数据教程

开发工具教程

计算机教程