battery-status
v1.0.3
Published
Get the raw status of a battery
Downloads
14
Readme
battery-status
Get the raw status of a battery. Probably only works on Linux.
Example
var batteryStatus = require('battery-status');
batteryStatus('BAT1', function(error, status) {
if (error) {
throw error;
}
console.log(status);
// => 'Discharging'
});
Installation
$ npm install battery-status
API
var batteryStatus = require('battery-status');
battery-status([battery='BAT0'], callback)
Calls callback(error, status)
, where error
is any Error encountered and
String status
is the raw status of String battery
(which defaults to
'BAT0'
).