How to use node-os-utils - 8 common examples

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 shidoitsuka / another-miku-bot / commands / Utility / about.js View on Github external
exports.run = async (bot, message, args) => {
  const cpuUsage = (await cpu.usage()) + "%";
  const memoryUsage = (await mem.info()).freeMemMb + "MB";
  // prettier-ignore
  const operatingSystem = `${os.type()} ${await os.oos().then(o => o)} ${os.arch()}`;
  // prettier-ignore
  const embed = new Discord.MessageEmbed()
    .setAuthor(`About me`, "", "https://github.com/shidoitsuka/another-miku-bot")
    .setThumbnail("https://tinyurl.com/MikuLogo")
    .setColor(0x1a9ca8)
    .setDescription("Hello, I'm Miku!\nA `just4fun` discord bot written over discord.js framework with ❤ by 12042#5754.")
    .addField("NodeJS version:", `${process.version.slice(1).split(".").join(".")}`, true)
    .addField("discord.js version:", `${package.dependencies["discord.js"]}`, true)
    .addField("Executed Command(s):", bot.db.get("totalCommands"), true)
    .addField("CPU Usage:", cpuUsage, true)
    .addField("Memory Usage:", memoryUsage, true)
    .addField("OS Info:", operatingSystem, true)
    .addField("Invite link:", "[Click Me!](https://discordapp.com/oauth2/authorize/?permissions=2080898303&scope=bot&client_id=364242246314360843)", true)
github shidoitsuka / another-miku-bot / commands / Utility / about.js View on Github external
exports.run = async (bot, message, args) => {
  const cpuUsage = (await cpu.usage()) + "%";
  const memoryUsage = (await mem.info()).freeMemMb + "MB";
  // prettier-ignore
  const operatingSystem = `${os.type()} ${await os.oos().then(o => o)} ${os.arch()}`;
  // prettier-ignore
  const embed = new Discord.MessageEmbed()
    .setAuthor(`About me`, "", "https://github.com/shidoitsuka/another-miku-bot")
    .setThumbnail("https://tinyurl.com/MikuLogo")
    .setColor(0x1a9ca8)
    .setDescription("Hello, I'm Miku!\nA `just4fun` discord bot written over discord.js framework with ❤ by 12042#5754.")
    .addField("NodeJS version:", `${process.version.slice(1).split(".").join(".")}`, true)
    .addField("discord.js version:", `${package.dependencies["discord.js"]}`, true)
    .addField("Executed Command(s):", bot.db.get("totalCommands"), true)
    .addField("CPU Usage:", cpuUsage, true)
    .addField("Memory Usage:", memoryUsage, true)
    .addField("OS Info:", operatingSystem, true)
    .addField("Invite link:", "[Click Me!](https://discordapp.com/oauth2/authorize/?permissions=2080898303&scope=bot&client_id=364242246314360843)", true)
    .addField("Fan server is here!!", "[Click Me!](https://discord.gg/uxseTvy)", true)
github shidoitsuka / another-miku-bot / commands / Utility / about.js View on Github external
exports.run = async (bot, message, args) => {
  const cpuUsage = (await cpu.usage()) + "%";
  const memoryUsage = (await mem.info()).freeMemMb + "MB";
  // prettier-ignore
  const operatingSystem = `${os.type()} ${await os.oos().then(o => o)} ${os.arch()}`;
  // prettier-ignore
  const embed = new Discord.MessageEmbed()
    .setAuthor(`About me`, "", "https://github.com/shidoitsuka/another-miku-bot")
    .setThumbnail("https://tinyurl.com/MikuLogo")
    .setColor(0x1a9ca8)
    .setDescription("Hello, I'm Miku!\nA `just4fun` discord bot written over discord.js framework with ❤ by 12042#5754.")
    .addField("NodeJS version:", `${process.version.slice(1).split(".").join(".")}`, true)
    .addField("discord.js version:", `${package.dependencies["discord.js"]}`, true)
    .addField("Executed Command(s):", bot.db.get("totalCommands"), true)
    .addField("CPU Usage:", cpuUsage, true)
    .addField("Memory Usage:", memoryUsage, true)
    .addField("OS Info:", operatingSystem, true)
    .addField("Invite link:", "[Click Me!](https://discordapp.com/oauth2/authorize/?permissions=2080898303&scope=bot&client_id=364242246314360843)", true)
    .addField("Fan server is here!!", "[Click Me!](https://discord.gg/uxseTvy)", true)
    .setFooter(`Click title for my source-code | v${package.version}-beta`);
  message.channel.send({ embed });
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
        },
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
        }
      }
    }
github callmekory / nezuko / src / commands / utils / SystemInfo.ts View on Github external
const cpuInfo = async () => {
      const coreCount = cpu.count()
      const cpuPercent = round(await cpu.usage())
      let loadAverage = ''
      cpu.loadavg().forEach((i) => (loadAverage += `${round(i)}% `))
      return { cores: coreCount, percentage: cpuPercent, load: loadAverage.trim() }
    }
github callmekory / nezuko / src / commands / utils / SystemInfo.ts View on Github external
const cpuInfo = async () => {
      const coreCount = cpu.count()
      const cpuPercent = round(await cpu.usage())
      let loadAverage = ''
      cpu.loadavg().forEach((i) => (loadAverage += `${round(i)}% `))
      return { cores: coreCount, percentage: cpuPercent, load: loadAverage.trim() }
    }
github callmekory / nezuko / src / commands / utils / SystemInfo.ts View on Github external
const cpuInfo = async () => {
      const coreCount = cpu.count()
      const cpuPercent = round(await cpu.usage())
      let loadAverage = ''
      cpu.loadavg().forEach((i) => (loadAverage += `${round(i)}% `))
      return { cores: coreCount, percentage: cpuPercent, load: loadAverage.trim() }
    }

node-os-utils

An operating system utility library.

MIT
Latest version published 2 years ago

Package Health Score

50 / 100
Full package analysis