- 檔案系統模組
- PhantomJS - 屬性
- PhantomJS - 方法
- 系統模組
- PhantomJS - 屬性
- Web 伺服器模組
- PhantomJS - 屬性
- PhantomJS - 方法
- 其他
- 命令列介面
- PhantomJS - 螢幕截圖
- PhantomJS - 頁面自動化
- PhantomJS - 網路監控
- PhantomJS - 測試
- PhantomJS - REPL
- PhantomJS - 示例
- PhantomJS 有用的資源
- PhantomJS - 快速指南
- PhantomJS - 有用的資源
- PhantomJS - 討論
PhantomJS - changeWorkingDirectory
它允許您更改工作目錄,如果成功,則返回 true,否則返回 false。
語法
其語法如下所示 −
fs.changeWorkingDirectory(filepath);
示例
我們來看一個 changeWorkingDirectory 方法的示例。
var fs = require('fs');
console.log(fs.workingDirectory); // prints the location where phantomjs is running
fs.changeWorkingDirectory("C:\\");
console.log(fs.workingDirectory); // prints C:/
以上程式生成以下 輸出。
C:/phantomjs/bin C:/
phantomjs_file_system_module_methods.htm
廣告