- 檔案系統模組
- PhantomJS - 屬性
- PhantomJS - 方法
- 系統模組
- PhantomJS - 屬性
- 網路伺服器模組
- PhantomJS - 屬性
- PhantomJS - 方法
- 其他
- 命令列介面
- PhantomJS - 螢幕截圖
- PhantomJS - 頁面自動化
- PhantomJS - 網路監控
- PhantomJS - 測試
- PhantomJS - REPL
- PhantomJS - 示例
- PhantomJS 有用資源
- PhantomJS - 快速指南
- PhantomJS - 有用資源
- PhantomJS - 討論
PhantomJS - isDirectory
isDirectory 函式檢查給定檔案是否為目錄。如果檔案是目錄,則它返回 true,否則返回 false。如果給定的路徑不存在,則它返回 false。
句法
它的句法如下所示 −
var fs = require('fs');
fs.isDirectory(filepath);
示例
以下示例展示瞭如何使用 isDirectory 方法。
命令 − phantomjs isdirectory.js C:\test\
var fs = require('fs');
var system = require('system');
console.log(fs.isDirectory(system.args[1]));
phantom.exit();
上述程式生成以下 輸出。
True
phantomjs_file_system_module_methods.htm
廣告