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

smc

v2.0.0

Published

Node module to read the CPU temperature and fan speed on osx using smc

Downloads

11

Readme

Node SMC

This node module uses Apple's SMC subsystem to query the system for the CPU temperature, number of fans and for each of the fans retrieves the current RPM.

This packages works on OSX only.

Installation

npm install smc

Example

var smc = require('smc');

Object.keys(smc.metrics).forEach(function(key) {
  var value = smc.get(key);
  if (value > 0) {
    console.log(key, smc.metrics[key]+':', value);
  }
});

var i, f = smc.fans();

for (i = 0; i < f; i++) {
  console.log('F'+i+'Ac', 'Fan', i, 'RPM:', smc.fanRpm(i));
}

On my Macbook Pro this prints out the following:

TB0T Battery TS_MAX: 34.59765625
TB1T Battery 1: 34.59765625
TB2T Battery 2: 32.59765625
TCXC PECI CPU: 78.875
TC0E CPU 0 ??: 80.56640625
TC0F CPU 0 ??: 82.16015625
TC0P CPU 0 Proximity: 65.875
TC1C Core 1: 77
TC2C Core 2: 78
TC3C Core 3: 77
TC4C Core 4: 75
TCGC PECI GPU: 78
TCSA PECI SA: 78
Th1H NB/CPU/GPU HeatPipe 1 Proximity: 51.625
TM0P Memory Slot Proximity: 53.125
TM0S Memory Slot 1: 53.1171875
TPCD Platform Controller Hub Die: 57
Ts0P Palm rest L: 32.5
Ts0S Memory Bank Proximity: 40.23046875
TW0P AirPort Proximity: 48.5
F0Ac Fan 0 RPM: 2160
F1Ac Fan 1 RPM: 2001

Credits

Most of the work was done by Sébastien Lavoie in his osx-cpu-temp code. I just took it and made it into a node module, as it was convenient for me to use it that way.

Additional credit goes to Hendrik Holtmann, the author of smcFanControl as his code inspired osx-cpu-temp and as I used part of the code of smcFanControl to query the fan speed and format the result.

License

GNU General Public License, version 2

TODO

Make it asynchronous, as currently everything happens synchronously.