nodejs electron 实时监控系统上所有进程信息 开源

地址:https://www.npmjs.com/package/node-process-watcher
仅使用非常小的资源消耗。

const {node_process_watcher} = require("node-process-watcher");
// or import {node_process_watcher} from "node-process-watcher";
node_process_watcher.on("screen1",(list)=>{
    // Print the information of all processes on the system every second
    // 每秒打印一次系统上所有进程的信息
    console.log(list[0]);
    // { id: 4, user_name: 'SYSTEM', cpu: 0, mem: 0, name: 'System' }
    node_process_watcher.close("screen1"); // 关闭
})
node_process_watcher.on("screen2",(list)=>{
    // Filter specific processes
    // 过滤特定的进程
    node_process_watcher.pids("screen2",[
        list[0].id
    ])
    console.log(list[0]);
    if (list.length === 1) {
        // Stop listening for information only after all the on events are closed
        // 所有的on关闭后才会停止监听信息上的信息
        node_process_watcher.close("screen2");
    }
})
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值