systeminformation 5.28.9 → 5.29.0

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.
@@ -5,7 +5,7 @@
5
5
  // ----------------------------------------------------------------------------------
6
6
  // Description: System Information - library
7
7
  // for Node.js
8
- // Copyright: (c) 2014 - 2025
8
+ // Copyright: (c) 2014 - 2026
9
9
  // Author: Sebastian Hildebrandt
10
10
  // ----------------------------------------------------------------------------------
11
11
  // License: MIT
@@ -18,10 +18,8 @@ const isWin = require('os').type() === 'Windows_NT';
18
18
  const socketPath = isWin ? '//./pipe/docker_engine' : '/var/run/docker.sock';
19
19
 
20
20
  class DockerSocket {
21
-
22
21
  getInfo(callback) {
23
22
  try {
24
-
25
23
  let socket = net.createConnection({ path: socketPath });
26
24
  let alldata = '';
27
25
  let data;
@@ -30,7 +28,7 @@ class DockerSocket {
30
28
  socket.write('GET http:/info HTTP/1.0\r\n\r\n');
31
29
  });
32
30
 
33
- socket.on('data', data => {
31
+ socket.on('data', (data) => {
34
32
  alldata = alldata + data.toString();
35
33
  });
36
34
 
@@ -57,7 +55,6 @@ class DockerSocket {
57
55
 
58
56
  listImages(all, callback) {
59
57
  try {
60
-
61
58
  let socket = net.createConnection({ path: socketPath });
62
59
  let alldata = '';
63
60
  let data;
@@ -66,7 +63,7 @@ class DockerSocket {
66
63
  socket.write('GET http:/images/json' + (all ? '?all=1' : '') + ' HTTP/1.0\r\n\r\n');
67
64
  });
68
65
 
69
- socket.on('data', data => {
66
+ socket.on('data', (data) => {
70
67
  alldata = alldata + data.toString();
71
68
  });
72
69
 
@@ -103,7 +100,7 @@ class DockerSocket {
103
100
  socket.write('GET http:/images/' + id + '/json?stream=0 HTTP/1.0\r\n\r\n');
104
101
  });
105
102
 
106
- socket.on('data', data => {
103
+ socket.on('data', (data) => {
107
104
  alldata = alldata + data.toString();
108
105
  });
109
106
 
@@ -133,7 +130,6 @@ class DockerSocket {
133
130
 
134
131
  listContainers(all, callback) {
135
132
  try {
136
-
137
133
  let socket = net.createConnection({ path: socketPath });
138
134
  let alldata = '';
139
135
  let data;
@@ -142,7 +138,7 @@ class DockerSocket {
142
138
  socket.write('GET http:/containers/json' + (all ? '?all=1' : '') + ' HTTP/1.0\r\n\r\n');
143
139
  });
144
140
 
145
- socket.on('data', data => {
141
+ socket.on('data', (data) => {
146
142
  alldata = alldata + data.toString();
147
143
  });
148
144
 
@@ -179,7 +175,7 @@ class DockerSocket {
179
175
  socket.write('GET http:/containers/' + id + '/stats?stream=0 HTTP/1.0\r\n\r\n');
180
176
  });
181
177
 
182
- socket.on('data', data => {
178
+ socket.on('data', (data) => {
183
179
  alldata = alldata + data.toString();
184
180
  });
185
181
 
@@ -219,7 +215,7 @@ class DockerSocket {
219
215
  socket.write('GET http:/containers/' + id + '/json?stream=0 HTTP/1.0\r\n\r\n');
220
216
  });
221
217
 
222
- socket.on('data', data => {
218
+ socket.on('data', (data) => {
223
219
  alldata = alldata + data.toString();
224
220
  });
225
221
 
@@ -259,7 +255,7 @@ class DockerSocket {
259
255
  socket.write('GET http:/containers/' + id + '/top?ps_args=-opid,ppid,pgid,vsz,time,etime,nice,ruser,user,rgroup,group,stat,rss,args HTTP/1.0\r\n\r\n');
260
256
  });
261
257
 
262
- socket.on('data', data => {
258
+ socket.on('data', (data) => {
263
259
  alldata = alldata + data.toString();
264
260
  });
265
261
 
@@ -289,7 +285,6 @@ class DockerSocket {
289
285
 
290
286
  listVolumes(callback) {
291
287
  try {
292
-
293
288
  let socket = net.createConnection({ path: socketPath });
294
289
  let alldata = '';
295
290
  let data;
@@ -298,7 +293,7 @@ class DockerSocket {
298
293
  socket.write('GET http:/volumes HTTP/1.0\r\n\r\n');
299
294
  });
300
295
 
301
- socket.on('data', data => {
296
+ socket.on('data', (data) => {
302
297
  alldata = alldata + data.toString();
303
298
  });
304
299
 
package/lib/filesystem.js CHANGED
@@ -5,7 +5,7 @@
5
5
  // ----------------------------------------------------------------------------------
6
6
  // Description: System Information - library
7
7
  // for Node.js
8
- // Copyright: (c) 2014 - 2025
8
+ // Copyright: (c) 2014 - 2026
9
9
  // Author: Sebastian Hildebrandt
10
10
  // ----------------------------------------------------------------------------------
11
11
  // License: MIT
package/lib/graphics.js CHANGED
@@ -5,7 +5,7 @@
5
5
  // ----------------------------------------------------------------------------------
6
6
  // Description: System Information - library
7
7
  // for Node.js
8
- // Copyright: (c) 2014 - 2025
8
+ // Copyright: (c) 2014 - 2026
9
9
  // Author: Sebastian Hildebrandt
10
10
  // ----------------------------------------------------------------------------------
11
11
  // License: MIT
@@ -462,7 +462,7 @@ function graphics(callback) {
462
462
  options.stdio = ['pipe', 'pipe', 'ignore'];
463
463
  }
464
464
  try {
465
- const sanitized = util.sanitizeShellString(cmd) + (_linux ? ' 2>/dev/null' : '');
465
+ const sanitized = util.sanitizeShellString(cmd) + (_linux ? ' 2>/dev/null' : '') + (_windows ? ' 2> nul' : '');
466
466
  const res = execSync(sanitized, options).toString();
467
467
  return res;
468
468
  } catch {
package/lib/index.js CHANGED
@@ -5,7 +5,7 @@
5
5
  // ----------------------------------------------------------------------------------
6
6
  // Description: System Information - library
7
7
  // for Node.js
8
- // Copyright: (c) 2014 - 2025
8
+ // Copyright: (c) 2014 - 2026
9
9
  // Author: Sebastian Hildebrandt
10
10
  // ----------------------------------------------------------------------------------
11
11
  // Contributors: Guillaume Legrain (https://github.com/glegrain)
package/lib/internet.js CHANGED
@@ -5,7 +5,7 @@
5
5
  // ----------------------------------------------------------------------------------
6
6
  // Description: System Information - library
7
7
  // for Node.js
8
- // Copyright: (c) 2014 - 2025
8
+ // Copyright: (c) 2014 - 2026
9
9
  // Author: Sebastian Hildebrandt
10
10
  // ----------------------------------------------------------------------------------
11
11
  // License: MIT
@@ -17,19 +17,18 @@ const util = require('./util');
17
17
 
18
18
  let _platform = process.platform;
19
19
 
20
- const _linux = (_platform === 'linux' || _platform === 'android');
21
- const _darwin = (_platform === 'darwin');
22
- const _windows = (_platform === 'win32');
23
- const _freebsd = (_platform === 'freebsd');
24
- const _openbsd = (_platform === 'openbsd');
25
- const _netbsd = (_platform === 'netbsd');
26
- const _sunos = (_platform === 'sunos');
20
+ const _linux = _platform === 'linux' || _platform === 'android';
21
+ const _darwin = _platform === 'darwin';
22
+ const _windows = _platform === 'win32';
23
+ const _freebsd = _platform === 'freebsd';
24
+ const _openbsd = _platform === 'openbsd';
25
+ const _netbsd = _platform === 'netbsd';
26
+ const _sunos = _platform === 'sunos';
27
27
 
28
28
  // --------------------------
29
29
  // check if external site is available
30
30
 
31
31
  function inetChecksite(url, callback) {
32
-
33
32
  return new Promise((resolve) => {
34
33
  process.nextTick(() => {
35
34
  let result = {
@@ -39,7 +38,9 @@ function inetChecksite(url, callback) {
39
38
  ms: null
40
39
  };
41
40
  if (typeof url !== 'string') {
42
- if (callback) { callback(result); }
41
+ if (callback) {
42
+ callback(result);
43
+ }
43
44
  return resolve(result);
44
45
  }
45
46
  let urlSanitized = '';
@@ -68,24 +69,39 @@ function inetChecksite(url, callback) {
68
69
  Object.setPrototypeOf(urlSanitized, util.stringObj);
69
70
  }
70
71
 
71
- if (urlSanitized.startsWith('file:') || urlSanitized.startsWith('gopher:') || urlSanitized.startsWith('telnet:') || urlSanitized.startsWith('mailto:') || urlSanitized.startsWith('news:') || urlSanitized.startsWith('nntp:')) {
72
- if (callback) { callback(result); }
72
+ if (
73
+ urlSanitized.startsWith('file:') ||
74
+ urlSanitized.startsWith('gopher:') ||
75
+ urlSanitized.startsWith('telnet:') ||
76
+ urlSanitized.startsWith('mailto:') ||
77
+ urlSanitized.startsWith('news:') ||
78
+ urlSanitized.startsWith('nntp:')
79
+ ) {
80
+ if (callback) {
81
+ callback(result);
82
+ }
73
83
  return resolve(result);
74
84
  }
75
85
 
76
86
  util.checkWebsite(urlSanitized).then((res) => {
77
87
  result.status = res.statusCode;
78
- result.ok = res.statusCode >= 200 && res.statusCode <= 399;;
79
- result.ms = (result.ok ? res.time : null);
80
- if (callback) { callback(result); }
88
+ result.ok = res.statusCode >= 200 && res.statusCode <= 399;
89
+ result.ms = result.ok ? res.time : null;
90
+ if (callback) {
91
+ callback(result);
92
+ }
81
93
  resolve(result);
82
94
  });
83
95
  } else {
84
- if (callback) { callback(result); }
96
+ if (callback) {
97
+ callback(result);
98
+ }
85
99
  resolve(result);
86
100
  }
87
101
  } catch (err) {
88
- if (callback) { callback(result); }
102
+ if (callback) {
103
+ callback(result);
104
+ }
89
105
  resolve(result);
90
106
  }
91
107
  });
@@ -98,7 +114,6 @@ exports.inetChecksite = inetChecksite;
98
114
  // check inet latency
99
115
 
100
116
  function inetLatency(host, callback) {
101
-
102
117
  // fallback - if only callback is given
103
118
  if (util.isFunction(host) && !callback) {
104
119
  callback = host;
@@ -110,7 +125,9 @@ function inetLatency(host, callback) {
110
125
  return new Promise((resolve) => {
111
126
  process.nextTick(() => {
112
127
  if (typeof host !== 'string') {
113
- if (callback) { callback(null); }
128
+ if (callback) {
129
+ callback(null);
130
+ }
114
131
  return resolve(null);
115
132
  }
116
133
  let hostSanitized = '';
@@ -136,8 +153,17 @@ function inetLatency(host, callback) {
136
153
  Object.setPrototypeOf(hostSanitized, util.stringObj);
137
154
  }
138
155
 
139
- if (hostSanitized.startsWith('file:') || hostSanitized.startsWith('gopher:') || hostSanitized.startsWith('telnet:') || hostSanitized.startsWith('mailto:') || hostSanitized.startsWith('news:') || hostSanitized.startsWith('nntp:')) {
140
- if (callback) { callback(null); }
156
+ if (
157
+ hostSanitized.startsWith('file:') ||
158
+ hostSanitized.startsWith('gopher:') ||
159
+ hostSanitized.startsWith('telnet:') ||
160
+ hostSanitized.startsWith('mailto:') ||
161
+ hostSanitized.startsWith('news:') ||
162
+ hostSanitized.startsWith('nntp:')
163
+ ) {
164
+ if (callback) {
165
+ callback(null);
166
+ }
141
167
  return resolve(null);
142
168
  }
143
169
  let params;
@@ -154,7 +180,10 @@ function inetLatency(host, callback) {
154
180
  util.execSafe('ping', params).then((stdout) => {
155
181
  let result = null;
156
182
  if (stdout) {
157
- const lines = stdout.split('\n').filter((line) => (line.indexOf('rtt') >= 0 || line.indexOf('round-trip') >= 0 || line.indexOf('avg') >= 0)).join('\n');
183
+ const lines = stdout
184
+ .split('\n')
185
+ .filter((line) => line.indexOf('rtt') >= 0 || line.indexOf('round-trip') >= 0 || line.indexOf('avg') >= 0)
186
+ .join('\n');
158
187
 
159
188
  const line = lines.split('=');
160
189
  if (line.length > 1) {
@@ -164,7 +193,9 @@ function inetLatency(host, callback) {
164
193
  }
165
194
  }
166
195
  }
167
- if (callback) { callback(result); }
196
+ if (callback) {
197
+ callback(result);
198
+ }
168
199
  resolve(result);
169
200
  });
170
201
  }
@@ -174,7 +205,10 @@ function inetLatency(host, callback) {
174
205
  util.execSafe('ping', params, { timeout: 3000 }).then((stdout) => {
175
206
  let result = null;
176
207
  if (stdout) {
177
- const lines = stdout.split('\n').filter(line => line.indexOf(filt) >= 0).join('\n');
208
+ const lines = stdout
209
+ .split('\n')
210
+ .filter((line) => line.indexOf(filt) >= 0)
211
+ .join('\n');
178
212
  const line = lines.split('=');
179
213
  if (line.length > 1) {
180
214
  const parts = line[1].split('/');
@@ -183,7 +217,9 @@ function inetLatency(host, callback) {
183
217
  }
184
218
  }
185
219
  }
186
- if (callback) { callback(result); }
220
+ if (callback) {
221
+ callback(result);
222
+ }
187
223
  resolve(result);
188
224
  });
189
225
  }
@@ -204,11 +240,15 @@ function inetLatency(host, callback) {
204
240
  }
205
241
  });
206
242
  }
207
- if (callback) { callback(result); }
243
+ if (callback) {
244
+ callback(result);
245
+ }
208
246
  resolve(result);
209
247
  });
210
248
  } catch (e) {
211
- if (callback) { callback(result); }
249
+ if (callback) {
250
+ callback(result);
251
+ }
212
252
  resolve(result);
213
253
  }
214
254
  }