在Node.js中查找GPU信息(模型) [英] Finding GPU information (model) in Node.js

查看:677
本文介绍了在Node.js中查找GPU信息(模型)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Node.js中,我们可以轻松地使用os模块(文档)为了获取CPU信息:

In Node.js, we can easily use os module (documentation) in order to obtain CPU information:

    os.cpus()[0].model; // → Example: 'Intel(R) Core(TM) i7 CPU 860 @ 2.80GHz'

我正在寻找一种类似的方式来获取 GPU 模型以及规格(如果可能).

I'm looking for a similar way to obtain GPU model and if possible, specifications.

谢谢您的帮助!

推荐答案

您可以编写一个切换os.platform()的模块,然后为每个操作系统执行一条命令以获取GPU信息,如下所示:

You can write a module switching the os.platform(), then execute a command for each os to grab the GPU info, as follows:

// Mac OS:
system_profiler | grep GeForce

// Windows:
wmic path win32_VideoController get name

// Linux:
sudo lshw -C display

这篇关于在Node.js中查找GPU信息(模型)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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