use*_*bw7 8 screenshot screen-capture capture node.js
有没有这样的方法来捕获带有node.js而不是浏览器选项卡的桌面?
我搜索了很多,但我没有找到任何.
我想要的是使用node.js来构建桌面应用程序.
您可以使用
http://nodejs.org/api/child_process.html#child_process_child_process_exec_command_options_callback
和
https://en.wikipedia.org/wiki/Scrot
制作运行nodejs应用程序的当前用户的屏幕截图.像这样的东西(它是完整的expressJS例子):
var express = require('express'),
childProcess = require('child_process'),
app = express();
app.get('/screenshot.png', function(request,response){
childProcess.exec('scrot screenshot.png', function(err){
if(err1) {
response.send(503,'Error creating image!');
} else {
response.sendfile('screenshot.png')
}
});
});
app.listen(3000);
Run Code Online (Sandbox Code Playgroud)
但这种方法很慢.
| 归档时间: |
|
| 查看次数: |
8614 次 |
| 最近记录: |