systeminformation 6.0.0-beta.5 → 6.0.0-beta.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -0
- package/dist/common/files.d.ts +1 -0
- package/dist/common/files.js +10 -1
- package/dist/common/types.d.ts +7 -0
- package/dist/darwin/fans.d.ts +2 -0
- package/dist/darwin/fans.js +28 -0
- package/dist/darwin/index.d.ts +1 -0
- package/dist/darwin/index.js +4 -2
- package/dist/fans.d.ts +1 -0
- package/dist/fans.js +17 -0
- package/dist/get-data.d.ts +2 -0
- package/dist/get-data.js +3 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +4 -2
- package/dist/linux/audio.js +8 -4
- package/dist/linux/fans.d.ts +2 -0
- package/dist/linux/fans.js +91 -0
- package/dist/linux/gpu.js +3 -10
- package/dist/linux/index.d.ts +1 -0
- package/dist/linux/index.js +4 -2
- package/dist/windows/fans.d.ts +2 -0
- package/dist/windows/fans.js +71 -0
- package/dist/windows/index.d.ts +1 -0
- package/dist/windows/index.js +4 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -289,6 +289,12 @@ Full function reference with examples can be found at [https://systeminformation
|
|
|
289
289
|
| | max | X | X | X | X | | max temperature |
|
|
290
290
|
| | socket | X | | | | | array socket temperatures |
|
|
291
291
|
| | chipset | X | | | | | chipset temperature |
|
|
292
|
+
| si.fans() | [{...}] | X | | X* | X* | | detected fans |
|
|
293
|
+
| | [0].id | X | | X* | X* | | identifier, e.g. hwmon2/fan1 |
|
|
294
|
+
| | [0].label | X | | X* | X* | | label if the driver provides one |
|
|
295
|
+
| | [0].rpm | X | | X* | X* | | speed in rpm (or null) |
|
|
296
|
+
| | [0].pwm | X | | X* | X* | | duty cycle in % (or null) |
|
|
297
|
+
| | [0].source | X | | X* | X* | | chip / provider the value came from |
|
|
292
298
|
| si.npu() | [{...}] | X | | X | X | | detected NPUs / AI accelerators |
|
|
293
299
|
| | [0].vendor | X | | X | X | | vendor (Intel, AMD, Apple, ...) |
|
|
294
300
|
| | [0].name | X | | X | X | | name |
|
|
@@ -1005,6 +1011,11 @@ $ npm install macos-temperature-sensor --save
|
|
|
1005
1011
|
|
|
1006
1012
|
`systeminformation` will then detect this additional library and return the temperature when calling systeminformations standard function `cpuTemperature()`.
|
|
1007
1013
|
On Apple Silicon machines `macos-temperature-sensor` also enables the GPU temperature (`temperatureGpu`) in `gpu()`
|
|
1014
|
+
and - as soon as the package exposes them - the fan speeds in `fans()`.
|
|
1015
|
+
|
|
1016
|
+
#### Windows - Fan Speed
|
|
1017
|
+
|
|
1018
|
+
Windows itself does not expose actual fan speeds: `Win32_Fan` only reports that a fan exists, its `DesiredSpeed` is the *requested* speed and is left empty by virtually every mainboard. Real values are read from a running [LibreHardwareMonitor](https://github.com/LibreHardwareMonitor/LibreHardwareMonitor) or OpenHardwareMonitor, which publish their sensors in an own WMI namespace. Without one of these tools running, `fans()` returns an empty array or entries without `rpm`.
|
|
1008
1019
|
|
|
1009
1020
|
#### Windows Temperature, Battery, ...
|
|
1010
1021
|
|
package/dist/common/files.d.ts
CHANGED
package/dist/common/files.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.fileExists = exports.getFilesInPath = void 0;
|
|
3
|
+
exports.readSysfs = exports.fileExists = exports.getFilesInPath = void 0;
|
|
4
4
|
const fs_1 = require("fs");
|
|
5
5
|
const promises_1 = require("fs/promises");
|
|
6
6
|
const path_1 = require("path");
|
|
@@ -37,3 +37,12 @@ const fileExists = async (file) => {
|
|
|
37
37
|
}
|
|
38
38
|
};
|
|
39
39
|
exports.fileExists = fileExists;
|
|
40
|
+
const readSysfs = async (file) => {
|
|
41
|
+
try {
|
|
42
|
+
return (await (0, promises_1.readFile)(file, 'utf8')).trim();
|
|
43
|
+
}
|
|
44
|
+
catch {
|
|
45
|
+
return '';
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
exports.readSysfs = readSysfs;
|
package/dist/common/types.d.ts
CHANGED
|
@@ -321,6 +321,13 @@ export type CpuTemperatureObject = {
|
|
|
321
321
|
socket: number[];
|
|
322
322
|
chipset: number | null;
|
|
323
323
|
};
|
|
324
|
+
export type FanData = {
|
|
325
|
+
id: string;
|
|
326
|
+
label: string | null;
|
|
327
|
+
rpm: number | null;
|
|
328
|
+
pwm: number | null;
|
|
329
|
+
source: string;
|
|
330
|
+
};
|
|
324
331
|
export type CurrentLoadData = {
|
|
325
332
|
avgLoad: number;
|
|
326
333
|
currentLoad: number;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fans = void 0;
|
|
4
|
+
const common_1 = require("../common");
|
|
5
|
+
const fans = async () => {
|
|
6
|
+
await (0, common_1.nextTick)();
|
|
7
|
+
const result = [];
|
|
8
|
+
try {
|
|
9
|
+
const macosTemp = require('macos-temperature-sensor');
|
|
10
|
+
if (typeof macosTemp.fans === 'function') {
|
|
11
|
+
const res = macosTemp.fans();
|
|
12
|
+
if (Array.isArray(res)) {
|
|
13
|
+
res.forEach((fan, index) => {
|
|
14
|
+
result.push({
|
|
15
|
+
id: `fan${index}`,
|
|
16
|
+
label: fan?.label || null,
|
|
17
|
+
rpm: typeof fan?.rpm === 'number' ? Math.round(fan.rpm) : null,
|
|
18
|
+
pwm: typeof fan?.pwm === 'number' ? Math.round(fan.pwm) : null,
|
|
19
|
+
source: 'SMC'
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
catch { }
|
|
26
|
+
return result;
|
|
27
|
+
};
|
|
28
|
+
exports.fans = fans;
|
package/dist/darwin/index.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export { cpuCache } from './cpu-cache';
|
|
|
11
11
|
export { cpuCurrentSpeed } from '../cpu-current-speed';
|
|
12
12
|
export { cpuFlags } from './cpu-flags';
|
|
13
13
|
export { cpuTemperature } from './cpu-temperature';
|
|
14
|
+
export { fans } from './fans';
|
|
14
15
|
export { currentLoad } from '../cpu-current-load';
|
|
15
16
|
export { diskLayout } from './disk-layout';
|
|
16
17
|
export { disksIO } from './disks-io';
|
package/dist/darwin/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.wifiNetworks = exports.wifiInterfaces = exports.wifiConnections = exports.versions = exports.version = exports.vboxInfo = exports.uuid = exports.users = exports.usb = exports.time = exports.thunderbolt = exports.system = void 0;
|
|
3
|
+
exports.shell = exports.services = exports.processLoad = exports.processes = exports.printer = exports.pci = exports.osInfo = exports.npu = exports.npm = exports.networkStats = exports.networkInterfaces = exports.networkInterfaceDefault = exports.networkGatewayDefault = exports.networkConnections = exports.mouse = exports.memLayout = exports.mem = exports.keyboard = exports.inetLatency = exports.inetChecksite = exports.gpu = exports.fullLoad = exports.fsStats = exports.fsSize = exports.fsOpenFiles = exports.dockerAll = exports.dockerVolumes = exports.dockerContainerProcesses = exports.dockerContainerStats = exports.dockerContainers = exports.dockerImages = exports.dockerInfo = exports.displays = exports.disksIO = exports.diskLayout = exports.currentLoad = exports.fans = exports.cpuTemperature = exports.cpuFlags = exports.cpuCurrentSpeed = exports.cpuCache = exports.cpu = exports.chassis = exports.camera = exports.bluetoothDevices = exports.blockDevices = exports.bios = exports.battery = exports.baseboard = exports.audio = void 0;
|
|
4
|
+
exports.wifiNetworks = exports.wifiInterfaces = exports.wifiConnections = exports.versions = exports.version = exports.vboxInfo = exports.uuid = exports.users = exports.usb = exports.time = exports.thunderbolt = exports.system = exports.software = void 0;
|
|
5
5
|
var audio_1 = require("./audio");
|
|
6
6
|
Object.defineProperty(exports, "audio", { enumerable: true, get: function () { return audio_1.audio; } });
|
|
7
7
|
var baseboard_1 = require("./baseboard");
|
|
@@ -28,6 +28,8 @@ var cpu_flags_1 = require("./cpu-flags");
|
|
|
28
28
|
Object.defineProperty(exports, "cpuFlags", { enumerable: true, get: function () { return cpu_flags_1.cpuFlags; } });
|
|
29
29
|
var cpu_temperature_1 = require("./cpu-temperature");
|
|
30
30
|
Object.defineProperty(exports, "cpuTemperature", { enumerable: true, get: function () { return cpu_temperature_1.cpuTemperature; } });
|
|
31
|
+
var fans_1 = require("./fans");
|
|
32
|
+
Object.defineProperty(exports, "fans", { enumerable: true, get: function () { return fans_1.fans; } });
|
|
31
33
|
var cpu_current_load_1 = require("../cpu-current-load");
|
|
32
34
|
Object.defineProperty(exports, "currentLoad", { enumerable: true, get: function () { return cpu_current_load_1.currentLoad; } });
|
|
33
35
|
var disk_layout_1 = require("./disk-layout");
|
package/dist/fans.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const fans: () => Promise<import("./common/types").FanData[] | null>;
|
package/dist/fans.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fans = void 0;
|
|
4
|
+
const const_1 = require("./common/const");
|
|
5
|
+
const fans = async () => {
|
|
6
|
+
switch (true) {
|
|
7
|
+
case const_1.LINUX || const_1.ANDROID:
|
|
8
|
+
return (await import('./linux/fans.js')).fans();
|
|
9
|
+
case const_1.DARWIN:
|
|
10
|
+
return (await import('./darwin/fans.js')).fans();
|
|
11
|
+
case const_1.WINDOWS:
|
|
12
|
+
return (await import('./windows/fans.js')).fans();
|
|
13
|
+
default:
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
exports.fans = fans;
|
package/dist/get-data.d.ts
CHANGED
|
@@ -40,6 +40,7 @@ export declare const getDynamicData: (srv?: string, iface?: string) => Promise<{
|
|
|
40
40
|
processes: import("./common/types").ProcessesData | null;
|
|
41
41
|
currentLoad: import("./common/types").CurrentLoadData;
|
|
42
42
|
temp: any;
|
|
43
|
+
fans: import("./common/types").FanData[] | null;
|
|
43
44
|
networkStats: import("./common/types").NetworkStatsData[] | null;
|
|
44
45
|
networkConnections: import("./common/types").NetworkConnectionsData[] | null;
|
|
45
46
|
mem: any;
|
|
@@ -68,6 +69,7 @@ export declare const getAllData: (srv?: string, iface?: string) => Promise<{
|
|
|
68
69
|
processes: import("./common/types").ProcessesData | null;
|
|
69
70
|
currentLoad: import("./common/types").CurrentLoadData;
|
|
70
71
|
temp: any;
|
|
72
|
+
fans: import("./common/types").FanData[] | null;
|
|
71
73
|
networkStats: import("./common/types").NetworkStatsData[] | null;
|
|
72
74
|
networkConnections: import("./common/types").NetworkConnectionsData[] | null;
|
|
73
75
|
mem: any;
|
package/dist/get-data.js
CHANGED
|
@@ -99,13 +99,14 @@ const getStaticData = async () => {
|
|
|
99
99
|
exports.getStaticData = getStaticData;
|
|
100
100
|
const getDynamicData = async (srv = '', iface = '') => {
|
|
101
101
|
await (0, common_1.nextTick)();
|
|
102
|
-
const [time, cpuCurrentSpeed, users, processes, currentLoad, temp, networkStats, networkConnections, mem, battery, services, fsSize, fsStats, disksIO, wifiNetworks, wifiConnections, fsOpenFiles, blockDevices, inetLatency] = await Promise.all([
|
|
102
|
+
const [time, cpuCurrentSpeed, users, processes, currentLoad, temp, fans, networkStats, networkConnections, mem, battery, services, fsSize, fsStats, disksIO, wifiNetworks, wifiConnections, fsOpenFiles, blockDevices, inetLatency] = await Promise.all([
|
|
103
103
|
si.time(),
|
|
104
104
|
si.cpuCurrentSpeed(),
|
|
105
105
|
si.users(),
|
|
106
106
|
si.processes(),
|
|
107
107
|
si.currentLoad(),
|
|
108
108
|
si.cpuTemperature(),
|
|
109
|
+
si.fans(),
|
|
109
110
|
(async () => si.networkStats(iface || (await si.networkInterfaceDefault()) || '*'))(),
|
|
110
111
|
si.networkConnections(),
|
|
111
112
|
si.mem(),
|
|
@@ -129,6 +130,7 @@ const getDynamicData = async (srv = '', iface = '') => {
|
|
|
129
130
|
processes,
|
|
130
131
|
currentLoad,
|
|
131
132
|
temp,
|
|
133
|
+
fans,
|
|
132
134
|
networkStats,
|
|
133
135
|
networkConnections,
|
|
134
136
|
mem,
|
package/dist/index.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export { cpuCache } from './cpu-cache';
|
|
|
11
11
|
export { cpuCurrentSpeed } from './cpu-current-speed';
|
|
12
12
|
export { cpuFlags } from './cpu-flags';
|
|
13
13
|
export { cpuTemperature } from './cpu-temperature';
|
|
14
|
+
export { fans } from './fans';
|
|
14
15
|
export { currentLoad } from './cpu-current-load';
|
|
15
16
|
export { diskLayout } from './disk-layout';
|
|
16
17
|
export { disksIO } from './disks-io';
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.wifiNetworks = exports.wifiInterfaces = exports.wifiConnections = exports.versions = exports.version = exports.vboxInfo = exports.uuid = exports.users = exports.usb = exports.time = exports.thunderbolt = exports.system = exports.software = exports.shell = exports.services = exports.processLoad = exports.processes = exports.printer = void 0;
|
|
3
|
+
exports.osInfo = exports.observe = exports.npu = exports.npm = exports.networkStats = exports.networkInterfaces = exports.networkInterfaceDefault = exports.networkGatewayDefault = exports.networkConnections = exports.mouse = exports.memLayout = exports.mem = exports.keyboard = exports.inetPublicIp = exports.inetLatency = exports.inetChecksite = exports.gpu = exports.getAllData = exports.getDynamicData = exports.getStaticData = exports.get = exports.fullLoad = exports.fsStats = exports.fsSize = exports.fsOpenFiles = exports.dockerAll = exports.dockerVolumes = exports.dockerContainerProcesses = exports.dockerContainerStats = exports.dockerContainers = exports.dockerImages = exports.dockerInfo = exports.displays = exports.disksIO = exports.diskLayout = exports.currentLoad = exports.fans = exports.cpuTemperature = exports.cpuFlags = exports.cpuCurrentSpeed = exports.cpuCache = exports.cpu = exports.chassis = exports.camera = exports.bluetoothDevices = exports.blockDevices = exports.bios = exports.battery = exports.baseboard = exports.audio = void 0;
|
|
4
|
+
exports.wifiNetworks = exports.wifiInterfaces = exports.wifiConnections = exports.versions = exports.version = exports.vboxInfo = exports.uuid = exports.users = exports.usb = exports.time = exports.thunderbolt = exports.system = exports.software = exports.shell = exports.services = exports.processLoad = exports.processes = exports.printer = exports.pci = void 0;
|
|
5
5
|
var audio_1 = require("./audio");
|
|
6
6
|
Object.defineProperty(exports, "audio", { enumerable: true, get: function () { return audio_1.audio; } });
|
|
7
7
|
var baseboard_1 = require("./baseboard");
|
|
@@ -28,6 +28,8 @@ var cpu_flags_1 = require("./cpu-flags");
|
|
|
28
28
|
Object.defineProperty(exports, "cpuFlags", { enumerable: true, get: function () { return cpu_flags_1.cpuFlags; } });
|
|
29
29
|
var cpu_temperature_1 = require("./cpu-temperature");
|
|
30
30
|
Object.defineProperty(exports, "cpuTemperature", { enumerable: true, get: function () { return cpu_temperature_1.cpuTemperature; } });
|
|
31
|
+
var fans_1 = require("./fans");
|
|
32
|
+
Object.defineProperty(exports, "fans", { enumerable: true, get: function () { return fans_1.fans; } });
|
|
31
33
|
var cpu_current_load_1 = require("./cpu-current-load");
|
|
32
34
|
Object.defineProperty(exports, "currentLoad", { enumerable: true, get: function () { return cpu_current_load_1.currentLoad; } });
|
|
33
35
|
var disk_layout_1 = require("./disk-layout");
|
package/dist/linux/audio.js
CHANGED
|
@@ -51,11 +51,15 @@ const parseAudioAlsa = (stdout) => {
|
|
|
51
51
|
const [cards, pcms] = `${stdout}`.split('--pcm--');
|
|
52
52
|
const lines = (cards || '').split('\n');
|
|
53
53
|
lines.forEach((line, i) => {
|
|
54
|
-
const card = line.match(/^\s*(\d+)\s+\[(.+?)\s*\]:\s*(
|
|
55
|
-
if (card) {
|
|
54
|
+
const card = line.match(/^\s*(\d+)\s+\[(.+?)\s*\]:\s*(.*)$/);
|
|
55
|
+
if (card && card[3].trim()) {
|
|
56
56
|
const index = card[1];
|
|
57
|
-
const
|
|
58
|
-
const name = card[
|
|
57
|
+
const sep = card[3].lastIndexOf(' - ');
|
|
58
|
+
const name = (sep >= 0 ? card[3].substring(sep + 3) : card[3]).trim();
|
|
59
|
+
let driver = (sep >= 0 ? card[3].substring(0, sep) : '').trim();
|
|
60
|
+
if (name && driver.endsWith(name)) {
|
|
61
|
+
driver = driver.substring(0, driver.length - name.length).trim();
|
|
62
|
+
}
|
|
59
63
|
const longName = (lines[i + 1] || '').trim();
|
|
60
64
|
const manufacturer = longName.indexOf(name) > 0 ? longName.substring(0, longName.indexOf(name)).trim() : '';
|
|
61
65
|
const devices = (pcms || '').split('\n').filter((pcm) => pcm.indexOf(`/card${index}/pcm`) >= 0);
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fans = void 0;
|
|
4
|
+
const promises_1 = require("fs/promises");
|
|
5
|
+
const common_1 = require("../common");
|
|
6
|
+
const files_1 = require("../common/files");
|
|
7
|
+
const toNumber = (value) => {
|
|
8
|
+
const result = Number.parseFloat(value);
|
|
9
|
+
return Number.isNaN(result) ? null : result;
|
|
10
|
+
};
|
|
11
|
+
const pwmToPercent = (value) => {
|
|
12
|
+
const raw = toNumber(value);
|
|
13
|
+
return raw === null ? null : Math.round((raw / 255) * 100);
|
|
14
|
+
};
|
|
15
|
+
const hwmonFans = async (hwmonPath) => {
|
|
16
|
+
const fans = [];
|
|
17
|
+
let nodes = [];
|
|
18
|
+
try {
|
|
19
|
+
nodes = await (0, promises_1.readdir)(hwmonPath);
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
return fans;
|
|
23
|
+
}
|
|
24
|
+
for (const node of nodes) {
|
|
25
|
+
const entries = [];
|
|
26
|
+
try {
|
|
27
|
+
entries.push(...(await (0, promises_1.readdir)(`${hwmonPath}/${node}`)));
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
continue;
|
|
31
|
+
}
|
|
32
|
+
const source = (await (0, files_1.readSysfs)(`${hwmonPath}/${node}/name`)) || node;
|
|
33
|
+
for (const entry of entries) {
|
|
34
|
+
const match = /^fan(\d+)_input$/.exec(entry);
|
|
35
|
+
if (!match) {
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
const index = match[1];
|
|
39
|
+
const rpm = toNumber(await (0, files_1.readSysfs)(`${hwmonPath}/${node}/fan${index}_input`));
|
|
40
|
+
if (rpm === null) {
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
43
|
+
fans.push({
|
|
44
|
+
id: `${node}/fan${index}`,
|
|
45
|
+
label: (await (0, files_1.readSysfs)(`${hwmonPath}/${node}/fan${index}_label`)) || null,
|
|
46
|
+
rpm,
|
|
47
|
+
pwm: pwmToPercent(await (0, files_1.readSysfs)(`${hwmonPath}/${node}/pwm${index}`)),
|
|
48
|
+
source
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return fans;
|
|
53
|
+
};
|
|
54
|
+
const coolingDeviceFans = async (thermalPath) => {
|
|
55
|
+
const fans = [];
|
|
56
|
+
let nodes = [];
|
|
57
|
+
try {
|
|
58
|
+
nodes = (await (0, promises_1.readdir)(thermalPath)).filter((entry) => entry.startsWith('cooling_device'));
|
|
59
|
+
}
|
|
60
|
+
catch {
|
|
61
|
+
return fans;
|
|
62
|
+
}
|
|
63
|
+
for (const node of nodes) {
|
|
64
|
+
const type = await (0, files_1.readSysfs)(`${thermalPath}/${node}/type`);
|
|
65
|
+
if (!type.toLowerCase().includes('fan')) {
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
const current = toNumber(await (0, files_1.readSysfs)(`${thermalPath}/${node}/cur_state`));
|
|
69
|
+
const max = toNumber(await (0, files_1.readSysfs)(`${thermalPath}/${node}/max_state`));
|
|
70
|
+
if (current === null || !max) {
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
fans.push({
|
|
74
|
+
id: node,
|
|
75
|
+
label: null,
|
|
76
|
+
rpm: null,
|
|
77
|
+
pwm: Math.round((current / max) * 100),
|
|
78
|
+
source: type
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
return fans;
|
|
82
|
+
};
|
|
83
|
+
const fans = async (hwmonPath = '/sys/class/hwmon', thermalPath = '/sys/class/thermal') => {
|
|
84
|
+
await (0, common_1.nextTick)();
|
|
85
|
+
const result = await hwmonFans(hwmonPath);
|
|
86
|
+
if (!result.length) {
|
|
87
|
+
return coolingDeviceFans(thermalPath);
|
|
88
|
+
}
|
|
89
|
+
return result;
|
|
90
|
+
};
|
|
91
|
+
exports.fans = fans;
|
package/dist/linux/gpu.js
CHANGED
|
@@ -5,20 +5,13 @@ const promises_1 = require("fs/promises");
|
|
|
5
5
|
const common_1 = require("../common");
|
|
6
6
|
const const_1 = require("../common/const");
|
|
7
7
|
const exec_1 = require("../common/exec");
|
|
8
|
+
const files_1 = require("../common/files");
|
|
8
9
|
const nvidia_1 = require("../common/nvidia");
|
|
9
10
|
const raspberry_1 = require("../common/raspberry");
|
|
10
|
-
const readSysfs = async (file) => {
|
|
11
|
-
try {
|
|
12
|
-
return (await (0, promises_1.readFile)(file, 'utf8')).trim();
|
|
13
|
-
}
|
|
14
|
-
catch {
|
|
15
|
-
return '';
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
11
|
const readSysfsNumber = async (files, divisor = 1, preferNonZero = false) => {
|
|
19
12
|
let fallback = null;
|
|
20
13
|
for (const file of files) {
|
|
21
|
-
const value = Number.parseFloat(await readSysfs(file));
|
|
14
|
+
const value = Number.parseFloat(await (0, files_1.readSysfs)(file));
|
|
22
15
|
if (Number.isNaN(value)) {
|
|
23
16
|
continue;
|
|
24
17
|
}
|
|
@@ -77,7 +70,7 @@ const drmDevices = async (drmPath = '/sys/class/drm') => {
|
|
|
77
70
|
temperatureGpu: await readSysfsNumber(hwmon.map((node) => `${node}/temp1_input`), 1000),
|
|
78
71
|
powerDraw: await readSysfsNumber(hwmon.map((node) => `${node}/power1_input`), 1000000),
|
|
79
72
|
powerLimit: await readSysfsNumber(hwmon.map((node) => `${node}/power1_max`), 1000000),
|
|
80
|
-
clockCore: clockCore !== null ? clockCore : parseAmdClock(await readSysfs(`${devicePath}/pp_dpm_sclk`))
|
|
73
|
+
clockCore: clockCore !== null ? clockCore : parseAmdClock(await (0, files_1.readSysfs)(`${devicePath}/pp_dpm_sclk`))
|
|
81
74
|
});
|
|
82
75
|
}
|
|
83
76
|
return devices;
|
package/dist/linux/index.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export { cpuCache } from './cpu-cache';
|
|
|
11
11
|
export { cpuCurrentSpeed } from '../cpu-current-speed';
|
|
12
12
|
export { cpuFlags } from './cpu-flags';
|
|
13
13
|
export { cpuTemperature } from './cpu-temperature';
|
|
14
|
+
export { fans } from './fans';
|
|
14
15
|
export { currentLoad } from '../cpu-current-load';
|
|
15
16
|
export { diskLayout } from './disk-layout';
|
|
16
17
|
export { disksIO } from './disks-io';
|
package/dist/linux/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.wifiNetworks = exports.wifiInterfaces = exports.wifiConnections = exports.versions = exports.version = exports.vboxInfo = exports.uuid = exports.users = exports.usb = exports.time = exports.thunderbolt = exports.system = void 0;
|
|
3
|
+
exports.shell = exports.services = exports.processLoad = exports.processes = exports.printer = exports.pci = exports.osInfo = exports.npu = exports.npm = exports.networkStats = exports.networkInterfaces = exports.networkInterfaceDefault = exports.networkGatewayDefault = exports.networkConnections = exports.mouse = exports.memLayout = exports.mem = exports.keyboard = exports.inetLatency = exports.inetChecksite = exports.gpu = exports.fullLoad = exports.fsStats = exports.fsSize = exports.fsOpenFiles = exports.dockerAll = exports.dockerVolumes = exports.dockerContainerProcesses = exports.dockerContainerStats = exports.dockerContainers = exports.dockerImages = exports.dockerInfo = exports.displays = exports.disksIO = exports.diskLayout = exports.currentLoad = exports.fans = exports.cpuTemperature = exports.cpuFlags = exports.cpuCurrentSpeed = exports.cpuCache = exports.cpu = exports.chassis = exports.camera = exports.bluetoothDevices = exports.blockDevices = exports.bios = exports.battery = exports.baseboard = exports.audio = void 0;
|
|
4
|
+
exports.wifiNetworks = exports.wifiInterfaces = exports.wifiConnections = exports.versions = exports.version = exports.vboxInfo = exports.uuid = exports.users = exports.usb = exports.time = exports.thunderbolt = exports.system = exports.software = void 0;
|
|
5
5
|
var audio_1 = require("./audio");
|
|
6
6
|
Object.defineProperty(exports, "audio", { enumerable: true, get: function () { return audio_1.audio; } });
|
|
7
7
|
var baseboard_1 = require("./baseboard");
|
|
@@ -28,6 +28,8 @@ var cpu_flags_1 = require("./cpu-flags");
|
|
|
28
28
|
Object.defineProperty(exports, "cpuFlags", { enumerable: true, get: function () { return cpu_flags_1.cpuFlags; } });
|
|
29
29
|
var cpu_temperature_1 = require("./cpu-temperature");
|
|
30
30
|
Object.defineProperty(exports, "cpuTemperature", { enumerable: true, get: function () { return cpu_temperature_1.cpuTemperature; } });
|
|
31
|
+
var fans_1 = require("./fans");
|
|
32
|
+
Object.defineProperty(exports, "fans", { enumerable: true, get: function () { return fans_1.fans; } });
|
|
31
33
|
var cpu_current_load_1 = require("../cpu-current-load");
|
|
32
34
|
Object.defineProperty(exports, "currentLoad", { enumerable: true, get: function () { return cpu_current_load_1.currentLoad; } });
|
|
33
35
|
var disk_layout_1 = require("./disk-layout");
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fans = void 0;
|
|
4
|
+
const common_1 = require("../common");
|
|
5
|
+
const windows_1 = require("../common/windows");
|
|
6
|
+
const HARDWARE_MONITORS = [
|
|
7
|
+
{ namespace: 'root\\LibreHardwareMonitor', source: 'LibreHardwareMonitor' },
|
|
8
|
+
{ namespace: 'root\\OpenHardwareMonitor', source: 'OpenHardwareMonitor' }
|
|
9
|
+
];
|
|
10
|
+
const toNumber = (value) => {
|
|
11
|
+
const result = Number.parseFloat(value);
|
|
12
|
+
return Number.isNaN(result) ? null : result;
|
|
13
|
+
};
|
|
14
|
+
const win32Fans = async () => {
|
|
15
|
+
const fans = [];
|
|
16
|
+
try {
|
|
17
|
+
const entries = (0, windows_1.psArray)(await windows_1.ps.exec('Get-CimInstance Win32_Fan | Select-Object DeviceID,Name,DesiredSpeed | ConvertTo-Json -compress'));
|
|
18
|
+
entries.forEach((entry, index) => {
|
|
19
|
+
const rpm = toNumber(entry?.DesiredSpeed);
|
|
20
|
+
fans.push({
|
|
21
|
+
id: entry?.DeviceID || `fan${index}`,
|
|
22
|
+
label: entry?.Name || null,
|
|
23
|
+
rpm: rpm && rpm > 0 ? rpm : null,
|
|
24
|
+
pwm: null,
|
|
25
|
+
source: 'Win32_Fan'
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
catch { }
|
|
30
|
+
return fans;
|
|
31
|
+
};
|
|
32
|
+
const monitorFans = async (namespace, source) => {
|
|
33
|
+
const fans = [];
|
|
34
|
+
try {
|
|
35
|
+
const entries = (0, windows_1.psArray)(await windows_1.ps.exec(`Get-CimInstance -Namespace "${namespace}" -ClassName Sensor | Where-Object { $_.SensorType -eq 'Fan' -or $_.SensorType -eq 'Control' } | Select-Object Identifier,Name,SensorType,Value | ConvertTo-Json -compress`));
|
|
36
|
+
const controls = {};
|
|
37
|
+
entries.forEach((entry) => {
|
|
38
|
+
const value = toNumber(entry?.Value);
|
|
39
|
+
if (entry?.SensorType === 'Control' && entry?.Identifier && value !== null) {
|
|
40
|
+
controls[String(entry.Identifier).replace('/control/', '/fan/')] = Math.round(value);
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
entries.forEach((entry, index) => {
|
|
44
|
+
if (entry?.SensorType !== 'Fan') {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
const identifier = entry?.Identifier ? String(entry.Identifier) : `fan${index}`;
|
|
48
|
+
const pwm = controls[identifier];
|
|
49
|
+
fans.push({
|
|
50
|
+
id: identifier,
|
|
51
|
+
label: entry?.Name || null,
|
|
52
|
+
rpm: toNumber(entry?.Value),
|
|
53
|
+
pwm: pwm === undefined ? null : pwm,
|
|
54
|
+
source
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
catch { }
|
|
59
|
+
return fans;
|
|
60
|
+
};
|
|
61
|
+
const fans = async () => {
|
|
62
|
+
await (0, common_1.nextTick)();
|
|
63
|
+
for (const monitor of HARDWARE_MONITORS) {
|
|
64
|
+
const result = await monitorFans(monitor.namespace, monitor.source);
|
|
65
|
+
if (result.length) {
|
|
66
|
+
return result;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return win32Fans();
|
|
70
|
+
};
|
|
71
|
+
exports.fans = fans;
|
package/dist/windows/index.d.ts
CHANGED
|
@@ -19,6 +19,7 @@ export { cpu } from './cpu';
|
|
|
19
19
|
export { cpuCache } from './cpu-cache';
|
|
20
20
|
export { cpuFlags } from './cpu-flags';
|
|
21
21
|
export { cpuTemperature } from './cpu-temperature';
|
|
22
|
+
export { fans } from './fans';
|
|
22
23
|
export { diskLayout } from './disk-layout';
|
|
23
24
|
export { disksIO } from './disks-io';
|
|
24
25
|
export { displays } from './displays';
|
package/dist/windows/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.wifiNetworks = exports.wifiInterfaces = exports.wifiConnections = exports.uuid = exports.users = exports.usb = exports.thunderbolt = exports.system = exports.software = exports.shell = exports.services = exports.processes = void 0;
|
|
3
|
+
exports.printer = exports.pci = exports.osInfo = exports.npu = exports.npm = exports.networkStats = exports.networkInterfaces = exports.networkInterfaceDefault = exports.networkGatewayDefault = exports.networkConnections = exports.mouse = exports.memLayout = exports.mem = exports.keyboard = exports.inetLatency = exports.gpu = exports.fsStats = exports.fsSize = exports.fsOpenFiles = exports.displays = exports.disksIO = exports.diskLayout = exports.fans = exports.cpuTemperature = exports.cpuFlags = exports.cpuCache = exports.cpu = exports.chassis = exports.camera = exports.bluetoothDevices = exports.blockDevices = exports.bios = exports.battery = exports.baseboard = exports.audio = exports.vboxInfo = exports.versions = exports.version = exports.time = exports.inetChecksite = exports.dockerVolumes = exports.dockerInfo = exports.dockerImages = exports.dockerContainerStats = exports.dockerContainers = exports.dockerContainerProcesses = exports.dockerAll = exports.fullLoad = exports.cpuCurrentSpeed = exports.currentLoad = void 0;
|
|
4
|
+
exports.wifiNetworks = exports.wifiInterfaces = exports.wifiConnections = exports.uuid = exports.users = exports.usb = exports.thunderbolt = exports.system = exports.software = exports.shell = exports.services = exports.processes = exports.processLoad = void 0;
|
|
5
5
|
var cpu_current_load_1 = require("../cpu-current-load");
|
|
6
6
|
Object.defineProperty(exports, "currentLoad", { enumerable: true, get: function () { return cpu_current_load_1.currentLoad; } });
|
|
7
7
|
var cpu_current_speed_1 = require("../cpu-current-speed");
|
|
@@ -50,6 +50,8 @@ var cpu_flags_1 = require("./cpu-flags");
|
|
|
50
50
|
Object.defineProperty(exports, "cpuFlags", { enumerable: true, get: function () { return cpu_flags_1.cpuFlags; } });
|
|
51
51
|
var cpu_temperature_1 = require("./cpu-temperature");
|
|
52
52
|
Object.defineProperty(exports, "cpuTemperature", { enumerable: true, get: function () { return cpu_temperature_1.cpuTemperature; } });
|
|
53
|
+
var fans_1 = require("./fans");
|
|
54
|
+
Object.defineProperty(exports, "fans", { enumerable: true, get: function () { return fans_1.fans; } });
|
|
53
55
|
var disk_layout_1 = require("./disk-layout");
|
|
54
56
|
Object.defineProperty(exports, "diskLayout", { enumerable: true, get: function () { return disk_layout_1.diskLayout; } });
|
|
55
57
|
var disks_io_1 = require("./disks-io");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "systeminformation",
|
|
3
|
-
"version": "6.0.0-beta.
|
|
3
|
+
"version": "6.0.0-beta.6",
|
|
4
4
|
"description": "Advanced, lightweight system and OS information library",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Sebastian Hildebrandt <hildebrandt@plus-innovations.com> (https://plus-innovations.com)",
|