如何使用node.js捕获正在运行的计算机主机的桌面屏幕 [英] How to capture desktop screen of computer host where it's running on using node.js

查看:607
本文介绍了如何使用node.js捕获正在运行的计算机主机的桌面屏幕的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有一种方法可以使用node.js而不是浏览器选项卡捕获桌面?

Is there such a way to capture desktop with node.js not a browser tab?

我搜索了很多,但没有找到。

I have searched a lot but I didn't find any.

我想要的是使用node.js构建桌面应用程序。

What I want is to use node.js to build desktop application.

推荐答案

您可以使用

http://nodejs.org/api/child_process.html#child_process_child_process_exec_command_options_callback

https://en.wikipedia.org/wiki/Scrot

制作当前正在运行nodejs应用程序的用户的屏幕截图。
这样的东西(它是完整的expressJS示例):

to make screenshot of screen of current user running nodejs application. Something like this (it is complete expressJS example):

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);

但这是很慢的方法。

这篇关于如何使用node.js捕获正在运行的计算机主机的桌面屏幕的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆