npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

pc

v0.0.6

Published

Get general information regarding computer status such as memory utilization, hardd drive space, number of core, etc

Downloads

52

Readme

PC

An application that provides information about a computer. Such as available memory, installed application, drives spaces, etc. It is only supporting Windows right now but Linux and Mac support are coming soon.

##Install

    npm install pc

Information Available

  • Memory
  • CPU
  • Hostname
  • Uptime
  • NetworkInterfaces
  • Temporary Directory
  • Public IP
  • Drives
  • Users
  • MAC
  • Programs
  • Share
  • More coming soon

Methods

Memory Return computer's available memory

  var pc = require('pc');

  pc.memory(); //return  { free: number, total: number }

Hostname Return the computer's hostname

  pc.hostname(); //return { name: 'string' }

Uptime Return the system uptime in seconds

  pc.uptime() //return { time: 'string' }

tmpDir Returns the operating system's default directory for temp files.

pc.tmpDir() //return { location: 'string' }

NetworkInterfaces Get a list of network interfaces

  pc.networkInterfaces();
  /*
    { lo0:
    [ { address: '::1', family: 'IPv6', internal: true },
    { address: 'fe80::1', family: 'IPv6', internal: true },
    { address: '127.0.0.1', family: 'IPv4', internal: true } ],
    en1:
    [ { address: 'fe80::cabc:c8ff:feef:f996', family: 'IPv6',
    internal: false },
    { address: '10.0.1.123', family: 'IPv4', internal: false } ],
    vmnet1: [ { address: '10.99.99.254', family: 'IPv4', internal: false } ],
    vmnet8: [ { address: '10.88.88.1', family: 'IPv4', internal: false } ],
    ppp0: [ { address: '10.2.0.231', family: 'IPv4', internal: false } ] }
  */

###The rest of the api return promises I like to define an error handler function to deal with my promises errors,

  var errorHandler = function(err){ console.log(err); throw err; };

cpu Returns an objects containing information about each CPU/core installed.

  pc.cpu().then(function(cpu){
    console.log(cpu);
  }, errorHandler);
  /*return {
      deviceId: 'string',
      status: number,
      currentClockSpeed: number,
      currentVoltage: number,
      loadPercentage: number,
      maxClockSpeed: number,
      name: 'string',
      numberOfCores: number,
      processorId: 'string'
    }*/

Public IP Return the public IP of the computer. Internet connection is required to call this method.

  pc.publicIP().then(function(ipInfo){
    console.log(ipInfo); //return { ip: ipaddress }
  }, errorHandler);

Drives Return an array of object with drive information.

  pc.drives().then(function(drives){
    console.log(drives);
    /*
      [{
        name: 'string',
        description: 'string',
        fileSystem: 'string',
        freeSpace: number,
        size: number,
        volumeName: 'string'
    }]
    */
  }, errorHandler);

Users Return an array of existing users in the computer.

  pc.users().then(function(users){
    console.log(users);
    /*
      [{
        name: 'string',
        accountType: number,
        domain: 'string',
        fullName: 'string',
        description: 'string',
        passwordChangeable: boolean,
        passwordExpires: boolean,
        passwordRequired: boolean,
        sid: 'string',
        status: 'string'
      }]
    */
  }, errorHandler);

Mac Return an array of nic info.

pc.mac().then(function(list){
  console.log(list);
  /*
  [{
    interfaceIndex: number,
    name: 'string',
    macAddress: 'macaddress',
    manufacturer: 'string',
    timeOfLastReset: time
  }]
  */
}, errorHandler);

Programs Return an array with all the applications installed in the computer.

pc.programs().then(function(list){
  console.log(list); // [{ name: 'string' }]
}, errorHandler);

Programs Return an array with all shares in the computer.

pc.share().then(function(list){
  console.log(list);
  /*
  [{
    name: 'string',
    caption: 'string',
    path: 'string',
    type: number
  }]
  */
}, errorHandler);

Useful Methods

getAll Retrieve all the information from the computer

  pc.getAll().then(function(everything){
    console.log(everything)
  }, errorHandler);

get Get an object with selected attributes

  pc.get(['mac, publicIP, users']).then(function(results){
    console.log(results); //{ mac: [{object}], publicIP: 'ipaddress', users: [{object}] }
  }, errorHandler)