Phantomjs-isexecutable-method

提供:Dev Guides
移動先:案内検索

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();

上記のプログラムは、次の output を生成します。

touch.js is NOT executable.