systeminformation 5.12.7 → 5.12.9

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/lib/battery.js CHANGED
@@ -230,7 +230,7 @@ module.exports = function (callback) {
230
230
  workload.push(util.powerShell('(Get-WmiObject -Class BatteryFullChargedCapacity -Namespace ROOT/WMI).FullChargedCapacity'));
231
231
  util.promiseAll(
232
232
  workload
233
- ).then(data => {
233
+ ).then((data) => {
234
234
  if (data) {
235
235
  let parts = data.results[0].split(/\n\s*\n/);
236
236
  let batteries = [];
package/lib/cli.js CHANGED
@@ -23,7 +23,7 @@ const si = require('./index');
23
23
  // ----------------------------------------------------------------------------------
24
24
  (function () {
25
25
  si.getStaticData().then(
26
- (data => {
26
+ ((data) => {
27
27
  data.time = si.time();
28
28
  console.log(JSON.stringify(data, null, 2));
29
29
  }
package/lib/cpu.js CHANGED
@@ -656,7 +656,7 @@ function getCpu() {
656
656
  result.cores = parseInt(countThreads) || util.cores();
657
657
  result.physicalCores = parseInt(countCores) || util.cores();
658
658
  }
659
- cpuCache().then(res => {
659
+ cpuCache().then((res) => {
660
660
  result.cache = res;
661
661
  resolve(result);
662
662
  });
@@ -816,7 +816,7 @@ function getCpu() {
816
816
 
817
817
  Promise.all(
818
818
  workload
819
- ).then(data => {
819
+ ).then((data) => {
820
820
  let lines = data[0].split('\r\n');
821
821
  let name = util.getValue(lines, 'name', ':') || '';
822
822
  if (name.indexOf('@') >= 0) {
package/lib/docker.js CHANGED
@@ -35,7 +35,7 @@ function dockerInfo(callback) {
35
35
  }
36
36
  const result = {};
37
37
 
38
- _docker_socket.getInfo(data => {
38
+ _docker_socket.getInfo((data) => {
39
39
  result.id = data.ID;
40
40
  result.containers = data.Containers;
41
41
  result.containersRunning = data.ContainersRunning;
@@ -130,7 +130,7 @@ function dockerImages(all, callback) {
130
130
  if (workload.length) {
131
131
  Promise.all(
132
132
  workload
133
- ).then(data => {
133
+ ).then((data) => {
134
134
  if (callback) { callback(data); }
135
135
  resolve(data);
136
136
  });
@@ -255,24 +255,11 @@ function dockerContainers(all, callback) {
255
255
  element.Name = element.Names[0].replace(/^\/|\/$/g, '');
256
256
  }
257
257
  workload.push(dockerContainerInspect(element.Id.trim(), element));
258
- // result.push({
259
- // id: element.Id,
260
- // name: element.Name,
261
- // image: element.Image,
262
- // imageID: element.ImageID,
263
- // command: element.Command,
264
- // created: element.Created,
265
- // state: element.State,
266
- // ports: element.Ports,
267
- // mounts: element.Mounts,
268
- // // hostconfig: element.HostConfig,
269
- // // network: element.NetworkSettings
270
- // });
271
258
  });
272
259
  if (workload.length) {
273
260
  Promise.all(
274
261
  workload
275
- ).then(data => {
262
+ ).then((data) => {
276
263
  if (callback) { callback(data); }
277
264
  resolve(data);
278
265
  });
@@ -511,7 +498,7 @@ function dockerContainerStats(containerIDs, callback) {
511
498
  if (workload.length) {
512
499
  Promise.all(
513
500
  workload
514
- ).then(data => {
501
+ ).then((data) => {
515
502
  if (callback) { callback(data); }
516
503
  resolve(data);
517
504
  });
@@ -685,7 +672,7 @@ function dockerVolumes(callback) {
685
672
  if (!_docker_socket) {
686
673
  _docker_socket = new DockerSocket();
687
674
  }
688
- _docker_socket.listVolumes(data => {
675
+ _docker_socket.listVolumes((data) => {
689
676
  let dockerVolumes = {};
690
677
  try {
691
678
  dockerVolumes = data;
@@ -726,7 +713,7 @@ function dockerAll(callback) {
726
713
  if (result && Object.prototype.toString.call(result) === '[object Array]' && result.length > 0) {
727
714
  let l = result.length;
728
715
  result.forEach(function (element) {
729
- dockerContainerStats(element.id).then(res => {
716
+ dockerContainerStats(element.id).then((res) => {
730
717
  // include stats in array
731
718
  element.memUsage = res[0].memUsage;
732
719
  element.memLimit = res[0].memLimit;
package/lib/filesystem.js CHANGED
@@ -53,7 +53,7 @@ function fsSize(callback) {
53
53
  const linuxTmpFileSystems = ['rootfs', 'unionfs', 'squashfs', 'cramfs', 'initrd', 'initramfs', 'devtmpfs', 'tmpfs', 'udev', 'devfs', 'specfs', 'type', 'appimaged'];
54
54
  let result = false;
55
55
  linuxTmpFileSystems.forEach(linuxFs => {
56
- if (fs.toLowerCase().indexOf(linuxFs) >= 0) result = true;
56
+ if (fs.toLowerCase().indexOf(linuxFs) >= 0) { result = true; }
57
57
  });
58
58
  return result;
59
59
  }
@@ -1209,7 +1209,7 @@ function diskLayout(callback) {
1209
1209
  }
1210
1210
  util.promiseAll(
1211
1211
  workload
1212
- ).then(data => {
1212
+ ).then((data) => {
1213
1213
  let devices = data.results[0].toString().split(/\n\s*\n/);
1214
1214
  devices.forEach(function (device) {
1215
1215
  let lines = device.split('\r\n');
package/lib/graphics.js CHANGED
@@ -784,7 +784,7 @@ function graphics(callback) {
784
784
 
785
785
  Promise.all(
786
786
  workload
787
- ).then(data => {
787
+ ).then((data) => {
788
788
  // controller + vram
789
789
  let csections = data[0].replace(/\r/g, '').split(/\n\s*\n/);
790
790
  let vsections = data[1].replace(/\r/g, '').split(/\n\s*\n/);
package/lib/index.d.ts CHANGED
@@ -156,16 +156,16 @@ export namespace Systeminformation {
156
156
  type: string;
157
157
  protocol: string;
158
158
  };
159
- model_family?: string,
160
- model_name?: string,
161
- serial_number?: string,
162
- firmware_version?: string,
159
+ model_family?: string;
160
+ model_name?: string;
161
+ serial_number?: string;
162
+ firmware_version?: string;
163
163
  smart_status: {
164
164
  passed: boolean;
165
165
  };
166
166
  trim?: {
167
167
  supported: boolean;
168
- },
168
+ };
169
169
  ata_smart_attributes?: {
170
170
  revision: number;
171
171
  table: {
@@ -185,7 +185,10 @@ export namespace Systeminformation {
185
185
  event_count: boolean;
186
186
  auto_keep: boolean;
187
187
  };
188
- raw: { value: number; string: string; };
188
+ raw: {
189
+ value: number;
190
+ string: string;
191
+ };
189
192
  }[];
190
193
  };
191
194
  ata_smart_error_log?: {
@@ -201,12 +204,12 @@ export namespace Systeminformation {
201
204
  type: {
202
205
  value: number;
203
206
  string: string;
204
- },
207
+ };
205
208
  status: {
206
209
  value: number;
207
210
  string: string;
208
211
  passed: boolean;
209
- },
212
+ };
210
213
  lifetime_hours: number;
211
214
  }[];
212
215
  count: number;
@@ -215,34 +218,34 @@ export namespace Systeminformation {
215
218
  };
216
219
  };
217
220
  nvme_pci_vendor?: {
218
- id: number,
221
+ id: number;
219
222
  subsystem_id: number;
220
223
  },
221
224
  nvme_smart_health_information_log?: {
222
- critical_warning?: number,
223
- temperature?: number,
224
- available_spare?: number,
225
- available_spare_threshold?: number,
226
- percentage_used?: number,
227
- data_units_read?: number,
228
- data_units_written?: number,
229
- host_reads?: number,
230
- host_writes?: number,
231
- controller_busy_time?: number,
232
- power_cycles?: number,
233
- power_on_hours?: number,
234
- unsafe_shutdowns?: number,
235
- media_errors?: number,
236
- num_err_log_entries?: number,
237
- warning_temp_time?: number,
238
- critical_comp_time?: number,
225
+ critical_warning?: number;
226
+ temperature?: number;
227
+ available_spare?: number;
228
+ available_spare_threshold?: number;
229
+ percentage_used?: number;
230
+ data_units_read?: number;
231
+ data_units_written?: number;
232
+ host_reads?: number;
233
+ host_writes?: number;
234
+ controller_busy_time?: number;
235
+ power_cycles?: number;
236
+ power_on_hours?: number;
237
+ unsafe_shutdowns?: number;
238
+ media_errors?: number;
239
+ num_err_log_entries?: number;
240
+ warning_temp_time?: number;
241
+ critical_comp_time?: number;
239
242
  temperature_sensors?: number[];
240
243
  },
241
244
  user_capacity?: {
242
- blocks: number,
245
+ blocks: number;
243
246
  bytes: number;
244
247
  },
245
- logical_block_size?: number,
248
+ logical_block_size?: number;
246
249
  temperature: {
247
250
  current: number;
248
251
  };
@@ -283,7 +286,7 @@ export namespace Systeminformation {
283
286
  currentCapacity: number;
284
287
  capacityUnit: string;
285
288
  percent: number;
286
- timeRemaining: number,
289
+ timeRemaining: number;
287
290
  acConnected: boolean;
288
291
  type: string;
289
292
  model: string;
@@ -618,7 +621,7 @@ export namespace Systeminformation {
618
621
  interface ProcessesProcessData {
619
622
  pid: number;
620
623
  parentPid: number;
621
- name: string,
624
+ name: string;
622
625
  cpu: number;
623
626
  cpuu: number;
624
627
  cpus: number;
@@ -627,7 +630,7 @@ export namespace Systeminformation {
627
630
  memVsz: number;
628
631
  memRss: number;
629
632
  nice: number;
630
- started: string,
633
+ started: string;
631
634
  state: string;
632
635
  tty: string;
633
636
  user: string;
@@ -772,7 +775,7 @@ export namespace Systeminformation {
772
775
  restartCount: number;
773
776
  cpuStats: any;
774
777
  precpuStats: any;
775
- memoryStats: any,
778
+ memoryStats: any;
776
779
  networks: any;
777
780
  }
778
781
 
package/lib/index.js CHANGED
@@ -95,7 +95,7 @@ function getStaticData(callback) {
95
95
  network.networkInterfaces(),
96
96
  memory.memLayout(),
97
97
  filesystem.diskLayout()
98
- ]).then(res => {
98
+ ]).then((res) => {
99
99
  data.system = res[0];
100
100
  data.bios = res[1];
101
101
  data.baseboard = res[2];
@@ -181,95 +181,95 @@ function getDynamicData(srv, iface, callback) {
181
181
  data.node = process.versions.node;
182
182
  data.v8 = process.versions.v8;
183
183
 
184
- cpu.cpuCurrentSpeed().then(res => {
184
+ cpu.cpuCurrentSpeed().then((res) => {
185
185
  data.cpuCurrentSpeed = res;
186
186
  functionProcessed();
187
187
  });
188
188
 
189
- users.users().then(res => {
189
+ users.users().then((res) => {
190
190
  data.users = res;
191
191
  functionProcessed();
192
192
  });
193
193
 
194
- processes.processes().then(res => {
194
+ processes.processes().then((res) => {
195
195
  data.processes = res;
196
196
  functionProcessed();
197
197
  });
198
198
 
199
- cpu.currentLoad().then(res => {
199
+ cpu.currentLoad().then((res) => {
200
200
  data.currentLoad = res;
201
201
  functionProcessed();
202
202
  });
203
203
 
204
204
  if (!_sunos) {
205
- cpu.cpuTemperature().then(res => {
205
+ cpu.cpuTemperature().then((res) => {
206
206
  data.temp = res;
207
207
  functionProcessed();
208
208
  });
209
209
  }
210
210
 
211
211
  if (!_openbsd && !_freebsd && !_netbsd && !_sunos) {
212
- network.networkStats(iface).then(res => {
212
+ network.networkStats(iface).then((res) => {
213
213
  data.networkStats = res;
214
214
  functionProcessed();
215
215
  });
216
216
  }
217
217
 
218
218
  if (!_sunos) {
219
- network.networkConnections().then(res => {
219
+ network.networkConnections().then((res) => {
220
220
  data.networkConnections = res;
221
221
  functionProcessed();
222
222
  });
223
223
  }
224
224
 
225
- memory.mem().then(res => {
225
+ memory.mem().then((res) => {
226
226
  data.mem = res;
227
227
  functionProcessed();
228
228
  });
229
229
 
230
230
  if (!_sunos) {
231
- battery().then(res => {
231
+ battery().then((res) => {
232
232
  data.battery = res;
233
233
  functionProcessed();
234
234
  });
235
235
  }
236
236
 
237
237
  if (!_sunos) {
238
- processes.services(srv).then(res => {
238
+ processes.services(srv).then((res) => {
239
239
  data.services = res;
240
240
  functionProcessed();
241
241
  });
242
242
  }
243
243
 
244
244
  if (!_sunos) {
245
- filesystem.fsSize().then(res => {
245
+ filesystem.fsSize().then((res) => {
246
246
  data.fsSize = res;
247
247
  functionProcessed();
248
248
  });
249
249
  }
250
250
 
251
251
  if (!_windows && !_openbsd && !_freebsd && !_netbsd && !_sunos) {
252
- filesystem.fsStats().then(res => {
252
+ filesystem.fsStats().then((res) => {
253
253
  data.fsStats = res;
254
254
  functionProcessed();
255
255
  });
256
256
  }
257
257
 
258
258
  if (!_windows && !_openbsd && !_freebsd && !_netbsd && !_sunos) {
259
- filesystem.disksIO().then(res => {
259
+ filesystem.disksIO().then((res) => {
260
260
  data.disksIO = res;
261
261
  functionProcessed();
262
262
  });
263
263
  }
264
264
 
265
265
  if (!_openbsd && !_freebsd && !_netbsd && !_sunos) {
266
- wifi.wifiNetworks().then(res => {
266
+ wifi.wifiNetworks().then((res) => {
267
267
  data.wifiNetworks = res;
268
268
  functionProcessed();
269
269
  });
270
270
  }
271
271
 
272
- internet.inetLatency().then(res => {
272
+ internet.inetLatency().then((res) => {
273
273
  data.inetLatency = res;
274
274
  functionProcessed();
275
275
  });
@@ -301,9 +301,9 @@ function getAllData(srv, iface, callback) {
301
301
  iface = '';
302
302
  }
303
303
 
304
- getStaticData().then(res => {
304
+ getStaticData().then((res) => {
305
305
  data = res;
306
- getDynamicData(srv, iface).then(res => {
306
+ getDynamicData(srv, iface).then((res) => {
307
307
  for (let key in res) {
308
308
  if ({}.hasOwnProperty.call(res, key)) {
309
309
  data[key] = res[key];
@@ -333,7 +333,7 @@ function get(valueObject, callback) {
333
333
  }
334
334
  });
335
335
 
336
- Promise.all(allPromises).then(data => {
336
+ Promise.all(allPromises).then((data) => {
337
337
  const result = {};
338
338
  let i = 0;
339
339
  for (let key in valueObject) {
@@ -419,7 +419,7 @@ function observe(valueObject, interval, callback) {
419
419
  let _data = null;
420
420
 
421
421
  const result = setInterval(() => {
422
- get(valueObject).then(data => {
422
+ get(valueObject).then((data) => {
423
423
  if (JSON.stringify(_data) !== JSON.stringify(data)) {
424
424
  _data = Object.assign({}, data);
425
425
  callback(data);
package/lib/network.js CHANGED
@@ -250,7 +250,7 @@ function getWindowsNics() {
250
250
  let cmd = 'Get-WmiObject Win32_NetworkAdapter | fl *' + '; echo \'#-#-#-#\';';
251
251
  cmd += 'Get-WmiObject Win32_NetworkAdapterConfiguration | fl DHCPEnabled' + '';
252
252
  try {
253
- util.powerShell(cmd).then(data => {
253
+ util.powerShell(cmd).then((data) => {
254
254
  data = data.split('#-#-#-#');
255
255
  const nsections = (data[0] || '').split(/\n\s*\n/);
256
256
  const nconfigsections = (data[1] || '').split(/\n\s*\n/);
@@ -1161,7 +1161,7 @@ function networkStats(ifaces, callback) {
1161
1161
  if (workload.length) {
1162
1162
  Promise.all(
1163
1163
  workload
1164
- ).then(data => {
1164
+ ).then((data) => {
1165
1165
  if (callback) { callback(data); }
1166
1166
  resolve(data);
1167
1167
  });
@@ -1183,7 +1183,7 @@ function networkStatsSingle(iface) {
1183
1183
  if (sections[i].trim() !== '') {
1184
1184
  let lines = sections[i].trim().split('\r\n');
1185
1185
  perfData.push({
1186
- name: util.getValue(lines, 'Name', ':').replace(/[()[\] ]+/g, '').replace(/\#|\//g, '_').toLowerCase(),
1186
+ name: util.getValue(lines, 'Name', ':').replace(/[()[\] ]+/g, '').replace(/#|\//g, '_').toLowerCase(),
1187
1187
  rx_bytes: parseInt(util.getValue(lines, 'BytesReceivedPersec', ':'), 10),
1188
1188
  rx_errors: parseInt(util.getValue(lines, 'PacketsReceivedErrors', ':'), 10),
1189
1189
  rx_dropped: parseInt(util.getValue(lines, 'PacketsReceivedDiscarded', ':'), 10),
@@ -1202,7 +1202,7 @@ function networkStatsSingle(iface) {
1202
1202
  let ifaceSanitized = '';
1203
1203
  const s = util.isPrototypePolluted() ? '---' : util.sanitizeShellString(iface);
1204
1204
  for (let i = 0; i <= util.mathMin(s.length, 2000); i++) {
1205
- if (!(s[i] === undefined)) {
1205
+ if (s[i] !== undefined) {
1206
1206
  ifaceSanitized = ifaceSanitized + s[i];
1207
1207
  }
1208
1208
  }
@@ -1334,8 +1334,8 @@ function networkStatsSingle(iface) {
1334
1334
  det.mac.toLowerCase() === ifaceSanitized.toLowerCase() ||
1335
1335
  det.ip4.toLowerCase() === ifaceSanitized.toLowerCase() ||
1336
1336
  det.ip6.toLowerCase() === ifaceSanitized.toLowerCase() ||
1337
- det.ifaceName.replace(/[()[\] ]+/g, '').replace(/\#|\//g, '_').toLowerCase() === ifaceSanitized.replace(/[()[\] ]+/g, '').replace('#', '_').toLowerCase()) &&
1338
- (det.ifaceName.replace(/[()[\] ]+/g, '').replace(/\#|\//g, '_').toLowerCase() === detail.name)) {
1337
+ det.ifaceName.replace(/[()[\] ]+/g, '').replace(/#|\//g, '_').toLowerCase() === ifaceSanitized.replace(/[()[\] ]+/g, '').replace('#', '_').toLowerCase()) &&
1338
+ (det.ifaceName.replace(/[()[\] ]+/g, '').replace(/#|\//g, '_').toLowerCase() === detail.name)) {
1339
1339
  ifaceName = det.iface;
1340
1340
  rx_bytes = detail.rx_bytes;
1341
1341
  rx_dropped = detail.rx_dropped;
@@ -1693,7 +1693,7 @@ function networkGatewayDefault(callback) {
1693
1693
  });
1694
1694
  if (!result) {
1695
1695
  util.powerShell('Get-CimInstance -ClassName Win32_IP4RouteTable | Where-Object { $_.Destination -eq \'0.0.0.0\' -and $_.Mask -eq \'0.0.0.0\' }')
1696
- .then(data => {
1696
+ .then((data) => {
1697
1697
  let lines = data.toString().split('\r\n');
1698
1698
  if (lines.length > 1 && !result) {
1699
1699
  result = util.getValue(lines, 'NextHop');
package/lib/osinfo.js CHANGED
@@ -221,7 +221,6 @@ function osInfo(callback) {
221
221
  if (_linux) {
222
222
 
223
223
  exec('cat /etc/*-release; cat /usr/lib/os-release; cat /etc/openwrt_release', function (error, stdout) {
224
- //if (!error) {
225
224
  /**
226
225
  * @namespace
227
226
  * @property {string} DISTRIB_ID
@@ -251,7 +250,7 @@ function osInfo(callback) {
251
250
  result.build = (release.BUILD_ID || '').replace(/"/g, '').trim();
252
251
  isUefiLinux().then(uefi => {
253
252
  result.uefi = uefi;
254
- uuid().then(data => {
253
+ uuid().then((data) => {
255
254
  result.serial = data.os;
256
255
  if (callback) {
257
256
  callback(result);
@@ -259,7 +258,6 @@ function osInfo(callback) {
259
258
  resolve(result);
260
259
  });
261
260
  });
262
- //}
263
261
  });
264
262
  }
265
263
  if (_freebsd || _openbsd || _netbsd) {
@@ -335,7 +333,7 @@ function osInfo(callback) {
335
333
  workload.push(util.powerShell('Add-Type -AssemblyName System.Windows.Forms; [System.Windows.Forms.SystemInformation]::TerminalServerSession'));
336
334
  util.promiseAll(
337
335
  workload
338
- ).then(data => {
336
+ ).then((data) => {
339
337
  let lines = data.results[0] ? data.results[0].toString().split('\r\n') : [''];
340
338
  result.distro = util.getValue(lines, 'Caption', ':').trim();
341
339
  result.serial = util.getValue(lines, 'SerialNumber', ':').trim();
package/lib/processes.js CHANGED
@@ -135,7 +135,7 @@ function services(srv, callback) {
135
135
 
136
136
  const s = util.sanitizeShellString(srv);
137
137
  for (let i = 0; i <= util.mathMin(s.length, 2000); i++) {
138
- if (!(s[i] === undefined)) {
138
+ if (s[i] !== undefined) {
139
139
  srvString = srvString + s[i];
140
140
  }
141
141
  }
@@ -171,7 +171,6 @@ function services(srv, callback) {
171
171
  const parts = s.split(']');
172
172
  if (parts.length === 2) {
173
173
  srvString += (srvString !== '' ? '|' : '') + parts[1].trim();
174
- // allSrv.push({ name: parts[1].trim(), running: parts[0].indexOf('+') > 0 });
175
174
  }
176
175
  }
177
176
  srvs = srvString.split('|');
@@ -185,13 +184,11 @@ function services(srv, callback) {
185
184
  const name = s.trim();
186
185
  if (name) {
187
186
  srvString += (srvString !== '' ? '|' : '') + name;
188
- // allSrv.push({ name: name, running: null });
189
187
  }
190
188
  }
191
189
  srvs = srvString.split('|');
192
190
  }
193
191
  } catch (f) {
194
- // allSrv = [];
195
192
  srvString = '';
196
193
  srvs = [];
197
194
  }
@@ -219,7 +216,6 @@ function services(srv, callback) {
219
216
  return (e.toLowerCase().indexOf(' ' + srv + ':') !== -1) || (e.toLowerCase().indexOf('/' + srv) !== -1);
220
217
  });
221
218
  }
222
- // let singleSrv = allSrv.filter(item => { return item.name === srv; });
223
219
  const pids = [];
224
220
  for (const p of ps) {
225
221
  const pid = p.trim().split(' ')[2];
@@ -229,7 +225,6 @@ function services(srv, callback) {
229
225
  }
230
226
  result.push({
231
227
  name: srv,
232
- // running: (allSrv.length && singleSrv.length && singleSrv[0].running !== null ? singleSrv[0].running : ps.length > 0),
233
228
  running: ps.length > 0,
234
229
  startmode: '',
235
230
  pids: pids,
@@ -288,10 +283,8 @@ function services(srv, callback) {
288
283
 
289
284
  // store old values
290
285
  _services_cpu.all = all;
291
- // _services_cpu.list = list_new;
292
286
  _services_cpu.list = Object.assign({}, list_new);
293
287
  _services_cpu.ms = Date.now() - _services_cpu.ms;
294
- // _services_cpu.result = result;
295
288
  _services_cpu.result = Object.assign({}, result);
296
289
  if (callback) { callback(result); }
297
290
  resolve(result);
@@ -786,10 +779,8 @@ function processes(callback) {
786
779
 
787
780
  // store old values
788
781
  _processes_cpu.all = all;
789
- // _processes_cpu.list = list_new;
790
782
  _processes_cpu.list = Object.assign({}, list_new);
791
783
  _processes_cpu.ms = Date.now() - _processes_cpu.ms;
792
- // _processes_cpu.result = result;
793
784
  _processes_cpu.result = Object.assign({}, result);
794
785
  if (callback) { callback(result); }
795
786
  resolve(result);
@@ -838,8 +829,6 @@ function processes(callback) {
838
829
  let list_new = {};
839
830
  let allcpuu = 0;
840
831
  let allcpus = 0;
841
- // let allcpuu = _processes_cpu.all_utime;
842
- // let allcpus = _processes_cpu.all_stime;
843
832
  for (let i = 0; i < processSections.length; i++) {
844
833
  if (processSections[i].trim() !== '') {
845
834
  let lines = processSections[i].trim().split('\r\n');
@@ -848,14 +837,24 @@ function processes(callback) {
848
837
  let statusValue = util.getValue(lines, 'ExecutionState', ':');
849
838
  let name = util.getValue(lines, 'Caption', ':', true);
850
839
  let commandLine = util.getValue(lines, 'CommandLine', ':', true);
840
+ // get additional command line data
841
+ let additionalCommand = false;
842
+ lines.forEach((line) => {
843
+ if (additionalCommand && line.toLowerCase().startsWith(' ')) {
844
+ commandLine = commandLine + line.trim();
845
+ } else {
846
+ additionalCommand = false;
847
+ }
848
+ if (line.toLowerCase().startsWith('commandline')) {
849
+ additionalCommand = true;
850
+ }
851
+ });
851
852
  let commandPath = util.getValue(lines, 'ExecutablePath', ':', true);
852
853
  let utime = parseInt(util.getValue(lines, 'UserModeTime', ':', true), 10);
853
854
  let stime = parseInt(util.getValue(lines, 'KernelModeTime', ':', true), 10);
854
855
  let memw = parseInt(util.getValue(lines, 'WorkingSetSize', ':', true), 10);
855
856
  allcpuu = allcpuu + utime;
856
857
  allcpus = allcpus + stime;
857
- // allcpuu += utime - (_processes_cpu.list[pid] ? _processes_cpu.list[pid].utime : 0);
858
- // allcpus += stime - (_processes_cpu.list[pid] ? _processes_cpu.list[pid].stime : 0);
859
858
  result.all++;
860
859
  if (!statusValue) { result.unknown++; }
861
860
  if (statusValue === '3') { result.running++; }
@@ -916,10 +915,8 @@ function processes(callback) {
916
915
  _processes_cpu.all = allcpuu + allcpus;
917
916
  _processes_cpu.all_utime = allcpuu;
918
917
  _processes_cpu.all_stime = allcpus;
919
- // _processes_cpu.list = list_new;
920
918
  _processes_cpu.list = Object.assign({}, list_new);
921
919
  _processes_cpu.ms = Date.now() - _processes_cpu.ms;
922
- // _processes_cpu.result = result;
923
920
  _processes_cpu.result = Object.assign({}, result);
924
921
  }
925
922
  if (callback) {
@@ -1009,8 +1006,6 @@ function processLoad(proc, callback) {
1009
1006
  let list_new = {};
1010
1007
  let allcpuu = 0;
1011
1008
  let allcpus = 0;
1012
- // let allcpuu = _process_cpu.all_utime;
1013
- // let allcpus = _process_cpu.all_stime;
1014
1009
 
1015
1010
  // go through all processes
1016
1011
  for (let i = 0; i < processSections.length; i++) {
@@ -1023,8 +1018,6 @@ function processLoad(proc, callback) {
1023
1018
  let mem = parseInt(util.getValue(lines, 'WorkingSetSize', ':', true), 10);
1024
1019
  allcpuu = allcpuu + utime;
1025
1020
  allcpus = allcpus + stime;
1026
- // allcpuu += utime - (_process_cpu.list[pid] ? _process_cpu.list[pid].utime : 0);
1027
- // allcpus += stime - (_process_cpu.list[pid] ? _process_cpu.list[pid].stime : 0);
1028
1021
 
1029
1022
  procStats.push({
1030
1023
  pid: pid,
@@ -1039,9 +1032,6 @@ function processLoad(proc, callback) {
1039
1032
  let pname = '';
1040
1033
  let inList = false;
1041
1034
  processes.forEach(function (proc) {
1042
- // console.log(proc)
1043
- // console.log(item)
1044
- // inList = inList || item.name.toLowerCase() === proc.toLowerCase();
1045
1035
  if (name.toLowerCase().indexOf(proc.toLowerCase()) >= 0 && !inList) {
1046
1036
  inList = true;
1047
1037
  pname = proc;
@@ -1072,7 +1062,6 @@ function processLoad(proc, callback) {
1072
1062
  // add missing processes
1073
1063
  if (processesString !== '*') {
1074
1064
  let processesMissing = processes.filter(function (name) {
1075
- // return procStats.filter(function(item) { return item.name.toLowerCase() === name }).length === 0;
1076
1065
  return procStats.filter(function (item) { return item.name.toLowerCase().indexOf(name) >= 0; }).length === 0;
1077
1066
 
1078
1067
  });
@@ -1111,7 +1100,6 @@ function processLoad(proc, callback) {
1111
1100
  _process_cpu.all = allcpuu + allcpus;
1112
1101
  _process_cpu.all_utime = allcpuu;
1113
1102
  _process_cpu.all_stime = allcpus;
1114
- // _process_cpu.list = list_new;
1115
1103
  _process_cpu.list = Object.assign({}, list_new);
1116
1104
  _process_cpu.ms = Date.now() - _process_cpu.ms;
1117
1105
  _process_cpu.result = JSON.parse(JSON.stringify(result));
@@ -1159,8 +1147,6 @@ function processLoad(proc, callback) {
1159
1147
  let inList = false;
1160
1148
  let name = '';
1161
1149
  for (let j = 0; j < result.length; j++) {
1162
- // if (result[j].proc.toLowerCase() === item.name.toLowerCase()) {
1163
- // if (result[j].proc.toLowerCase().indexOf(item.name.toLowerCase()) >= 0) {
1164
1150
  if (item.name.toLowerCase().indexOf(result[j].proc.toLowerCase()) >= 0) {
1165
1151
  listPos = j;
1166
1152
  }
package/lib/system.js CHANGED
@@ -571,7 +571,7 @@ function baseboard(callback) {
571
571
  workload.push(execPromise('export LC_ALL=C; dmidecode -t memory 2>/dev/null'));
572
572
  util.promiseAll(
573
573
  workload
574
- ).then(data => {
574
+ ).then((data) => {
575
575
  let lines = data.results[0] ? data.results[0].toString().split('\n') : [''];
576
576
  result.manufacturer = util.getValue(lines, 'Manufacturer');
577
577
  result.model = util.getValue(lines, 'Product Name');
@@ -630,7 +630,7 @@ function baseboard(callback) {
630
630
  workload.push(execPromise('system_profiler SPMemoryDataType'));
631
631
  util.promiseAll(
632
632
  workload
633
- ).then(data => {
633
+ ).then((data) => {
634
634
  let lines = data.results[0] ? data.results[0].toString().replace(/[<>"]/g, '').split('\n') : [''];
635
635
  result.manufacturer = util.getValue(lines, 'manufacturer', '=', true);
636
636
  result.model = util.getValue(lines, 'model', '=', true);
@@ -668,7 +668,7 @@ function baseboard(callback) {
668
668
  workload.push(util.powerShell(`Get-WmiObject Win32_physicalmemoryarray | select ${maxCapacityAttribute}, MemoryDevices | fl`));
669
669
  util.promiseAll(
670
670
  workload
671
- ).then(data => {
671
+ ).then((data) => {
672
672
  let lines = data.results[0] ? data.results[0].toString().split('\r\n') : [''];
673
673
 
674
674
  result.manufacturer = util.getValue(lines, 'manufacturer', ':');
package/lib/usb.js CHANGED
@@ -278,21 +278,6 @@ function usb(callback) {
278
278
  }
279
279
  resolve(result);
280
280
  });
281
-
282
- // util.powerShell("gwmi Win32_USBControllerDevice |\%{[wmi]($_.Dependent)}").then(data => {
283
-
284
- // const parts = data.toString().split(/\n\s*\n/);
285
- // for (let i = 0; i < parts.length; i++) {
286
- // const usb = parseWindowsUsb(parts[i].split('\n'), i)
287
- // if (usb) {
288
- // result.push(usb)
289
- // }
290
- // }
291
- // if (callback) {
292
- // callback(result);
293
- // }
294
- // resolve(result);
295
- // });
296
281
  }
297
282
  if (_sunos || _freebsd || _openbsd || _netbsd) {
298
283
  resolve(null);
package/lib/users.js CHANGED
@@ -26,44 +26,6 @@ const _openbsd = (_platform === 'openbsd');
26
26
  const _netbsd = (_platform === 'netbsd');
27
27
  const _sunos = (_platform === 'sunos');
28
28
 
29
- // let _winDateFormat = {
30
- // dateFormat: '',
31
- // dateSeperator: '',
32
- // timeFormat: '',
33
- // timeSeperator: '',
34
- // amDesignator: '',
35
- // pmDesignator: ''
36
- // };
37
-
38
- // --------------------------
39
- // array of users online = sessions
40
-
41
- // function getWinCulture() {
42
- // return new Promise((resolve) => {
43
- // process.nextTick(() => {
44
- // if (!_winDateFormat.dateFormat) {
45
- // util.powerShell('(get-culture).DateTimeFormat')
46
- // .then(data => {
47
- // let lines = data.toString().split('\r\n');
48
- // _winDateFormat.dateFormat = util.getValue(lines, 'ShortDatePattern', ':');
49
- // _winDateFormat.dateSeperator = util.getValue(lines, 'DateSeparator', ':');
50
- // _winDateFormat.timeFormat = util.getValue(lines, 'ShortTimePattern', ':');
51
- // _winDateFormat.timeSeperator = util.getValue(lines, 'TimeSeparator', ':');
52
- // _winDateFormat.amDesignator = util.getValue(lines, 'AMDesignator', ':');
53
- // _winDateFormat.pmDesignator = util.getValue(lines, 'PMDesignator', ':');
54
-
55
- // resolve(_winDateFormat);
56
- // })
57
- // .catch(() => {
58
- // resolve(_winDateFormat);
59
- // });
60
- // } else {
61
- // resolve(_winDateFormat);
62
- // }
63
- // });
64
- // });
65
- // }
66
-
67
29
  function parseUsersLinux(lines, phase) {
68
30
  let result = [];
69
31
  let result_who = [];
@@ -245,21 +207,11 @@ function users(callback) {
245
207
  }
246
208
  if (_windows) {
247
209
  try {
248
- // const workload = [];
249
- // // workload.push(util.powerShell('Get-CimInstance -ClassName Win32_Account | fl *'));
250
- // workload.push(util.powerShell('Get-WmiObject Win32_LogonSession | fl *'));
251
- // workload.push(util.powerShell('Get-WmiObject Win32_LoggedOnUser | fl *'));
252
- // workload.push(util.powerShell('Get-WmiObject Win32_Process -Filter "name=\'explorer.exe\'" | Select @{Name="domain";Expression={$_.GetOwner().Domain}}, @{Name="username";Expression={$_.GetOwner().User}} | fl'));
253
- // Promise.all(
254
- // workload
255
- // ).then(data => {
256
210
  let cmd = 'Get-WmiObject Win32_LogonSession | select LogonId,StartTime | fl' + '; echo \'#-#-#-#\';';
257
211
  cmd += 'Get-WmiObject Win32_LoggedOnUser | select antecedent,dependent | fl ' + '; echo \'#-#-#-#\';';
258
212
  cmd += 'Get-WmiObject Win32_Process -Filter "name=\'explorer.exe\'" | Select @{Name="sessionid";Expression={$_.SessionId}}, @{Name="domain";Expression={$_.GetOwner().Domain}}, @{Name="username";Expression={$_.GetOwner().User}} | fl' + '; echo \'#-#-#-#\';';
259
213
  cmd += 'query user';
260
- util.powerShell(cmd).then(data => {
261
- // controller + vram
262
- // let accounts = parseWinAccounts(data[0].split(/\n\s*\n/));
214
+ util.powerShell(cmd).then((data) => {
263
215
  if (data) {
264
216
  data = data.split('#-#-#-#');
265
217
  let sessions = parseWinSessions((data[0] || '').split(/\n\s*\n/));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "systeminformation",
3
- "version": "5.12.7",
3
+ "version": "5.12.9",
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)",