- 檔案系統模組
- PhantomJS - 屬性
- PhantomJS - 方法
- 系統模組
- PhantomJS - 屬性
- Web 伺服器模組
- PhantomJS - 屬性
- PhantomJS - 方法
- 其他
- 命令列介面
- PhantomJS - 螢幕捕獲
- PhantomJS - 頁面自動化
- PhantomJS - 網路監控
- PhantomJS - 測試
- PhantomJS - REPL
- PhantomJS - 示例
- PhantomJS 實用資源
- PhantomJS - 快速指南
- PhantomJS - 實用資源
- PhantomJS - 討論
PhantomJS - removeDirectory
此方法有助於刪除給定的目錄。
語法
其語法如下 −
var fs = require('fs');
fs.removeDirectory(path);
例項
以下示例演示了 removeDirectory 方法的工作原理。
命令 - phantomjs removedirectory.js test
var fs = require('fs');
var system = require('system');
var path = system.args[1];
console.log("Creating new directory " + path);
var md = fs.makeDirectory(path);
console.log("Directory present : "+fs.isDirectory(path));
console.log("Removing directory "+path);
var rd = fs.removeDirectory(path);
console.log("Directory present "+fs.isDirectory(path));
phantom.exit();
以上程式生成以下 輸出。
Creating new directory test Directory present : true Removing directory test Directory present false
phantomjs_file_system_module_methods.htm
廣告