systeminformation
Advanced tools
Comparing version 3.23.1 to 3.23.2
@@ -101,2 +101,3 @@ # Changelog | ||
| -------------- | -------------- | -------- | | ||
| 3.23.2 | 2017-06-23 | bug fix `battery` (windows) | | ||
| 3.23.1 | 2017-06-22 | updated docs | | ||
@@ -103,0 +104,0 @@ | 3.23.0 | 2017-06-22 | added `memLayout`, `diskLayout`, extended windows support (`inetChecksite`)| |
@@ -120,10 +120,13 @@ 'use strict'; | ||
exec("WMIC Path Win32_Battery Get BatteryStatus, DesignCapacity, EstimatedChargeRemaining /value", function (error, stdout) { | ||
if (!error) { | ||
if (stdout) { | ||
let lines = stdout.split('\r\n'); | ||
let status = parseInt(getValue(lines, 'BatteryStatus', '=') || '2'); | ||
result.hasbattery = true; | ||
result.maxcapacity = parseInt(getValue(lines, 'DesignCapacity', '=') || 0); | ||
result.percent = parseInt(getValue(lines, 'EstimatedChargeRemaining', '=') || 0); | ||
result.currentcapacity = parseInt(result.maxcapacity * result.percent / 100); | ||
result.ischarging = (status >= 6 && status <= 9) || (!(status === 3) && !(status === 1) && result.percent < 100); | ||
let status = getValue(lines, 'BatteryStatus', '=').trim(); | ||
if (status) { | ||
status = parseInt(status || '2'); | ||
result.hasbattery = true; | ||
result.maxcapacity = parseInt(getValue(lines, 'DesignCapacity', '=') || 0); | ||
result.percent = parseInt(getValue(lines, 'EstimatedChargeRemaining', '=') || 0); | ||
result.currentcapacity = parseInt(result.maxcapacity * result.percent / 100); | ||
result.ischarging = (status >= 6 && status <= 9) || (!(status === 3) && !(status === 1) && result.percent < 100); | ||
} | ||
} | ||
@@ -130,0 +133,0 @@ if (callback) { callback(result) } |
{ | ||
"name": "systeminformation", | ||
"version": "3.23.1", | ||
"version": "3.23.2", | ||
"description": "Simple system and OS information library", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -13,3 +13,3 @@ # systeminformation | ||
Collection of 30+ functions to retrieve detailed hardware, system and OS information (Linux, OSX and now partial Windows support) | ||
Collection of 35+ functions to retrieve detailed hardware, system and OS information (Linux, OSX and partial Windows support) | ||
@@ -114,3 +114,3 @@ ### Installation | ||
#### 3. CPU, Memory, Battery, Graphics | ||
#### 3. CPU, Memory, Disks, Battery, Graphics | ||
@@ -117,0 +117,0 @@ | Function | Result object | Linux | OSX | Win | Comments | |
204902
4330