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