libsmc
libsmc is a node.js binding to libsmc. It retrieves info from the Apple System Management Controller API. The SMC manages temperature and power within the machine.
API
smc.isBatteryPowered()
Checks whether or not the machine is running on battery power. Returns a
bool
value.
var smc = ; var usingBattery = smc;// => false
smc.isOpticalDiskDriveFull()
Checks whether or not the optical disk drive (ODD) of the machine has a disk
in it. Returns a bool
value.
var smc = ; var hasDisk = smc;// => true
smc.getNumberOfFans()
Gets the number of fans a machine has. Returns an int
value.
var smc = ; var number = smc;// => 2
smc.getFan(number)
Gets the information related to a specific fan. number
is a positive integer
unique to that fan, starting at 0. Returns an object of format
{ name, speed }
, where name
is the given name from the machine, and speed
is the RPM (rotations per minute) of the fan at that point in time.
var smc = ; var fan = smc;// => { name: 'ExhaustZ', speed: 2176 }
License
MIT license. beltex's libsmc is licensed separately.