How to use the node-os-utils.mem function in node-os-utils

To help you get started, we’ve selected a few node-os-utils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github littlewin-wang / littlewin.server / controllers / server.js View on Github external
static async getServer (ctx) {
    // cpu stat
    let cpu = osu.cpu
    let cpuUsage = await cpu.usage()
    let cpuAverage = await cpu.average()

    // mem stat
    let mem = osu.mem
    let memInfo = await mem.info()

    ctx.status = 200
    ctx.body = {
      success: true,
      message: "获取服务器信息",
      data: {
        cpu: {
          cpuUsage,
          cpuAverage
        },
        mem: {
          memInfo
        }
      }
    }

node-os-utils

An operating system utility library.

MIT
Latest version published 2 years ago

Package Health Score

50 / 100
Full package analysis