forked from huang-x-h/html2image
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscreencapture.js
More file actions
35 lines (28 loc) · 811 Bytes
/
Copy pathscreencapture.js
File metadata and controls
35 lines (28 loc) · 811 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
26
27
28
29
30
31
32
33
34
35
/**
* Created by huangxinghui on 2015/9/15.
*/
var childProcess = require('child_process');
var path = require('path');
var phantomjs = require('phantomjs-prebuilt');
var binPath = phantomjs.path;
function screenCapture(address, output, format, size, proxy) {
console.log('opened address %s', address);
var childArgs = [
path.join(__dirname, './phantom/screencapture.js')
, address
, output
, format
, size
];
if (proxy) {
childArgs = ['--proxy=127.0.0.1:1080', '--proxy-type=socks5'].concat(childArgs);
}
childProcess.execFile(binPath, childArgs, function (err, stdout, stderr) {
if (err) {
console.log(err);
return;
}
console.log(stdout);
});
}
module.exports = screenCapture;