- 檔案系統模組
- PhantomJS - 屬性
- PhantomJS - 方法
- 系統模組
- PhantomJS - 屬性
- Web 伺服器模組
- PhantomJS - 屬性
- PhantomJS - 方法
- 其他
- 命令列介面
- PhantomJS - 截圖
- PhantomJS - 頁面自動化
- PhantomJS - 網路監視
- PhantomJS - 測試
- PhantomJS - REPL
- PhantomJS - 示例
- PhantomJS 的有用資源
- PhantomJS - 快速指南
- PhantomJS 的有用資源
- PhantomJS - 討論
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.
phantomjs_file_system_module_methods.htm
廣告