Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

systeminformation

Package Overview
Dependencies
Maintainers
1
Versions
694
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

systeminformation - npm Package Compare versions

Comparing version 3.26.2 to 3.27.0

1

CHANGELOG.md

@@ -101,2 +101,3 @@ # Changelog

| -------------- | -------------- | -------- |
| 3.27.0 | 2017-09-11 | added raw data to `currentLoad()`, fixed `networkInterfaces()` MAC problem node 8.x |
| 3.26.2 | 2017-09-01 | removed redundant code |

@@ -103,0 +104,0 @@ | 3.26.1 | 2017-08-23 | fixed `cpu().speed` windows / AMD, updated docs |

80

lib/cpu.js

@@ -39,5 +39,12 @@ 'use strict';

currentload_user: 0,
currentload_system: 0,
currentload_nice: 0,
currentload_system: 0,
currentload_irq: 0
currentload_idle: 0,
currentload_irq: 0,
raw_currentload: 0,
raw_currentload_user: 0,
raw_currentload_system: 0,
raw_currentload_nice: 0,
raw_currentload_idle: 0,
raw_currentload_irq: 0
};

@@ -568,4 +575,4 @@ let _cpus = [];

totalNice += cpu.nice;
totalIdle += cpu.idle;
totalIrq += cpu.irq;
totalIdle += cpu.idle;
let tmp_tick = (_cpus && _cpus[i] && _cpus[i].totalTick ? _cpus[i].totalTick : 0);

@@ -576,2 +583,3 @@ let tmp_load = (_cpus && _cpus[i] && _cpus[i].totalLoad ? _cpus[i].totalLoad : 0);

let tmp_nice = (_cpus && _cpus[i] && _cpus[i].nice ? _cpus[i].nice : 0);
let tmp_idle = (_cpus && _cpus[i] && _cpus[i].idle ? _cpus[i].idle : 0);
let tmp_irq = (_cpus && _cpus[i] && _cpus[i].irq ? _cpus[i].irq : 0);

@@ -582,13 +590,21 @@ _cpus[i] = cpu;

_cpus[i].currentTick = _cpus[i].totalTick - tmp_tick;
_cpus[i].load = (_cpus[i].totalLoad - tmp_load) / _cpus[i].currentTick * 100;
_cpus[i].load_user = (_cpus[i].user - tmp_user) / _cpus[i].currentTick * 100;
_cpus[i].load_system = (_cpus[i].sys - tmp_system) / _cpus[i].currentTick * 100;
_cpus[i].load_nice = (_cpus[i].nice - tmp_nice) / _cpus[i].currentTick * 100;
_cpus[i].load_irq = (_cpus[i].irq - tmp_irq) / _cpus[i].currentTick * 100;
_cpus[i].load = (_cpus[i].totalLoad - tmp_load);
_cpus[i].load_user = (_cpus[i].user - tmp_user);
_cpus[i].load_system = (_cpus[i].sys - tmp_system);
_cpus[i].load_nice = (_cpus[i].nice - tmp_nice);
_cpus[i].load_idle = (_cpus[i].idle - tmp_idle);
_cpus[i].load_irq = (_cpus[i].irq - tmp_irq);
cores[i] = {};
cores[i].load = _cpus[i].load;
cores[i].load_user = _cpus[i].load_user;
cores[i].load_system = _cpus[i].load_system;
cores[i].load_nice = _cpus[i].load_nice;
cores[i].load_irq = _cpus[i].load_irq;
cores[i].load = _cpus[i].load / _cpus[i].currentTick * 100;
cores[i].load_user = _cpus[i].load_user / _cpus[i].currentTick * 100;
cores[i].load_system = _cpus[i].load_system / _cpus[i].currentTick * 100;
cores[i].load_nice = _cpus[i].load_nice / _cpus[i].currentTick * 100;
cores[i].load_idle = _cpus[i].load_idle / _cpus[i].currentTick * 100;
cores[i].load_irq = _cpus[i].load_irq / _cpus[i].currentTick * 100;
cores[i].raw_load = _cpus[i].load;
cores[i].raw_load_user = _cpus[i].load_user;
cores[i].raw_load_system = _cpus[i].load_system;
cores[i].raw_load_nice = _cpus[i].load_nice;
cores[i].raw_load_idle = _cpus[i].load_idle;
cores[i].raw_load_irq = _cpus[i].load_irq;
}

@@ -604,3 +620,10 @@ let totalTick = totalUser + totalSystem + totalNice + totalIrq + totalIdle;

currentload_nice: (totalNice - _current_cpu.nice) / currentTick * 100,
currentload_idle: (totalIdle - _current_cpu.idle) / currentTick * 100,
currentload_irq: (totalIrq - _current_cpu.irq) / currentTick * 100,
raw_currentload: (totalLoad - _current_cpu.load),
raw_currentload_user: (totalUser - _current_cpu.user),
raw_currentload_system: (totalSystem - _current_cpu.system),
raw_currentload_nice: (totalNice - _current_cpu.nice),
raw_currentload_idle: (totalIdle - _current_cpu.idle),
raw_currentload_irq: (totalIrq - _current_cpu.irq),
cpus: cores

@@ -621,3 +644,10 @@ };

currentload_nice: result.currentload_nice,
currentload_idle: result.currentload_idle,
currentload_irq: result.currentload_irq,
raw_currentload: result.raw_currentload,
raw_currentload_user: result.raw_currentload_user,
raw_currentload_system: result.raw_currentload_system,
raw_currentload_nice: result.raw_currentload_nice,
raw_currentload_idle: result.raw_currentload_idle,
raw_currentload_irq: result.raw_currentload_irq,
};

@@ -628,7 +658,14 @@ } else {

cores[i] = {};
cores[i].load = _cpus[i].load;
cores[i].load_user = _cpus[i].load_user;
cores[i].load_system = _cpus[i].load_system;
cores[i].load_nice = _cpus[i].load_nice;
cores[i].load_irq = _cpus[i].load_irq;
cores[i].load = _cpus[i].load / _cpus[i].currentTick * 100;
cores[i].load_user = _cpus[i].load_user / _cpus[i].currentTick * 100;
cores[i].load_system = _cpus[i].load_system / _cpus[i].currentTick * 100;
cores[i].load_nice = _cpus[i].load_nice / _cpus[i].currentTick * 100;
cores[i].load_idle = _cpus[i].load_idle / _cpus[i].currentTick * 100;
cores[i].load_irq = _cpus[i].load_irq / _cpus[i].currentTick * 100;
cores[i].raw_load = _cpus[i].load;
cores[i].raw_load_user = _cpus[i].load_user;
cores[i].raw_load_system = _cpus[i].load_system;
cores[i].raw_load_nice = _cpus[i].load_nice;
cores[i].raw_load_idle = _cpus[i].load_idle;
cores[i].raw_load_irq = _cpus[i].load_irq;
}

@@ -641,3 +678,10 @@ result = {

currentload_nice: _current_cpu.currentload_nice,
currentload_idle: _current_cpu.currentload_idle,
currentload_irq: _current_cpu.currentload_irq,
raw_currentload: _current_cpu.raw_currentload,
raw_currentload_user: _current_cpu.raw_currentload_user,
raw_currentload_system: _current_cpu.raw_currentload_system,
raw_currentload_nice: _current_cpu.raw_currentload_nice,
raw_currentload_idle: _current_cpu.raw_currentload_idle,
raw_currentload_irq: _current_cpu.raw_currentload_irq,
cpus: cores

@@ -644,0 +688,0 @@ };

@@ -175,2 +175,3 @@ 'use strict';

lines.filter(line => line !== '').forEach((line) => {
// line = line.replace(/\\/g,'\\\\');
let disk = JSON.parse(line);

@@ -177,0 +178,0 @@ data.push({

@@ -94,3 +94,3 @@ 'use strict';

const cpu = require('./cpu');
const mem = require('./memory');
const memory = require('./memory');
const battery = require('./battery');

@@ -142,3 +142,3 @@ const graphics = require('./graphics');

network.networkInterfaces(),
mem.memLayout(),
memory.memLayout(),
filesystem.diskLayout()

@@ -260,3 +260,3 @@ ]).then(res => {

mem.mem().then(res => {
memory.mem().then(res => {
data.mem = res;

@@ -354,4 +354,4 @@ functionProcessed();

exports.mem = mem.mem;
exports.memLayout = mem.memLayout;
exports.mem = memory.mem;
exports.memLayout = memory.memLayout;

@@ -358,0 +358,0 @@ exports.battery = battery;

@@ -30,2 +30,3 @@ 'use strict';

let _default_iface;
let _mac = {};

@@ -87,2 +88,43 @@ function getValue(lines, property, separator) {

function getMacAddresses() {
let iface = '';
let mac = '';
let result = {};
if (_linux) {
const cmd = 'export LC_ALL=C; /sbin/ifconfig; unset LC_ALL';
let res = execSync(cmd);
const lines = res.toString().split('\n');
for (let i = 0; i < lines.length; i++) {
if (lines[i] && lines[i][0] !== ' ') {
iface = lines[i].split(' ')[0];
mac = lines[i].split('HWaddr ')[1];
if (iface && mac) {
result[iface] = mac.trim();
iface = '';
mac = '';
}
}
}
}
if (_darwin) {
const cmd = '/sbin/ifconfig';
let res = execSync(cmd);
const lines = res.toString().split('\n');
for (let i = 0; i < lines.length; i++) {
if (lines[i] && lines[i][0] !== '\t' && lines[i].indexOf(':') > 0) {
iface = lines[i].split(':')[0];
} else if (lines[i].indexOf('\tether ') === 0) {
mac = lines[i].split('\tether ')[1];
if (iface && mac) {
result[iface] = mac.trim();
iface = '';
mac = '';
}
}
}
}
return result
}
function networkInterfaceDefault(callback) {

@@ -123,3 +165,9 @@

}
mac = details.mac
mac = details.mac;
if (mac.indexOf('00:00:0') > -1 && (_linux || _darwin)) {
if (Object.keys(_mac).length === 0) {
_mac = getMacAddresses();
}
mac = _mac[dev] || '';
}
});

@@ -126,0 +174,0 @@ let internal = (ifaces[dev] && ifaces[dev][0]) ? ifaces[dev][0].internal : null;

{
"name": "systeminformation",
"version": "3.26.2",
"version": "3.27.0",
"description": "Simple system and OS information library",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -32,3 +32,3 @@ # systeminformation

console.log(data);
})
});

@@ -45,3 +45,3 @@ // promises style - new in version 3

console.log(data)
} catch {
} catch (e) {
console.log(e)

@@ -55,2 +55,3 @@ }

### Latest Activity
- Version 3.27.0: added raw data to `currentLoad()`, fixed `networkInterfaces()` MAC problem node 8.x
- Version 3.26.0: improved windows support `getDynamicData()`, updated docs

@@ -323,11 +324,13 @@ - Version 3.25.0: improved windows support `networkStats()`, `cpuCache()`, bug fix `getStaticData()`

| --------------- | ----- | ----- | ---- | ------- | -------- |
| si.currentLoad(cb) | {...} | X | X | | CPU-Load |
| | avgload | X | X | | average load |
| | currentload | X | X | | CPU-Load in % |
| | currentload_user | X | X | | CPU-Load User in % |
| | currentload_nice | X | X | | CPU-Load Nice in % |
| | currentload_system | X | X | | CPU-Load System in % |
| | currentload_irq | X | X | | CPU-Load System in % |
| | cpus[] | X | X | | current loads per CPU in % |
| si.fullLoad(cb) | : integer | X | X | | CPU-full load since bootup in % |
| si.currentLoad(cb) | {...} | X | X | X | CPU-Load |
| | avgload | X | X | X | average load |
| | currentload | X | X | X | CPU-Load in % |
| | currentload_user | X | X | X | CPU-Load User in % |
| | currentload_system | X | X | X | CPU-Load System in % |
| | currentload_nice | X | X | X | CPU-Load Nice in % |
| | currentload_idle | X | X | X | CPU-Load Idle in % |
| | currentload_irq | X | X | X | CPU-Load System in % |
| | raw_currentload... | X | X | X | CPU-Load raw values (ticks) |
| | cpus[] | X | X | X | current loads per CPU in % + raw ticks |
| si.fullLoad(cb) | : integer | X | X | X | CPU-full load since bootup in % |
| si.processes(cb) | {...} | X | X | | # running processes |

@@ -470,3 +473,3 @@ | | all | X | X | | # of all processes |

try {
const data = await si.networkStats('eth1')
const data = await si.networkStats('eth1');
console.log(`Network Interface Stats (eth1):

@@ -473,0 +476,0 @@ - is up: ${data.operstate}

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc