-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathrender.js
More file actions
25 lines (25 loc) · 703 Bytes
/
render.js
File metadata and controls
25 lines (25 loc) · 703 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
(function(){
var phantom, fullUrl;
phantom = require('phantom');
fullUrl = process.argv[2];
if (!fullUrl) {
process.stderr.write("no url supplied\n");
process.exit();
}
phantom.create('--load-images=no', function(ph){
return ph.createPage(function(page){
return page.open(fullUrl, function(status){
if (status === 'fail') {
process.stderr.write("could not open url\n");
process.exit();
}
return page.evaluate(function(){
return document.documentElement.outerHTML;
}, function(result){
process.stdout.write(result + '\n');
return ph.exit();
});
});
});
});
}).call(this);