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