PhantomJS - list
list 方法返回目录中存在的所有文件。
语法
其语法如下 −
var fs = require('fs'); fs.list(path);
示例
以下示例显示了 list 方法的用法。
命令 − phantomjs list.js C:\phantomjs\
var fs = require('fs'); var system = require('system'); var path = system.args[1]; if (fs.isDirectory(path)) { console.log(fs.list(path)); } phantom.exit();
上述程序生成以下输出。
.,..,bin,ChangeLog,examples,LICENSE.BSD,README.md,third-party.txt
输出显示 PhantomJS 目录中存在的所有文件。
phantomjs_file_system_module_methods.html