gillstrom / battery-level

Get current battery level

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Windows 10 return NaN

muten84 opened this issue · comments

I'm trying to use your module as dependencies on an electron app. The code i run is very simple and the promise resolve a NaN value.

The os is Windows 10.

What does WMIC Path Win32_Battery Get EstimatedChargeRemaining return if you run it manually?

Old issue, but still relevant. Confirmed on Windows 10, on a desktop computer without battery.

Related: On both MacOS and Linux, an error is thrown if no battery was found. It would be great if this was the case on Windows as well, then a try-catch block can be used to detect presence of a battery.

Alternatively, return null or false to indicate the absence of a battery to avoid the overhead of throwing an error.

Do you accept pull requests?

Do you accept pull requests?

Yes!