cmd-johnson / node-power-info

Cross-platform node library for accessing battery power information
https://www.npmjs.com/package/node-power-info
MIT License
3 stars 2 forks source link

Add Support for Windows #7

Closed cmd-johnson closed 6 years ago

cmd-johnson commented 7 years ago

Currently, the module doesn't work on Windows, missing out on a large user-base. Investigate where to get the battery information on Windows from and implement it.

muten84 commented 7 years ago

os:Windows_NT function () { return process.arch; } @ 10.0.10240

hendrikbl commented 6 years ago

There is a Win32_Battery class on Windows giving you access to battery info: https://msdn.microsoft.com/en-us/library/aa394074.aspx. Maybe this could be used for a Windows implementation?

cmd-johnson commented 6 years ago

SINce this package's main use probably is in atom-battery-status, adding the Battery Status API provider (#10) finally makes it possible to use this on Windows. The only restriction is that this requires the navigator object to exist, which it only does when runnig inside a browser, so this module still won't work on Windows in node.js.