Battery

In this section you will learn how to get battery information - if supported by system:

For function reference and examples we assume, that we imported systeminformation as follows:

const si = require('systeminformation');

Battery Data

All functions in this section return a promise or can be called with a callback function (parameter cb in the function reference)

Function Result object Linux BSD Mac Win Sun Comments
si.battery(cb) {...} X X X X battery information
hasbattery X X X X indicates presence of battery
cyclecount X X numbers of recharges
ischarging X X X X indicates if battery is charging
maxcapacity X X X max capacity of battery
currentcapacity X X X current capacity of battery
percent X X X X charging level in percent
timeremaining X X minutes left (if discharging)
acconnected X X X X AC connected
type X X battery type
model X X model
manufacturer X X manufacturer
serial X X battery serial

Known issues

Windows Battery

wmic - which is used to determine temperature and battery sometimes needs to be run with admin privileges. So if you do not get any values, try to run it again with according privileges. If you still do not get any values, your system might not support this feature.