Merge branch 'master' into fix/windows-designed-capacity
This commit is contained in:
commit
955ec18258
@ -77,6 +77,7 @@ For major (breaking) changes - **version 4, 3 and 2** - see end of page.
|
||||
|
||||
| Version | Date | Comment |
|
||||
| -------------- | -------------- | -------- |
|
||||
| 5.7.8 | 2021-07-16 | `battery()` fix designedCapacity (win, linux), fix catch error |
|
||||
| 5.7.7 | 2021-06-15 | `graphics()` improved detection screen resolution (macOS) |
|
||||
| 5.7.6 | 2021-06-09 | `battery()` improved detection (additional batteries windows) |
|
||||
| 5.7.5 | 2021-06-08 | `memLayout()` improved clock speed detection (windows) |
|
||||
@ -236,7 +237,7 @@ For major (breaking) changes - **version 4, 3 and 2** - see end of page.
|
||||
| 4.21.0 | 2020-01-27 | `npx` compatibility |
|
||||
| 4.20.1 | 2020-01-26 | `battery()` code refactoring, cleanup, updated docs |
|
||||
| 4.20.1 | 2020-01-26 | `battery()` code refactoring, cleanup, updated docs |
|
||||
| 4.20.0 | 2020-01-25 | `battery()` added designcapacity, voltage, unit |
|
||||
| 4.20.0 | 2020-01-25 | `battery()` added designCapacity, voltage, unit |
|
||||
| 4.19.4 | 2020-01-24 | `mem()` prevent log messages, `memgetDefaultNetworkInterface()` catch errors |
|
||||
| 4.19.3 | 2020-01-24 | `memLayout()` bank info fix macOS |
|
||||
| 4.19.2 | 2020-01-19 | `cpu()` muli-processor fix windows |
|
||||
|
||||
@ -30,7 +30,7 @@
|
||||
[![Sponsoring][sponsor-badge]][sponsor-url]
|
||||
[![MIT license][license-img]][license-url]
|
||||
|
||||
This is amazing. Started as a small project just for myself, it now has > 10,000 lines of code, > 400 versions published, up to 3 mio downloads per month, > 30 mio downloads overall. Thank you to all who contributed to this project!
|
||||
This is amazing. Started as a small project just for myself, it now has > 10,000 lines of code, > 400 versions published, up to 3 mio downloads per month, > 40 mio downloads overall. Thank you to all who contributed to this project!
|
||||
|
||||
## New Version 5.0
|
||||
|
||||
|
||||
@ -56,6 +56,11 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th scope="row">5.7.8</th>
|
||||
<td>2021-07-16</td>
|
||||
<td><span class="code">battery()</span> fix designedCapacity (win, linux), fix catch error</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">5.7.7</th>
|
||||
<td>2021-06-15</td>
|
||||
|
||||
@ -170,7 +170,7 @@
|
||||
<img class="logo" src="assets/logo.png">
|
||||
<div class="title">systeminformation</div>
|
||||
<div class="subtitle"><span id="typed"></span> </div>
|
||||
<div class="version">New Version: <span id="version">5.7.7</span></div>
|
||||
<div class="version">New Version: <span id="version">5.7.8</span></div>
|
||||
<button class="btn btn-light" onclick="location.href='https://github.com/sebhildebrandt/systeminformation'">View on Github <i class=" fab fa-github"></i></button>
|
||||
</div>
|
||||
<div class="down">
|
||||
@ -211,7 +211,7 @@
|
||||
<div class="title">Downloads last month</div>
|
||||
</div>
|
||||
<div class="col-xl-4 col-lg-4 col-md-4 col-12">
|
||||
<div class="numbers">424</div>
|
||||
<div class="numbers">447</div>
|
||||
<div class="title">Dependents</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -27,7 +27,7 @@ const _openbsd = (_platform === 'openbsd');
|
||||
const _netbsd = (_platform === 'netbsd');
|
||||
const _sunos = (_platform === 'sunos');
|
||||
|
||||
function parseWinBatteryPart(lines, designCapacity, fullChargeCapacity) {
|
||||
function parseWinBatteryPart(lines, designedCapacity, fullChargeCapacity) {
|
||||
const result = {};
|
||||
let status = util.getValue(lines, 'BatteryStatus', '=').trim();
|
||||
// 1 = "Discharging"
|
||||
@ -46,7 +46,7 @@ function parseWinBatteryPart(lines, designCapacity, fullChargeCapacity) {
|
||||
result.status = statusValue;
|
||||
result.hasBattery = true;
|
||||
result.maxCapacity = fullChargeCapacity || parseInt(util.getValue(lines, 'DesignCapacity', '=') || 0);
|
||||
result.designedCapacity = parseInt(util.getValue(lines, 'DesignCapacity', '=') || designCapacity);
|
||||
result.designedCapacity = parseInt(util.getValue(lines, 'DesignCapacity', '=') || designedCapacity);
|
||||
result.voltage = parseInt(util.getValue(lines, 'DesignVoltage', '=') || 0) / 1000.0;
|
||||
result.capacityUnit = 'mWh';
|
||||
result.percent = parseInt(util.getValue(lines, 'EstimatedChargeRemaining', '=') || 0);
|
||||
@ -105,7 +105,7 @@ module.exports = function (callback) {
|
||||
result.currentCapacity = Math.round(parseInt('0' + util.getValue(lines, 'POWER_SUPPLY_CHARGE_NOW', '='), 10) / 1000.0 / (result.voltage || 1));
|
||||
if (!result.maxCapacity) {
|
||||
result.maxCapacity = parseInt('0' + util.getValue(lines, 'POWER_SUPPLY_ENERGY_FULL', '='), 10) / 1000.0;
|
||||
result.designCapacity = parseInt('0' + util.getValue(lines, 'POWER_SUPPLY_ENERGY_FULL_DESIGN', '='), 10) / 1000.0 | result.maxCapacity;
|
||||
result.designedCapacity = parseInt('0' + util.getValue(lines, 'POWER_SUPPLY_ENERGY_FULL_DESIGN', '='), 10) / 1000.0 | result.maxCapacity;
|
||||
result.currentCapacity = parseInt('0' + util.getValue(lines, 'POWER_SUPPLY_ENERGY_NOW', '='), 10) / 1000.0;
|
||||
}
|
||||
const percent = util.getValue(lines, 'POWER_SUPPLY_CAPACITY', '=');
|
||||
|
||||
14
lib/util.js
14
lib/util.js
@ -684,11 +684,15 @@ function getFilesInPath(source) {
|
||||
}
|
||||
|
||||
function getFilesRecursively(source) {
|
||||
let dirs = getDirectories(source);
|
||||
let files = dirs
|
||||
.map(function (dir) { return getFilesRecursively(dir); })
|
||||
.reduce(function (a, b) { return a.concat(b); }, []);
|
||||
return files.concat(getFiles(source));
|
||||
try {
|
||||
let dirs = getDirectories(source);
|
||||
let files = dirs
|
||||
.map(function (dir) { return getFilesRecursively(dir); })
|
||||
.reduce(function (a, b) { return a.concat(b); }, []);
|
||||
return files.concat(getFiles(source));
|
||||
} catch (e) {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
if (fs.existsSync(source)) {
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "systeminformation",
|
||||
"version": "5.7.7",
|
||||
"version": "5.7.8",
|
||||
"description": "Simple system and OS information library",
|
||||
"license": "MIT",
|
||||
"author": "Sebastian Hildebrandt <hildebrandt@plus-innovations.com> (https://plus-innovations.com)",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user