通过 Node.js 获取电脑安装的软件,支持 Windows 和 Mac 两个平台

328 天前
 xiaoguaiwu

地址:https://github.com/Xutaotaotao/get-installed-apps

通过 Node.js 获取电脑安装的软件,支持 Windows 和 Mac 两个平台。

👨‍💻 安装

npm install get-installed-apps

🔌 用法

ES6 Module

import {getInstalledApps} from 'get-installed-apps'

getInstalledApps().then(apps => {
  console.log(apps)
})

CommonJS

const {getInstalledApps} = require('get-installed-apps')
getInstalledApps().then(apps => {
  console.log(apps)
})

如果你只想在 mac 平台上使用,可以这么做:

import {getMacInstalledApps} from 'get-installed-apps'

getMacInstalledApps().then(apps => {
  console.log(apps)
})

getMacInstalledApps 有一个可选参数 directory, 默认是'/Applications',你如果还需要获取其他目录的 app,可以自己设置。

如果你只想在 windows 平台上使用,可以这么做:

import {getWinInstalledApps} from 'get-installed-apps'

getWinInstalledApps().then(apps => {
  console.log(apps)
})
917 次点击
所在节点    分享创造
1 条回复
Corybyte
328 天前
Linux 平台捏

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/986592

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX