systeminformation
Advanced tools
Comparing version 3.17.0 to 3.17.1
@@ -97,2 +97,3 @@ # Changelog | ||
| -------------- | -------------- | -------- | | ||
| 3.17.1 | 2017-04-23 | fixed bugs fsSize(win), si.processes (command), si.osinfo(win) | | ||
| 3.17.0 | 2017-02-19 | windows support for some first functions, extended process list (linux)| | ||
@@ -99,0 +100,0 @@ | 3.16.0 | 2017-01-19 | blockDevices: added removable attribute + fix | |
@@ -22,5 +22,5 @@ 'use strict'; | ||
const _linux = (_platform == 'Linux'); | ||
const _darwin = (_platform == 'Darwin'); | ||
const _windows = (_platform == 'Windows_NT'); | ||
const _linux = (_platform === 'Linux'); | ||
const _darwin = (_platform === 'Darwin'); | ||
const _windows = (_platform === 'Windows_NT'); | ||
const NOT_SUPPORTED = 'not supported'; | ||
@@ -58,3 +58,3 @@ | ||
let lines = stdout.toString().split('\n'); | ||
if (lines.length > 0 && lines[0]) result.ischarging = (lines[0].trim().toLowerCase() == 'charging') | ||
if (lines.length > 0 && lines[0]) result.ischarging = (lines[0].trim().toLowerCase() === 'charging') | ||
} | ||
@@ -96,7 +96,7 @@ exec("cat " + battery_path + "cyclec_ount", function (error, stdout) { | ||
lines.forEach(function (line) { | ||
if (line.indexOf('=') != -1) { | ||
if (line.toLowerCase().indexOf('cyclecount') != -1) result.cyclecount = parseFloat(line.split('=')[1].trim()); | ||
if (line.toLowerCase().indexOf('ischarging') != -1) result.ischarging = (line.split('=')[1].trim().toLowerCase() == 'yes'); | ||
if (line.toLowerCase().indexOf('maxcapacity') != -1) result.maxcapacity = parseFloat(line.split('=')[1].trim()); | ||
if (line.toLowerCase().indexOf('currentcapacity') != -1) result.currentcapacity = parseFloat(line.split('=')[1].trim()); | ||
if (line.indexOf('=') !== -1) { | ||
if (line.toLowerCase().indexOf('cyclecount') !== -1) result.cyclecount = parseFloat(line.split('=')[1].trim()); | ||
if (line.toLowerCase().indexOf('ischarging') !== -1) result.ischarging = (line.split('=')[1].trim().toLowerCase() === 'yes'); | ||
if (line.toLowerCase().indexOf('maxcapacity') !== -1) result.maxcapacity = parseFloat(line.split('=')[1].trim()); | ||
if (line.toLowerCase().indexOf('currentcapacity') !== -1) result.currentcapacity = parseFloat(line.split('=')[1].trim()); | ||
} | ||
@@ -103,0 +103,0 @@ }); |
@@ -22,5 +22,5 @@ 'use strict'; | ||
const _linux = (_platform == 'Linux'); | ||
const _darwin = (_platform == 'Darwin'); | ||
const _windows = (_platform == 'Windows_NT'); | ||
const _linux = (_platform === 'Linux'); | ||
const _darwin = (_platform === 'Darwin'); | ||
const _windows = (_platform === 'Windows_NT'); | ||
const NOT_SUPPORTED = 'not supported'; | ||
@@ -93,5 +93,5 @@ | ||
result.speed = line.split('@')[1] ? parseFloat(line.split('@')[1].trim()).toFixed(2) : '0.00'; | ||
if (result.speed == '0.00') { | ||
if (result.speed === '0.00') { | ||
let current = getCpuCurrentSpeedSync(); | ||
if (current != '0.00') result.speed = current; | ||
if (current !== '0.00') result.speed = current; | ||
} | ||
@@ -107,3 +107,3 @@ _cpu_speed = result.speed; | ||
if (!error) { | ||
let lines = stdout.split('\r\n').filter(line => line.trim() != '').filter((line, idx) => idx > 0); | ||
let lines = stdout.split('\r\n').filter(line => line.trim() !== '').filter((line, idx) => idx > 0); | ||
let line = (lines && lines[0]) ? lines[0] : ''; | ||
@@ -178,3 +178,3 @@ result.brand = line.split('@')[0].trim(); | ||
let result = getCpuCurrentSpeedSync(); | ||
if (result == 0 && _cpu_speed != '0.00') result = parseFloat(_cpu_speed); | ||
if (result === 0 && _cpu_speed !== '0.00') result = parseFloat(_cpu_speed); | ||
@@ -209,6 +209,6 @@ if (callback) { callback(result) } | ||
let temps = line.match(regex); | ||
if (line.split(':')[0].toUpperCase().indexOf('PHYSICAL') != -1) { | ||
if (line.split(':')[0].toUpperCase().indexOf('PHYSICAL') !== -1) { | ||
result.main = parseFloat(temps); | ||
} | ||
if (line.split(':')[0].toUpperCase().indexOf('CORE ') != -1) { | ||
if (line.split(':')[0].toUpperCase().indexOf('CORE ') !== -1) { | ||
result.cores.push(parseFloat(temps)); | ||
@@ -225,3 +225,3 @@ } | ||
fs.stat('/sys/class/thermal/thermal_zone0/temp', function(err, stat) { | ||
if(err == null) { | ||
if(err === null) { | ||
exec("cat /sys/class/thermal/thermal_zone0/temp", function (error, stdout) { | ||
@@ -264,3 +264,3 @@ if (!error) { | ||
let value = smc.get(key); | ||
if (id == 0) { | ||
if (id === 0) { | ||
if (value > 0) { | ||
@@ -333,3 +333,3 @@ result.main = value; | ||
lines.forEach(function (line) { | ||
if (line.split(':')[0].toUpperCase().indexOf('FLAGS') != -1) { | ||
if (line.split(':')[0].toUpperCase().indexOf('FLAGS') !== -1) { | ||
result = line.split(':')[1].trim().toLowerCase(); | ||
@@ -347,3 +347,3 @@ } | ||
let lines = stdout.toString().split('\n'); | ||
if (lines.length > 0 && lines[0].indexOf('machdep.cpu.features:') != -1) { | ||
if (lines.length > 0 && lines[0].indexOf('machdep.cpu.features:') !== -1) { | ||
result = lines[0].split(':')[1].trim().toLowerCase(); | ||
@@ -382,13 +382,13 @@ } | ||
let parts = line.split(':'); | ||
if (parts[0].toUpperCase().indexOf('L1D CACHE') != -1) { | ||
result.l1d = parseInt(parts[1].trim()) * (parts[1].indexOf('K') != -1 ? 1024 : 1); | ||
if (parts[0].toUpperCase().indexOf('L1D CACHE') !== -1) { | ||
result.l1d = parseInt(parts[1].trim()) * (parts[1].indexOf('K') !== -1 ? 1024 : 1); | ||
} | ||
if (parts[0].toUpperCase().indexOf('L1I CACHE') != -1) { | ||
result.l1i = parseInt(parts[1].trim()) * (parts[1].indexOf('K') != -1 ? 1024 : 1); | ||
if (parts[0].toUpperCase().indexOf('L1I CACHE') !== -1) { | ||
result.l1i = parseInt(parts[1].trim()) * (parts[1].indexOf('K') !== -1 ? 1024 : 1); | ||
} | ||
if (parts[0].toUpperCase().indexOf('L2 CACHE') != -1) { | ||
result.l2 = parseInt(parts[1].trim()) * (parts[1].indexOf('K') != -1 ? 1024 : 1); | ||
if (parts[0].toUpperCase().indexOf('L2 CACHE') !== -1) { | ||
result.l2 = parseInt(parts[1].trim()) * (parts[1].indexOf('K') !== -1 ? 1024 : 1); | ||
} | ||
if (parts[0].toUpperCase().indexOf('L3 CACHE') != -1) { | ||
result.l3 = parseInt(parts[1].trim()) * (parts[1].indexOf('K') != -1 ? 1024 : 1); | ||
if (parts[0].toUpperCase().indexOf('L3 CACHE') !== -1) { | ||
result.l3 = parseInt(parts[1].trim()) * (parts[1].indexOf('K') !== -1 ? 1024 : 1); | ||
} | ||
@@ -407,13 +407,13 @@ }); | ||
let parts = line.split(':'); | ||
if (parts[0].toLowerCase().indexOf('hw.l1icachesize') != -1) { | ||
result.l1d = parseInt(parts[1].trim()) * (parts[1].indexOf('K') != -1 ? 1024 : 1); | ||
if (parts[0].toLowerCase().indexOf('hw.l1icachesize') !== -1) { | ||
result.l1d = parseInt(parts[1].trim()) * (parts[1].indexOf('K') !== -1 ? 1024 : 1); | ||
} | ||
if (parts[0].toLowerCase().indexOf('hw.l1dcachesize') != -1) { | ||
result.l1i = parseInt(parts[1].trim()) * (parts[1].indexOf('K') != -1 ? 1024 : 1); | ||
if (parts[0].toLowerCase().indexOf('hw.l1dcachesize') !== -1) { | ||
result.l1i = parseInt(parts[1].trim()) * (parts[1].indexOf('K') !== -1 ? 1024 : 1); | ||
} | ||
if (parts[0].toLowerCase().indexOf('hw.l2cachesize') != -1) { | ||
result.l2 = parseInt(parts[1].trim()) * (parts[1].indexOf('K') != -1 ? 1024 : 1); | ||
if (parts[0].toLowerCase().indexOf('hw.l2cachesize') !== -1) { | ||
result.l2 = parseInt(parts[1].trim()) * (parts[1].indexOf('K') !== -1 ? 1024 : 1); | ||
} | ||
if (parts[0].toLowerCase().indexOf('hw.l3cachesize') != -1) { | ||
result.l3 = parseInt(parts[1].trim()) * (parts[1].indexOf('K') != -1 ? 1024 : 1); | ||
if (parts[0].toLowerCase().indexOf('hw.l3cachesize') !== -1) { | ||
result.l3 = parseInt(parts[1].trim()) * (parts[1].indexOf('K') !== -1 ? 1024 : 1); | ||
} | ||
@@ -420,0 +420,0 @@ }); |
@@ -21,3 +21,3 @@ 'use strict'; | ||
const _windows = (_platform == 'Windows_NT'); | ||
const _windows = (_platform === 'Windows_NT'); | ||
const NOT_SUPPORTED = 'not supported'; | ||
@@ -196,6 +196,6 @@ | ||
if (element.op && element.op.toLowerCase() == 'read' && element.value) { | ||
if (element.op && element.op.toLowerCase() === 'read' && element.value) { | ||
result.r += element.value; | ||
} | ||
if (element.op && element.op.toLowerCase() == 'write' && element.value) { | ||
if (element.op && element.op.toLowerCase() === 'write' && element.value) { | ||
result.w += element.value; | ||
@@ -400,3 +400,3 @@ } | ||
l -= 1; | ||
if (l == 0) { | ||
if (l === 0) { | ||
if (callback) { callback(result) } | ||
@@ -403,0 +403,0 @@ resolve(result); |
@@ -22,5 +22,5 @@ 'use strict'; | ||
const _linux = (_platform == 'Linux'); | ||
const _darwin = (_platform == 'Darwin'); | ||
const _windows = (_platform == 'Windows_NT'); | ||
const _linux = (_platform === 'Linux'); | ||
const _darwin = (_platform === 'Darwin'); | ||
const _windows = (_platform === 'Windows_NT'); | ||
const NOT_SUPPORTED = 'not supported'; | ||
@@ -38,6 +38,6 @@ | ||
process.nextTick(() => { | ||
let data = []; | ||
if (_linux || _darwin) { | ||
let cmd = (_darwin ? "df -lkP | grep ^/" : "df -lkPT | grep ^/"); | ||
exec(cmd, function (error, stdout) { | ||
let data = []; | ||
if (!error) { | ||
@@ -47,3 +47,3 @@ let lines = stdout.toString().split('\n'); | ||
lines.forEach(function (line) { | ||
if (line != '') { | ||
if (line !== '') { | ||
line = line.replace(/ +/g, " ").split(' '); | ||
@@ -69,5 +69,5 @@ data.push({ | ||
exec('wmic logicaldisk get Caption,FileSystem,FreeSpace,Size', function (error, stdout) { | ||
let lines = stdout.split('\r\n').filter(line => line.trim() != '').filter((line, idx) => idx > 0); | ||
let lines = stdout.split('\r\n').filter(line => line.trim() !== '').filter((line, idx) => idx > 0); | ||
lines.forEach(function (line) { | ||
if (line != '') { | ||
if (line !== '') { | ||
line = line.trim().split(/\s\s+/); | ||
@@ -108,3 +108,3 @@ data.push({ | ||
if (line.length > 0) { | ||
if (line[0] == '*') { | ||
if (line[0] === '*') { | ||
i++; | ||
@@ -131,18 +131,18 @@ } else { | ||
parts[1] = parts[1].trim(); | ||
if ('DEVICEIDENTIFIER' == parts[0]) devices[i].identifier = parts[1]; | ||
if ('DEVICENODE' == parts[0]) devices[i].name = parts[1]; | ||
if ('VOLUMENAME' == parts[0]) { | ||
if (parts[1].indexOf('Not applicable') == -1) devices[i].label = parts[1]; | ||
if ('DEVICEIDENTIFIER' === parts[0]) devices[i].identifier = parts[1]; | ||
if ('DEVICENODE' === parts[0]) devices[i].name = parts[1]; | ||
if ('VOLUMENAME' === parts[0]) { | ||
if (parts[1].indexOf('Not applicable') === -1) devices[i].label = parts[1]; | ||
} | ||
if ('PROTOCOL' == parts[0]) devices[i].protocol = parts[1]; | ||
if ('DISKSIZE' == parts[0]) devices[i].size = parseBytes(parts[1]); | ||
if ('FILESYSTEMPERSONALITY' == parts[0]) devices[i].fstype = parts[1]; | ||
if ('MOUNTPOINT' == parts[0]) devices[i].mount = parts[1]; | ||
if ('VOLUMEUUID' == parts[0]) devices[i].uuid = parts[1]; | ||
if ('READ-ONLYMEDIA' == parts[0] && parts[1] == 'Yes') devices[i].physical = 'CD/DVD'; | ||
if ('SOLIDSTATE' == parts[0] && parts[1] == 'Yes') devices[i].physical = 'SSD'; | ||
if ('VIRTUAL' == parts[0]) devices[i].type = 'virtual'; | ||
if ('REMOVABLEMEDIA' == parts[0]) devices[i].removable = (parts[1] == 'Removable'); | ||
if ('PARTITIONTYPE' == parts[0]) devices[i].type = 'part'; | ||
if ('DEVICE/MEDIANAME' == parts[0]) devices[i].model = parts[1]; | ||
if ('PROTOCOL' === parts[0]) devices[i].protocol = parts[1]; | ||
if ('DISKSIZE' === parts[0]) devices[i].size = parseBytes(parts[1]); | ||
if ('FILESYSTEMPERSONALITY' === parts[0]) devices[i].fstype = parts[1]; | ||
if ('MOUNTPOINT' === parts[0]) devices[i].mount = parts[1]; | ||
if ('VOLUMEUUID' === parts[0]) devices[i].uuid = parts[1]; | ||
if ('READ-ONLYMEDIA' === parts[0] && parts[1] === 'Yes') devices[i].physical = 'CD/DVD'; | ||
if ('SOLIDSTATE' === parts[0] && parts[1] === 'Yes') devices[i].physical = 'SSD'; | ||
if ('VIRTUAL' === parts[0]) devices[i].type = 'virtual'; | ||
if ('REMOVABLEMEDIA' === parts[0]) devices[i].removable = (parts[1] === 'Removable'); | ||
if ('PARTITIONTYPE' === parts[0]) devices[i].type = 'part'; | ||
if ('DEVICE/MEDIANAME' === parts[0]) devices[i].model = parts[1]; | ||
} | ||
@@ -158,3 +158,3 @@ } | ||
lines.filter(line => line != '').forEach((line) => { | ||
lines.filter(line => line !== '').forEach((line) => { | ||
let disk = JSON.parse(line); | ||
@@ -167,3 +167,3 @@ data.push({ | ||
'size': parseInt(disk.size), | ||
'physical': (disk.type == 'disk' ? (disk.rota == '0' ? 'SSD' : 'HDD') : (disk.type == 'rom' ? 'CD/DVD' : '')), | ||
'physical': (disk.type === 'disk' ? (disk.rota === '0' ? 'SSD' : 'HDD') : (disk.type === 'rom' ? 'CD/DVD' : '')), | ||
'uuid': disk.uuid, | ||
@@ -173,3 +173,3 @@ 'label': disk.label, | ||
'serial': disk.serial, | ||
'removable': disk.rm == '1', | ||
'removable': disk.rm === '1', | ||
'protocol': disk.tran | ||
@@ -250,5 +250,5 @@ }) | ||
if (!error) { | ||
let lines = stdout.split('\r\n').filter(line => line.trim() != '').filter((line, idx) => idx > 0); | ||
let lines = stdout.split('\r\n').filter(line => line.trim() !== '').filter((line, idx) => idx > 0); | ||
lines.forEach(function (line) { | ||
if (line != '') { | ||
if (line !== '') { | ||
line = line.replace('\r', '').split(','); | ||
@@ -262,3 +262,3 @@ data.push({ | ||
size: line[8], | ||
physical: line[4] == '5' ? 'CD/DVD' : 'HDD', | ||
physical: line[4] === '5' ? 'CD/DVD' : 'HDD', | ||
uuid: line[10], | ||
@@ -268,3 +268,3 @@ label: line[9], | ||
serial: line[10], | ||
removable: line[4] == '2', | ||
removable: line[4] === '2', | ||
protocol: '' | ||
@@ -365,5 +365,5 @@ }); | ||
lines.forEach(function (line) { | ||
if (line != '') { | ||
if (line !== '') { | ||
line = line.replace(/[├─│└]+/g, "").trim().split(' '); | ||
if (fs_filter.indexOf(line[0]) == -1) fs_filter.push(line[0]) | ||
if (fs_filter.indexOf(line[0]) === -1) fs_filter.push(line[0]) | ||
} | ||
@@ -378,3 +378,3 @@ }); | ||
line = line.trim(); | ||
if (line != '') { | ||
if (line !== '') { | ||
line = line.replace(/ +/g, " ").split(' '); | ||
@@ -407,3 +407,3 @@ | ||
line = line.trim(); | ||
if (line != '') { | ||
if (line !== '') { | ||
line = line.split(' '); | ||
@@ -545,3 +545,3 @@ | ||
line = line.trim(); | ||
if (line != '') { | ||
if (line !== '') { | ||
line = line.split(' '); | ||
@@ -548,0 +548,0 @@ |
@@ -22,5 +22,5 @@ 'use strict'; | ||
const _linux = (_platform == 'Linux'); | ||
const _darwin = (_platform == 'Darwin'); | ||
const _windows = (_platform == 'Windows_NT'); | ||
const _linux = (_platform === 'Linux'); | ||
const _darwin = (_platform === 'Darwin'); | ||
const _windows = (_platform === 'Windows_NT'); | ||
const NOT_SUPPORTED = 'not supported'; | ||
@@ -39,5 +39,5 @@ | ||
for (let i = 0; i < lines.length; i++) { | ||
if ('' != lines[i].trim()) { | ||
if ('' !== lines[i].trim()) { | ||
let start = lines[i].search(/\S|$/); | ||
if (-1 == starts.indexOf(start)) { | ||
if (-1 === starts.indexOf(start)) { | ||
starts.push(start); | ||
@@ -58,11 +58,11 @@ } | ||
let parts = lines[i].split(':'); | ||
if (2 == level) { // grafics controller level | ||
if (parts.length > 1 && parts[0].replace(/ +/g, "").toLowerCase().indexOf('chipsetmodel') != -1) currentController.model = parts[1].trim(); | ||
if (parts.length > 1 && parts[0].replace(/ +/g, "").toLowerCase().indexOf('bus') != -1) currentController.bus = parts[1].trim(); | ||
if (parts.length > 1 && parts[0].replace(/ +/g, "").toLowerCase().indexOf('vendor') != -1) currentController.vendor = parts[1].split('(')[0].trim(); | ||
if (parts.length > 1 && parts[0].replace(/ +/g, "").toLowerCase().indexOf('vram(total)') != -1) { | ||
if (2 === level) { // grafics controller level | ||
if (parts.length > 1 && parts[0].replace(/ +/g, "").toLowerCase().indexOf('chipsetmodel') !== -1) currentController.model = parts[1].trim(); | ||
if (parts.length > 1 && parts[0].replace(/ +/g, "").toLowerCase().indexOf('bus') !== -1) currentController.bus = parts[1].trim(); | ||
if (parts.length > 1 && parts[0].replace(/ +/g, "").toLowerCase().indexOf('vendor') !== -1) currentController.vendor = parts[1].split('(')[0].trim(); | ||
if (parts.length > 1 && parts[0].replace(/ +/g, "").toLowerCase().indexOf('vram(total)') !== -1) { | ||
currentController.vram = parseInt(parts[1]); // in MB | ||
currentController.vramDynamic = false; | ||
} | ||
if (parts.length > 1 && parts[0].replace(/ +/g, "").toLowerCase().indexOf('vram(dynamic,max)') != -1) { | ||
if (parts.length > 1 && parts[0].replace(/ +/g, "").toLowerCase().indexOf('vram(dynamic,max)') !== -1) { | ||
currentController.vram = parseInt(parts[1]); // in MB | ||
@@ -72,4 +72,4 @@ currentController.vramDynamic = true; | ||
} | ||
if (3 == level) { // display controller level | ||
if (parts.length > 1 && '' == parts[1]) { | ||
if (3 === level) { // display controller level | ||
if (parts.length > 1 && '' === parts[1]) { | ||
currentDisplay.model = parts[0].trim(); | ||
@@ -83,4 +83,4 @@ currentDisplay.main = false; | ||
} | ||
if (4 == level) { // display controller details level | ||
if (parts.length > 1 && parts[0].replace(/ +/g, "").toLowerCase().indexOf('resolution') != -1) { | ||
if (4 === level) { // display controller details level | ||
if (parts.length > 1 && parts[0].replace(/ +/g, "").toLowerCase().indexOf('resolution') !== -1) { | ||
let resolution = parts[1].split('x'); | ||
@@ -90,9 +90,9 @@ currentDisplay.resolutionx = (resolution.length > 1 ? parseInt(resolution[0]) : 0); | ||
} | ||
if (parts.length > 1 && parts[0].replace(/ +/g, "").toLowerCase().indexOf('pixeldepth') != -1) currentDisplay.pixeldepth = parseInt(parts[1]); // in BIT | ||
if (parts.length > 1 && parts[0].replace(/ +/g, "").toLowerCase().indexOf('maindisplay') != -1 && parts[1].replace(/ +/g, "").toLowerCase() == 'yes') currentDisplay.main = true; | ||
if (parts.length > 1 && parts[0].replace(/ +/g, "").toLowerCase().indexOf('built-in') != -1 && parts[1].replace(/ +/g, "").toLowerCase() == 'yes') { | ||
if (parts.length > 1 && parts[0].replace(/ +/g, "").toLowerCase().indexOf('pixeldepth') !== -1) currentDisplay.pixeldepth = parseInt(parts[1]); // in BIT | ||
if (parts.length > 1 && parts[0].replace(/ +/g, "").toLowerCase().indexOf('maindisplay') !== -1 && parts[1].replace(/ +/g, "").toLowerCase() === 'yes') currentDisplay.main = true; | ||
if (parts.length > 1 && parts[0].replace(/ +/g, "").toLowerCase().indexOf('built-in') !== -1 && parts[1].replace(/ +/g, "").toLowerCase() === 'yes') { | ||
currentDisplay.builtin = true; | ||
currentDisplay.connection = ''; | ||
} | ||
if (parts.length > 1 && parts[0].replace(/ +/g, "").toLowerCase().indexOf('connectiontype') != -1) { | ||
if (parts.length > 1 && parts[0].replace(/ +/g, "").toLowerCase().indexOf('connectiontype') !== -1) { | ||
currentDisplay.builtin = false; | ||
@@ -121,6 +121,6 @@ currentDisplay.connection = parts[1].trim(); | ||
for (let i = 0; i < lines.length; i++) { | ||
if ('' != lines[i].trim()) { | ||
if (' ' != lines[i][0] && '\t' != lines[i][0]) { // first line of new entry | ||
if ('' !== lines[i].trim()) { | ||
if (' ' !== lines[i][0] && '\t' !== lines[i][0]) { // first line of new entry | ||
let vgapos = lines[i].toLowerCase().indexOf('vga'); | ||
if (vgapos != -1) { // VGA | ||
if (vgapos !== -1) { // VGA | ||
if (Object.keys(currentController).length > 0) {// already a controller found | ||
@@ -150,4 +150,4 @@ controllers.push(currentController); | ||
let parts = lines[i].split(':'); | ||
if (parts.length > 1 && parts[0].replace(/ +/g, "").toLowerCase().indexOf('devicename') != -1 && parts[0].toLowerCase().indexOf('onboard') != -1) currentController.bus = 'Onboard'; | ||
if (parts.length > 1 && parts[0].replace(/ +/g, "").toLowerCase().indexOf('region') != -1 && parts[1].toLowerCase().indexOf('memory') != -1) { | ||
if (parts.length > 1 && parts[0].replace(/ +/g, "").toLowerCase().indexOf('devicename') !== -1 && parts[0].toLowerCase().indexOf('onboard') !== -1) currentController.bus = 'Onboard'; | ||
if (parts.length > 1 && parts[0].replace(/ +/g, "").toLowerCase().indexOf('region') !== -1 && parts[1].toLowerCase().indexOf('memory') !== -1) { | ||
let memparts = parts[1].split("="); | ||
@@ -179,12 +179,12 @@ if (memparts.length > 1) { | ||
let start = 108; | ||
if (edid.substr(start, 6) == '000000') { | ||
if (edid.substr(start, 6) === '000000') { | ||
start += 36; | ||
} | ||
if (edid.substr(start, 6) == '000000') { | ||
if (edid.substr(start, 6) === '000000') { | ||
start += 36; | ||
} | ||
if (edid.substr(start, 6) == '000000') { | ||
if (edid.substr(start, 6) === '000000') { | ||
start += 36; | ||
} | ||
if (edid.substr(start, 6) == '000000') { | ||
if (edid.substr(start, 6) === '000000') { | ||
start += 36; | ||
@@ -200,3 +200,3 @@ } | ||
let model_raw = edid.substr(start + 10, 26); | ||
if (model_raw.indexOf('0a') != -1) { | ||
if (model_raw.indexOf('0a') !== -1) { | ||
model_raw = model_raw.substr(0, model_raw.indexOf('0a')) | ||
@@ -220,4 +220,4 @@ } | ||
for (let i = 1; i < lines.length; i++) { // start with second line | ||
if ('' != lines[i].trim()) { | ||
if (' ' != lines[i][0] && '\t' != lines[i][0] && lines[i].toLowerCase().indexOf(' connected ') != -1) { // first line of new entry | ||
if ('' !== lines[i].trim()) { | ||
if (' ' !== lines[i][0] && '\t' !== lines[i][0] && lines[i].toLowerCase().indexOf(' connected ') !== -1) { // first line of new entry | ||
if (Object.keys(currentDisplay).length > 0) { // push last display to array | ||
@@ -229,3 +229,3 @@ displays.push(currentDisplay); | ||
currentDisplay.connection = parts[0]; | ||
currentDisplay.main = (parts[2] == 'primary'); | ||
currentDisplay.main = (parts[2] === 'primary'); | ||
currentDisplay.builtin = (parts[0].toLowerCase().indexOf('edp') >= 0) | ||
@@ -250,3 +250,3 @@ } | ||
} | ||
if (lines[i].toLowerCase().indexOf('edid:') != -1) { | ||
if (lines[i].toLowerCase().indexOf('edid:') !== -1) { | ||
is_edid = true; | ||
@@ -253,0 +253,0 @@ start = lines[i].search(/\S|$/); |
@@ -85,2 +85,3 @@ 'use strict'; | ||
// version date comment | ||
// 3.17.1 2017-04-23 fixed bugs fsSize(win), si.processes (command), si.osinfo(win) | ||
// 3.17.0 2017-02-19 windows support for some first functions | ||
@@ -162,3 +163,3 @@ // 3.16.0 2017-01-19 blockDevices: added removable attribute + fix | ||
let _platform = os.type(); | ||
let _windows = (_platform == 'Windows_NT'); | ||
let _windows = (_platform === 'Windows_NT'); | ||
@@ -165,0 +166,0 @@ const NOT_SUPPORTED = 'not supported'; |
@@ -21,5 +21,5 @@ 'use strict'; | ||
const _linux = (_platform == 'Linux'); | ||
const _darwin = (_platform == 'Darwin'); | ||
const _windows = (_platform == 'Windows_NT'); | ||
const _linux = (_platform === 'Linux'); | ||
const _darwin = (_platform === 'Darwin'); | ||
const _windows = (_platform === 'Windows_NT'); | ||
const NOT_SUPPORTED = 'not supported'; | ||
@@ -53,3 +53,3 @@ | ||
result.status = statusCode || 404; | ||
result.ok = !error && (statusCode == 200 || statusCode == 301 || statusCode == 302 || statusCode == 304); | ||
result.ok = !error && (statusCode === 200 || statusCode === 301 || statusCode === 302 || statusCode === 304); | ||
result.ms = (result.ok ? Date.now() - t : -1); | ||
@@ -56,0 +56,0 @@ if (callback) { callback(result) } |
@@ -22,5 +22,5 @@ 'use strict'; | ||
const _linux = (_platform == 'Linux'); | ||
const _darwin = (_platform == 'Darwin'); | ||
const _windows = (_platform == 'Windows_NT'); | ||
const _linux = (_platform === 'Linux'); | ||
const _darwin = (_platform === 'Darwin'); | ||
const _windows = (_platform === 'Windows_NT'); | ||
const NOT_SUPPORTED = 'not supported'; | ||
@@ -142,5 +142,5 @@ | ||
for (let i = 0; i < line.length; i++) { | ||
if (line[i].toLowerCase().indexOf('total') != -1) result.swaptotal = parseFloat(line[i].split('=')[1].trim()) * 1024 * 1024; | ||
if (line[i].toLowerCase().indexOf('used') != -1) result.swapused = parseFloat(line[i].split('=')[1].trim()) * 1024 * 1024; | ||
if (line[i].toLowerCase().indexOf('free') != -1) result.swapfree = parseFloat(line[i].split('=')[1].trim()) * 1024 * 1024; | ||
if (line[i].toLowerCase().indexOf('total') !== -1) result.swaptotal = parseFloat(line[i].split('=')[1].trim()) * 1024 * 1024; | ||
if (line[i].toLowerCase().indexOf('used') !== -1) result.swapused = parseFloat(line[i].split('=')[1].trim()) * 1024 * 1024; | ||
if (line[i].toLowerCase().indexOf('free') !== -1) result.swapfree = parseFloat(line[i].split('=')[1].trim()) * 1024 * 1024; | ||
@@ -147,0 +147,0 @@ } |
@@ -23,5 +23,5 @@ 'use strict'; | ||
const _linux = (_platform == 'Linux'); | ||
const _darwin = (_platform == 'Darwin'); | ||
const _windows = (_platform == 'Windows_NT'); | ||
const _linux = (_platform === 'Linux'); | ||
const _darwin = (_platform === 'Darwin'); | ||
const _windows = (_platform === 'Windows_NT'); | ||
const NOT_SUPPORTED = 'not supported'; | ||
@@ -48,3 +48,3 @@ | ||
ifaces[dev].forEach(function (details) { | ||
if (details && details.internal == false) { | ||
if (details && details.internal === false) { | ||
ifacename = ifacename || dev; | ||
@@ -98,6 +98,6 @@ } | ||
ifaces[dev].forEach(function (details) { | ||
if (details.family == 'IPv4') { | ||
if (details.family === 'IPv4') { | ||
ip4 = details.address | ||
} | ||
if (details.family == 'IPv6') { | ||
if (details.family === 'IPv6') { | ||
ip6 = details.address | ||
@@ -223,3 +223,3 @@ } | ||
result.operstate = (result.operstate || '').toLowerCase(); | ||
result.operstate = (result.operstate == 'active' ? 'up' : (result.operstate == 'inactive' ? 'down' : 'unknown')); | ||
result.operstate = (result.operstate === 'active' ? 'up' : (result.operstate === 'inactive' ? 'down' : 'unknown')); | ||
cmd = "netstat -bI " + iface; | ||
@@ -230,3 +230,3 @@ exec(cmd, function (error, stdout) { | ||
// if there is less than 2 lines, no information for this interface was found | ||
if (lines.length > 1 && lines[1].trim() != '') { | ||
if (lines.length > 1 && lines[1].trim() !== '') { | ||
// skip header line | ||
@@ -300,3 +300,3 @@ // use the second line because it is tied to the NIC instead of the ipv4 or ipv6 address | ||
let connstate = line[5]; | ||
if (connstate == 'VERBUNDEN') connstate = 'ESTABLISHED'; | ||
if (connstate === 'VERBUNDEN') connstate = 'ESTABLISHED'; | ||
if (connstate) { | ||
@@ -344,4 +344,4 @@ result.push({ | ||
let connstate = line[1]; | ||
if (connstate == 'ESTAB') connstate = 'ESTABLISHED'; | ||
if (connstate == 'TIME-WAIT') connstate = 'TIME_WAIT'; | ||
if (connstate === 'ESTAB') connstate = 'ESTABLISHED'; | ||
if (connstate === 'TIME-WAIT') connstate = 'TIME_WAIT'; | ||
if (connstate) { | ||
@@ -348,0 +348,0 @@ result.push({ |
@@ -22,5 +22,5 @@ 'use strict'; | ||
const _linux = (_platform == 'Linux'); | ||
const _darwin = (_platform == 'Darwin'); | ||
const _windows = (_platform == 'Windows_NT'); | ||
const _linux = (_platform === 'Linux'); | ||
const _darwin = (_platform === 'Darwin'); | ||
const _windows = (_platform === 'Windows_NT'); | ||
const NOT_SUPPORTED = 'not supported'; | ||
@@ -44,2 +44,3 @@ | ||
function getLogoFile(distro) { | ||
distro = distro || ''; | ||
distro = distro.toLowerCase(); | ||
@@ -50,81 +51,81 @@ let result = 'linux'; | ||
} | ||
else if (distro.indexOf('mac os') != -1) { | ||
else if (distro.indexOf('mac os') !== -1) { | ||
result = 'apple' | ||
} | ||
else if (distro.indexOf('arch') != -1) { | ||
else if (distro.indexOf('arch') !== -1) { | ||
result = 'arch' | ||
} | ||
else if (distro.indexOf('centos') != -1) { | ||
else if (distro.indexOf('centos') !== -1) { | ||
result = 'centos' | ||
} | ||
else if (distro.indexOf('coreos') != -1) { | ||
else if (distro.indexOf('coreos') !== -1) { | ||
result = 'coreos' | ||
} | ||
else if (distro.indexOf('debian') != -1) { | ||
else if (distro.indexOf('debian') !== -1) { | ||
result = 'debian' | ||
} | ||
else if (distro.indexOf('elementary') != -1) { | ||
else if (distro.indexOf('elementary') !== -1) { | ||
result = 'elementary' | ||
} | ||
else if (distro.indexOf('fedora') != -1) { | ||
else if (distro.indexOf('fedora') !== -1) { | ||
result = 'fedora' | ||
} | ||
else if (distro.indexOf('gentoo') != -1) { | ||
else if (distro.indexOf('gentoo') !== -1) { | ||
result = 'gentoo' | ||
} | ||
else if (distro.indexOf('mageia') != -1) { | ||
else if (distro.indexOf('mageia') !== -1) { | ||
result = 'mageia' | ||
} | ||
else if (distro.indexOf('mandriva') != -1) { | ||
else if (distro.indexOf('mandriva') !== -1) { | ||
result = 'mandriva' | ||
} | ||
else if (distro.indexOf('manjaro') != -1) { | ||
else if (distro.indexOf('manjaro') !== -1) { | ||
result = 'manjaro' | ||
} | ||
else if (distro.indexOf('mint') != -1) { | ||
else if (distro.indexOf('mint') !== -1) { | ||
result = 'mint' | ||
} | ||
else if (distro.indexOf('openbsd') != -1) { | ||
else if (distro.indexOf('openbsd') !== -1) { | ||
result = 'openbsd' | ||
} | ||
else if (distro.indexOf('opensuse') != -1) { | ||
else if (distro.indexOf('opensuse') !== -1) { | ||
result = 'opensuse' | ||
} | ||
else if (distro.indexOf('pclinuxos') != -1) { | ||
else if (distro.indexOf('pclinuxos') !== -1) { | ||
result = 'pclinuxos' | ||
} | ||
else if (distro.indexOf('puppy') != -1) { | ||
else if (distro.indexOf('puppy') !== -1) { | ||
result = 'puppy' | ||
} | ||
else if (distro.indexOf('raspbian') != -1) { | ||
else if (distro.indexOf('raspbian') !== -1) { | ||
result = 'raspbian' | ||
} | ||
else if (distro.indexOf('reactos') != -1) { | ||
else if (distro.indexOf('reactos') !== -1) { | ||
result = 'reactos' | ||
} | ||
else if (distro.indexOf('redhat') != -1) { | ||
else if (distro.indexOf('redhat') !== -1) { | ||
result = 'redhat' | ||
} | ||
else if (distro.indexOf('slackware') != -1) { | ||
else if (distro.indexOf('slackware') !== -1) { | ||
result = 'slackware' | ||
} | ||
else if (distro.indexOf('sugar') != -1) { | ||
else if (distro.indexOf('sugar') !== -1) { | ||
result = 'sugar' | ||
} | ||
else if (distro.indexOf('steam') != -1) { | ||
else if (distro.indexOf('steam') !== -1) { | ||
result = 'steam' | ||
} | ||
else if (distro.indexOf('suse') != -1) { | ||
else if (distro.indexOf('suse') !== -1) { | ||
result = 'suse' | ||
} | ||
else if (distro.indexOf('mate') != -1) { | ||
else if (distro.indexOf('mate') !== -1) { | ||
result = 'ubuntu-mate' | ||
} | ||
else if (distro.indexOf('lubuntu') != -1) { | ||
else if (distro.indexOf('lubuntu') !== -1) { | ||
result = 'lubuntu' | ||
} | ||
else if (distro.indexOf('xubuntu') != -1) { | ||
else if (distro.indexOf('xubuntu') !== -1) { | ||
result = 'xubuntu' | ||
} | ||
else if (distro.indexOf('ubuntu') != -1) { | ||
else if (distro.indexOf('ubuntu') !== -1) { | ||
result = 'ubuntu' | ||
@@ -144,3 +145,3 @@ } | ||
platform: (_platform == 'Windows_NT' ? 'Windows' : _platform), | ||
platform: (_platform === 'Windows_NT' ? 'Windows' : _platform), | ||
distro: 'unknown', | ||
@@ -170,3 +171,3 @@ release: 'unknown', | ||
lines.forEach(function (line) { | ||
if (line.indexOf('=') != -1) { | ||
if (line.indexOf('=') !== -1) { | ||
release[line.split('=')[0].trim().toUpperCase()] = line.split('=')[1].trim(); | ||
@@ -190,7 +191,7 @@ } | ||
lines.forEach(function (line) { | ||
if (line.indexOf('ProductName') != -1) { | ||
if (line.indexOf('ProductName') !== -1) { | ||
result.distro = line.split(':')[1].trim(); | ||
result.logofile = getLogoFile(result.distro); | ||
} | ||
if (line.indexOf('ProductVersion') != -1) result.release = line.split(':')[1].trim(); | ||
if (line.indexOf('ProductVersion') !== -1) result.release = line.split(':')[1].trim(); | ||
}); | ||
@@ -197,0 +198,0 @@ if (callback) { |
@@ -22,5 +22,5 @@ 'use strict'; | ||
const _linux = (_platform == 'Linux'); | ||
const _darwin = (_platform == 'Darwin'); | ||
const _windows = (_platform == 'Windows_NT'); | ||
const _linux = (_platform === 'Linux'); | ||
const _darwin = (_platform === 'Darwin'); | ||
const _windows = (_platform === 'Windows_NT'); | ||
const NOT_SUPPORTED = 'not supported'; | ||
@@ -60,3 +60,3 @@ | ||
let data = []; | ||
if (srv != '' && srvs.length > 0) { | ||
if (srv !== '' && srvs.length > 0) { | ||
exec(comm + " | grep -v grep | egrep '" + srv + "'", function (error, stdout) { | ||
@@ -67,3 +67,3 @@ if (!error) { | ||
let ps = lines.filter(function (e) { | ||
return e.indexOf(srv) != -1 | ||
return e.indexOf(srv) !== -1 | ||
}); | ||
@@ -121,3 +121,3 @@ data.push({ | ||
if (count <= rights) { | ||
if (head[i] == ' ' && !space) { | ||
if (head[i] === ' ' && !space) { | ||
to = i - 1; | ||
@@ -132,5 +132,5 @@ result.push({ | ||
} | ||
space = head[i] == ' '; | ||
space = head[i] === ' '; | ||
} else { | ||
if (head[i] != ' ' && space) { | ||
if (head[i] !== ' ' && space) { | ||
to = i - 1; | ||
@@ -147,3 +147,3 @@ if (from < to) { | ||
} | ||
space = head[i] == ' '; | ||
space = head[i] === ' '; | ||
} | ||
@@ -162,17 +162,40 @@ } | ||
function parseLine(line) { | ||
let pid = parseInt(line.substring(parsedhead[0].from, parsedhead[0].to)); | ||
let pcpu = parseFloat(line.substring(parsedhead[1].from, parsedhead[1].to).replace(/,/g, ".")); | ||
let pmem = parseFloat(line.substring(parsedhead[2].from, parsedhead[2].to).replace(/,/g, ".")); | ||
let priority = parseInt(line.substring(parsedhead[3].from, parsedhead[3].to)); | ||
let vsz = parseInt(line.substring(parsedhead[4].from, parsedhead[4].to)); | ||
let rss = parseInt(line.substring(parsedhead[5].from, parsedhead[5].to)); | ||
let nice = parseInt(line.substring(parsedhead[6].from, parsedhead[6].to)); | ||
let started = line.substring(parsedhead[7].from, parsedhead[7].to).trim(); | ||
let state = line.substring(parsedhead[8].from, parsedhead[8].to).trim(); | ||
state = (state[0] == 'R' ? 'running' : (state[0] == 'S' ? 'sleeping' : (state[0] == 'T' ? 'stopped' : (state[0] == 'W' ? 'paging' : (state[0] == 'X' ? 'dead' : (state[0] == 'Z' ? 'zombie' : ((state[0] == 'D' || state[0] == 'U') ? 'blocked' : 'unknown'))))))); | ||
let tty = line.substring(parsedhead[9].from, parsedhead[9].to).trim(); | ||
if (tty == '?' || tty == '??') tty = ''; | ||
let user = line.substring(parsedhead[10].from, parsedhead[10].to).trim(); | ||
let command = line.substring(parsedhead[11].from, parsedhead[11].to).trim().replace(/\[/g, "").replace(/]/g, ""); | ||
let offset = 0; | ||
let offset2 = 0; | ||
function checkColumn(i) { | ||
offset = offset2; | ||
offset2 = line.substring(parsedhead[i].to + offset, 1000).indexOf(' ') | ||
// if (line.substring(parsedhead[i].to + offset, parsedhead[i].to + offset + 1) !== ' ') { | ||
// offset2++; | ||
// } | ||
} | ||
checkColumn(0) | ||
let pid = parseInt(line.substring(parsedhead[0].from + offset, parsedhead[0].to + offset2)); | ||
checkColumn(1) | ||
let pcpu = parseFloat(line.substring(parsedhead[1].from + offset, parsedhead[1].to + offset2).replace(/,/g, ".")); | ||
checkColumn(2) | ||
let pmem = parseFloat(line.substring(parsedhead[2].from + offset, parsedhead[2].to + offset2).replace(/,/g, ".")); | ||
checkColumn(3) | ||
let priority = parseInt(line.substring(parsedhead[3].from + offset, parsedhead[3].to + offset2)); | ||
checkColumn(4) | ||
let vsz = parseInt(line.substring(parsedhead[4].from + offset, parsedhead[4].to + offset2)); | ||
checkColumn(5) | ||
let rss = parseInt(line.substring(parsedhead[5].from + offset, parsedhead[5].to + offset2)); | ||
checkColumn(6) | ||
let nice = parseInt(line.substring(parsedhead[6].from + offset, parsedhead[6].to + offset2)); | ||
checkColumn(7) | ||
let started = line.substring(parsedhead[7].from + offset, parsedhead[7].to + offset2).trim(); | ||
checkColumn(8) | ||
let state = line.substring(parsedhead[8].from + offset, parsedhead[8].to + offset2).trim(); | ||
state = (state[0] === 'R' ? 'running' : (state[0] === 'S' ? 'sleeping' : (state[0] === 'T' ? 'stopped' : (state[0] === 'W' ? 'paging' : (state[0] === 'X' ? 'dead' : (state[0] === 'Z' ? 'zombie' : ((state[0] === 'D' || state[0] === 'U') ? 'blocked' : 'unknown'))))))); | ||
checkColumn(9) | ||
let tty = line.substring(parsedhead[9].from + offset, parsedhead[9].to + offset2).trim(); | ||
if (tty === '?' || tty === '??') tty = ''; | ||
checkColumn(10) | ||
let user = line.substring(parsedhead[10].from + offset, parsedhead[10].to + offset2).trim(); | ||
checkColumn(11) | ||
let command = line.substring(parsedhead[11].from + offset, parsedhead[11].to + offset2).trim().replace(/\[/g, "").replace(/]/g, ""); | ||
return ({ | ||
@@ -200,6 +223,7 @@ pid: pid, | ||
let head = lines[0]; | ||
parsedhead = parseHead(head, 7); | ||
parsedhead = parseHead(head, 8); | ||
console.log(parsedhead) | ||
lines.shift(); | ||
lines.forEach(function (line) { | ||
if (line.trim() != '') { | ||
if (line.trim() !== '') { | ||
result.push(parseLine(line)); | ||
@@ -298,3 +322,3 @@ } | ||
if ((_process_cpu.ms && Date.now() - _process_cpu.ms >= 500) || _process_cpu.ms == 0) { | ||
if ((_process_cpu.ms && Date.now() - _process_cpu.ms >= 500) || _process_cpu.ms === 0) { | ||
if (_linux) cmd = "ps axo pid:10,pcpu:6,pmem:6,pri:5,vsz:10,rss:10,ni:5,start:20,state:20,tty:20,user:20,command"; | ||
@@ -307,9 +331,9 @@ if (_darwin) cmd = "ps acxo pid,pcpu,pmem,pri,vsz,rss,nice,start,state,tty,user,command -r"; | ||
result.running = result.list.filter(function (e) { | ||
return e.state == 'running' | ||
return e.state === 'running' | ||
}).length; | ||
result.blocked = result.list.filter(function (e) { | ||
return e.state == 'blocked' | ||
return e.state === 'blocked' | ||
}).length; | ||
result.sleeping = result.list.filter(function (e) { | ||
return e.state == 'sleeping' | ||
return e.state === 'sleeping' | ||
}).length; | ||
@@ -316,0 +340,0 @@ |
@@ -22,5 +22,5 @@ 'use strict'; | ||
const _linux = (_platform == 'Linux'); | ||
const _darwin = (_platform == 'Darwin'); | ||
const _windows = (_platform == 'Windows_NT'); | ||
const _linux = (_platform === 'Linux'); | ||
const _darwin = (_platform === 'Darwin'); | ||
const _windows = (_platform === 'Windows_NT'); | ||
const NOT_SUPPORTED = 'not supported'; | ||
@@ -46,16 +46,16 @@ | ||
lines.forEach(function (line) { | ||
if (line.indexOf(':') != -1) { | ||
if (line.toLowerCase().indexOf('manufacturer') != -1) result.manufacturer = result.manufacturer || line.split(':')[1].trim(); | ||
if (line.toLowerCase().indexOf('product name') != -1) result.model = line.split(':')[1].trim(); | ||
if (line.toLowerCase().indexOf('version') != -1) result.version = result.version || line.split(':')[1].trim(); | ||
if (line.toLowerCase().indexOf('serial number') != -1) result.serial = line.split(':')[1].trim(); | ||
if (line.toLowerCase().indexOf('uuid') != -1) result.uuid = line.split(':')[1].trim(); | ||
if (line.indexOf(':') !== -1) { | ||
if (line.toLowerCase().indexOf('manufacturer') !== -1) result.manufacturer = result.manufacturer || line.split(':')[1].trim(); | ||
if (line.toLowerCase().indexOf('product name') !== -1) result.model = line.split(':')[1].trim(); | ||
if (line.toLowerCase().indexOf('version') !== -1) result.version = result.version || line.split(':')[1].trim(); | ||
if (line.toLowerCase().indexOf('serial number') !== -1) result.serial = line.split(':')[1].trim(); | ||
if (line.toLowerCase().indexOf('uuid') !== -1) result.uuid = line.split(':')[1].trim(); | ||
} | ||
}); | ||
if (result.serial.toLowerCase().indexOf('o.e.m.') != -1) result.serial = '-'; | ||
if (result.manufacturer.toLowerCase().indexOf('o.e.m.') != -1) result.manufacturer = ''; | ||
if (result.model.toLowerCase().indexOf('o.e.m.') != -1) result.model = 'Computer'; | ||
if (result.version.toLowerCase().indexOf('o.e.m.') != -1) result.version = '-'; | ||
if (result.serial.toLowerCase().indexOf('o.e.m.') !== -1) result.serial = '-'; | ||
if (result.manufacturer.toLowerCase().indexOf('o.e.m.') !== -1) result.manufacturer = ''; | ||
if (result.model.toLowerCase().indexOf('o.e.m.') !== -1) result.model = 'Computer'; | ||
if (result.version.toLowerCase().indexOf('o.e.m.') !== -1) result.version = '-'; | ||
if (result.manufacturer == '' && result.model == 'Computer' && result.version == '-') { | ||
if (result.manufacturer === '' && result.model === 'Computer' && result.version === '-') { | ||
// Check Raspberry Pi | ||
@@ -66,9 +66,9 @@ exec("grep Hardware /proc/cpuinfo; grep Serial /proc/cpuinfo; grep Revision /proc/cpuinfo", function (error, stdout) { | ||
lines.forEach(function (line) { | ||
if (line.indexOf(':') != -1) { | ||
if (line.toLowerCase().indexOf('hardware') != -1) result.model = line.split(':')[1].trim(); | ||
if (line.toLowerCase().indexOf('revision') != -1) result.version = line.split(':')[1].trim(); | ||
if (line.toLowerCase().indexOf('serial') != -1) result.serial = line.split(':')[1].trim(); | ||
if (line.indexOf(':') !== -1) { | ||
if (line.toLowerCase().indexOf('hardware') !== -1) result.model = line.split(':')[1].trim(); | ||
if (line.toLowerCase().indexOf('revision') !== -1) result.version = line.split(':')[1].trim(); | ||
if (line.toLowerCase().indexOf('serial') !== -1) result.serial = line.split(':')[1].trim(); | ||
} | ||
}); | ||
if (result.model == 'BCM2709') { | ||
if (result.model === 'BCM2709') { | ||
result.manufacturer = 'Raspberry Pi Foundation'; | ||
@@ -80,3 +80,3 @@ result.model = result.model + ' - Pi 2 Model B'; | ||
} | ||
if (result.model == 'BCM2708') { | ||
if (result.model === 'BCM2708') { | ||
result.manufacturer = 'Raspberry Pi Foundation'; | ||
@@ -137,8 +137,8 @@ if (['0002', '0003'].indexOf(result.version) >= 0) { | ||
line = line.replace(/[<>"]/g, ""); | ||
if (line.indexOf('=') != -1) { | ||
if (line.toLowerCase().indexOf('manufacturer') != -1) result.manufacturer = line.split('=')[1].trim(); | ||
if (line.toLowerCase().indexOf('model') != -1) result.model = line.split('=')[1].trim(); | ||
if (line.toLowerCase().indexOf('version') != -1) result.version = line.split('=')[1].trim(); | ||
if (line.toLowerCase().indexOf('ioplatformserialnumber') != -1) result.serial = line.split('=')[1].trim(); | ||
if (line.toLowerCase().indexOf('ioplatformuuid') != -1) result.uuid = line.split('=')[1].trim(); | ||
if (line.indexOf('=') !== -1) { | ||
if (line.toLowerCase().indexOf('manufacturer') !== -1) result.manufacturer = line.split('=')[1].trim(); | ||
if (line.toLowerCase().indexOf('model') !== -1) result.model = line.split('=')[1].trim(); | ||
if (line.toLowerCase().indexOf('version') !== -1) result.version = line.split('=')[1].trim(); | ||
if (line.toLowerCase().indexOf('ioplatformserialnumber') !== -1) result.serial = line.split('=')[1].trim(); | ||
if (line.toLowerCase().indexOf('ioplatformuuid') !== -1) result.uuid = line.split('=')[1].trim(); | ||
} | ||
@@ -154,3 +154,3 @@ }); | ||
if (!error) { | ||
let lines = stdout.split('\r\n').filter(line => line.trim() != '').filter((line, idx) => idx > 0)[0].trim().split(/\s\s+/); | ||
let lines = stdout.split('\r\n').filter(line => line.trim() !== '').filter((line, idx) => idx > 0)[0].trim().split(/\s\s+/); | ||
result.manufacturer = lines[5]; | ||
@@ -157,0 +157,0 @@ result.model = lines[3]; |
@@ -21,5 +21,5 @@ 'use strict'; | ||
const _linux = (_platform == 'Linux'); | ||
const _darwin = (_platform == 'Darwin'); | ||
const _windows = (_platform == 'Windows_NT'); | ||
const _linux = (_platform === 'Linux'); | ||
const _darwin = (_platform === 'Darwin'); | ||
const _windows = (_platform === 'Windows_NT'); | ||
const NOT_SUPPORTED = 'not supported'; | ||
@@ -42,3 +42,3 @@ | ||
lines.forEach(function (line) { | ||
if (line == '---') { | ||
if (line === '---') { | ||
is_whopart = false; | ||
@@ -74,5 +74,5 @@ } else { | ||
who_line = result_who.filter(function (obj) { | ||
return (obj.user.substring(0, 8).trim() == result_w.user && obj.tty == result_w.tty) | ||
return (obj.user.substring(0, 8).trim() === result_w.user && obj.tty === result_w.tty) | ||
}); | ||
if (who_line.length == 1) { | ||
if (who_line.length === 1) { | ||
result.push({ | ||
@@ -102,3 +102,3 @@ user: who_line[0].user, | ||
lines.forEach(function (line) { | ||
if (line == '---') { | ||
if (line === '---') { | ||
is_whopart = false; | ||
@@ -121,9 +121,9 @@ } else { | ||
result_w.tty = l[1]; | ||
result_w.ip = (l[2] != '-') ? l[2] : ''; | ||
result_w.ip = (l[2] !== '-') ? l[2] : ''; | ||
result_w.command = l.slice(5, 1000).join(' '); | ||
// find corresponding 'who' line | ||
who_line = result_who.filter(function (obj) { | ||
return (obj.user == result_w.user && (obj.tty.substring(3, 1000) == result_w.tty || obj.tty == result_w.tty)) | ||
return (obj.user === result_w.user && (obj.tty.substring(3, 1000) === result_w.tty || obj.tty === result_w.tty)) | ||
}); | ||
if (who_line.length == 1) { | ||
if (who_line.length === 1) { | ||
result.push({ | ||
@@ -163,3 +163,3 @@ user: who_line[0].user, | ||
result = parseUsers1(lines); | ||
if (result.length == 0) { | ||
if (result.length === 0) { | ||
exec("who; echo '---'; w | tail -n +2", function (error, stdout) { | ||
@@ -166,0 +166,0 @@ if (!error) { |
@@ -54,3 +54,3 @@ 'use strict'; | ||
function cores() { | ||
if (_cores == 0) { | ||
if (_cores === 0) { | ||
_cores = os.cpus().length; | ||
@@ -57,0 +57,0 @@ } |
{ | ||
"name": "systeminformation", | ||
"version": "3.17.0", | ||
"version": "3.17.1", | ||
"description": "Simple system and OS information library", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -47,4 +47,4 @@ # systeminformation | ||
- Version 3.16.0: `blockDevices`: added removable attribute | ||
- Version 3.15.0: added `cpuTemperature` also for OSX | ||
- Version 3.14.0: added `currentLoad` per cpu/core, cpu cache (L1, L2, L3) and cpu flags | ||
- Version 3.15.0: added `cpuTemperature` also for OSX | ||
- Version 3.14.0: added `currentLoad` per cpu/core, cpu cache (L1, L2, L3) and cpu flags | ||
- Version 3.13.0: added `shell` (returns standard shell) | ||
@@ -76,3 +76,3 @@ - Version 3.12.0: refactoring and extended `currentLoad` (better OSX coverage and added irq load). | ||
I was only able to test it on several Debian, Raspbian, Ubuntu distributions as well as OS X (Mavericks, Yosemite, El Captain). | ||
Since version 2 nearly all functionality is available on OS X/Darwin platforms. | ||
Since version 2 nearly all functionality is available on OS X/Darwin platforms. | ||
Be careful, this library has only very limited Windows support! | ||
@@ -259,4 +259,4 @@ | ||
| - ...[0].pcpu | X | X | | process % CPU usage | | ||
| - ...[0].pcpuu | X | X | | process % CPU usage (user) | | ||
| - ...[0].pcpus | X | X | | process % CPU usage (system) | | ||
| - ...[0].pcpuu | X | | | process % CPU usage (user) | | ||
| - ...[0].pcpus | X | | | process % CPU usage (system) | | ||
| - ...[0].pmem | X | X | | process memory % | | ||
@@ -270,2 +270,4 @@ | - ...[0].priority | X | X | | process priotity | | ||
| - ...[0].tty | X | X | | tty from which process was started | | ||
| - ...[0].user | X | X | | user who started process | | ||
| - ...[0].command | X | X | | process starting command | | ||
| si.processLoad('apache2',cb) | X | X | | detailed information about given process | | ||
@@ -409,3 +411,3 @@ | - proc | X | X | | process name | | ||
- Massimiliano Marcon [mmarcon](https://github.com/mmarcon) - for his work on [smc-code][smc-code-url] | ||
- Sébastien Lavoie[lavoiesl](https://github.com/lavoiesl) for his work on [osx-cpu-temp][osx-cpu-temp-url] code. | ||
- Sébastien Lavoie [lavoiesl](https://github.com/lavoiesl) for his work on [osx-cpu-temp][osx-cpu-temp-url] code. | ||
@@ -412,0 +414,0 @@ ## Copyright Information |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
190388
3956
468