0
我有以下使用phantomjs運行的JS。如何將JS輸出保存到文件
var webPage = require('webpage');
var system = require('system');
var page = webPage.create();
page.customHeaders = {
"pragma": "akamai-x-feo-trace"
};
if (system.args.length === 1) {
console.log('Try to pass some args when invoking this script!');
} else {
page.open(system.args[1], function (status) {
var content = page.content;
console.log('Content: ' + content);
phantom.exit();
});
}
我wanto到輸出保存到一個文件夾./html/<random#>.html
。
我應該怎麼辦?