sysiddr5 1.0.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of sysiddr5 might be problematic. Click here for more details.

package/lib/util.js ADDED
@@ -0,0 +1,1303 @@
1
+ 'use strict';
2
+ // @ts-check
3
+ // ==================================================================================
4
+ // utils.js
5
+ // ----------------------------------------------------------------------------------
6
+ // Description: System Information - library
7
+ // for Node.js
8
+ // Copyright: (c) 2014 - 2023
9
+ // Author: Sebastian Hildebrandt
10
+ // ----------------------------------------------------------------------------------
11
+ // License: MIT
12
+ // ==================================================================================
13
+ // 0. helper functions
14
+ // ----------------------------------------------------------------------------------
15
+
16
+ const os = require('os');
17
+ const fs = require('fs');
18
+ const path = require('path');
19
+ const spawn = require('child_process').spawn;
20
+ const exec = require('child_process').exec;
21
+ const execSync = require('child_process').execSync;
22
+ const util = require('util');
23
+
24
+ let _platform = process.platform;
25
+ const _linux = (_platform === 'linux' || _platform === 'android');
26
+ const _darwin = (_platform === 'darwin');
27
+ const _windows = (_platform === 'win32');
28
+ const _freebsd = (_platform === 'freebsd');
29
+ const _openbsd = (_platform === 'openbsd');
30
+ const _netbsd = (_platform === 'netbsd');
31
+
32
+ let _cores = 0;
33
+ let wmicPath = '';
34
+ let codepage = '';
35
+ let _smartMonToolsInstalled = null;
36
+
37
+ const WINDIR = process.env.WINDIR || 'C:\\Windows';
38
+
39
+ // powerShell
40
+ let _psChild;
41
+ let _psResult = '';
42
+ let _psCmds = [];
43
+ let _psPersistent = false;
44
+ const _psToUTF8 = '$OutputEncoding = [System.Console]::OutputEncoding = [System.Console]::InputEncoding = [System.Text.Encoding]::UTF8 ; ';
45
+ const _psCmdStart = '--###START###--';
46
+ const _psError = '--ERROR--';
47
+ const _psCmdSeperator = '--###ENDCMD###--';
48
+ const _psIdSeperator = '--##ID##--';
49
+
50
+ const execOptsWin = {
51
+ windowsHide: true,
52
+ maxBuffer: 1024 * 20000,
53
+ encoding: 'UTF-8',
54
+ env: util._extend({}, process.env, { LANG: 'en_US.UTF-8' })
55
+ };
56
+
57
+ function toInt(value) {
58
+ let result = parseInt(value, 10);
59
+ if (isNaN(result)) {
60
+ result = 0;
61
+ }
62
+ return result;
63
+ }
64
+
65
+
66
+ const stringReplace = new String().replace;
67
+ const stringToLower = new String().toLowerCase;
68
+ const stringToString = new String().toString;
69
+ const stringSubstr = new String().substr;
70
+ const stringTrim = new String().trim;
71
+ const stringStartWith = new String().startsWith;
72
+ const mathMin = Math.min;
73
+
74
+ function isFunction(functionToCheck) {
75
+ let getType = {};
76
+ return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
77
+ }
78
+
79
+ function unique(obj) {
80
+ let uniques = [];
81
+ let stringify = {};
82
+ for (let i = 0; i < obj.length; i++) {
83
+ let keys = Object.keys(obj[i]);
84
+ keys.sort(function (a, b) { return a - b; });
85
+ let str = '';
86
+ for (let j = 0; j < keys.length; j++) {
87
+ str += JSON.stringify(keys[j]);
88
+ str += JSON.stringify(obj[i][keys[j]]);
89
+ }
90
+ if (!{}.hasOwnProperty.call(stringify, str)) {
91
+ uniques.push(obj[i]);
92
+ stringify[str] = true;
93
+ }
94
+ }
95
+ return uniques;
96
+ }
97
+
98
+ function sortByKey(array, keys) {
99
+ return array.sort(function (a, b) {
100
+ let x = '';
101
+ let y = '';
102
+ keys.forEach(function (key) {
103
+ x = x + a[key]; y = y + b[key];
104
+ });
105
+ return ((x < y) ? -1 : ((x > y) ? 1 : 0));
106
+ });
107
+ }
108
+
109
+ function cores() {
110
+ if (_cores === 0) {
111
+ _cores = os.cpus().length;
112
+ }
113
+ return _cores;
114
+ }
115
+
116
+ function getValue(lines, property, separator, trimmed, lineMatch) {
117
+ separator = separator || ':';
118
+ property = property.toLowerCase();
119
+ trimmed = trimmed || false;
120
+ lineMatch = lineMatch || false;
121
+ let result = '';
122
+ lines.some((line) => {
123
+ let lineLower = line.toLowerCase().replace(/\t/g, '');
124
+ if (trimmed) {
125
+ lineLower = lineLower.trim();
126
+ }
127
+ if (lineLower.startsWith(property) && (lineMatch ? (lineLower.match(property + separator)) || (lineLower.match(property + ' ' + separator)) : true)) {
128
+ const parts = trimmed ? line.trim().split(separator) : line.split(separator);
129
+ if (parts.length >= 2) {
130
+ parts.shift();
131
+ result = parts.join(separator).trim();
132
+ return true;
133
+ }
134
+ }
135
+ });
136
+ return result;
137
+ }
138
+
139
+ function decodeEscapeSequence(str, base) {
140
+ base = base || 16;
141
+ return str.replace(/\\x([0-9A-Fa-f]{2})/g, function () {
142
+ return String.fromCharCode(parseInt(arguments[1], base));
143
+ });
144
+ }
145
+
146
+ function detectSplit(str) {
147
+ let seperator = '';
148
+ let part = 0;
149
+ str.split('').forEach(element => {
150
+ if (element >= '0' && element <= '9') {
151
+ if (part === 1) { part++; }
152
+ } else {
153
+ if (part === 0) { part++; }
154
+ if (part === 1) {
155
+ seperator += element;
156
+ }
157
+ }
158
+ });
159
+ return seperator;
160
+ }
161
+
162
+ function parseTime(t, pmDesignator) {
163
+ pmDesignator = pmDesignator || '';
164
+ t = t.toUpperCase();
165
+ let hour = 0;
166
+ let min = 0;
167
+ let splitter = detectSplit(t);
168
+ let parts = t.split(splitter);
169
+ if (parts.length >= 2) {
170
+ if (parts[2]) {
171
+ parts[1] += parts[2];
172
+ }
173
+ let isPM = (parts[1] && (parts[1].toLowerCase().indexOf('pm') > -1) || (parts[1].toLowerCase().indexOf('p.m.') > -1) || (parts[1].toLowerCase().indexOf('p. m.') > -1) || (parts[1].toLowerCase().indexOf('n') > -1) || (parts[1].toLowerCase().indexOf('ch') > -1) || (parts[1].toLowerCase().indexOf('ös') > -1) || (pmDesignator && parts[1].toLowerCase().indexOf(pmDesignator) > -1));
174
+ hour = parseInt(parts[0], 10);
175
+ min = parseInt(parts[1], 10);
176
+ hour = isPM && hour < 12 ? hour + 12 : hour;
177
+ return ('0' + hour).substr(-2) + ':' + ('0' + min).substr(-2);
178
+ }
179
+ }
180
+
181
+ function parseDateTime(dt, culture) {
182
+ const result = {
183
+ date: '',
184
+ time: ''
185
+ };
186
+ culture = culture || {};
187
+ let dateFormat = (culture.dateFormat || '').toLowerCase();
188
+ let pmDesignator = (culture.pmDesignator || '');
189
+
190
+ const parts = dt.split(' ');
191
+ if (parts[0]) {
192
+ if (parts[0].indexOf('/') >= 0) {
193
+ // Dateformat: mm/dd/yyyy or dd/mm/yyyy or dd/mm/yy or yyyy/mm/dd
194
+ const dtparts = parts[0].split('/');
195
+ if (dtparts.length === 3) {
196
+ if (dtparts[0].length === 4) {
197
+ // Dateformat: yyyy/mm/dd
198
+ result.date = dtparts[0] + '-' + ('0' + dtparts[1]).substr(-2) + '-' + ('0' + dtparts[2]).substr(-2);
199
+ } else if (dtparts[2].length === 2) {
200
+ if ((dateFormat.indexOf('/d/') > -1 || dateFormat.indexOf('/dd/') > -1)) {
201
+ // Dateformat: mm/dd/yy
202
+ result.date = '20' + dtparts[2] + '-' + ('0' + dtparts[1]).substr(-2) + '-' + ('0' + dtparts[0]).substr(-2);
203
+ } else {
204
+ // Dateformat: dd/mm/yy
205
+ result.date = '20' + dtparts[2] + '-' + ('0' + dtparts[1]).substr(-2) + '-' + ('0' + dtparts[0]).substr(-2);
206
+ }
207
+ } else {
208
+ // Dateformat: mm/dd/yyyy or dd/mm/yyyy
209
+ const isEN = ((dt.toLowerCase().indexOf('pm') > -1) || (dt.toLowerCase().indexOf('p.m.') > -1) || (dt.toLowerCase().indexOf('p. m.') > -1) || (dt.toLowerCase().indexOf('am') > -1) || (dt.toLowerCase().indexOf('a.m.') > -1) || (dt.toLowerCase().indexOf('a. m.') > -1));
210
+ if ((isEN || dateFormat.indexOf('/d/') > -1 || dateFormat.indexOf('/dd/') > -1) && dateFormat.indexOf('dd/') !== 0) {
211
+ // Dateformat: mm/dd/yyyy
212
+ result.date = dtparts[2] + '-' + ('0' + dtparts[0]).substr(-2) + '-' + ('0' + dtparts[1]).substr(-2);
213
+ } else {
214
+ // Dateformat: dd/mm/yyyy
215
+ result.date = dtparts[2] + '-' + ('0' + dtparts[1]).substr(-2) + '-' + ('0' + dtparts[0]).substr(-2);
216
+ }
217
+ }
218
+ }
219
+ }
220
+ if (parts[0].indexOf('.') >= 0) {
221
+ const dtparts = parts[0].split('.');
222
+ if (dtparts.length === 3) {
223
+ if (dateFormat.indexOf('.d.') > -1 || dateFormat.indexOf('.dd.') > -1) {
224
+ // Dateformat: mm.dd.yyyy
225
+ result.date = dtparts[2] + '-' + ('0' + dtparts[0]).substr(-2) + '-' + ('0' + dtparts[1]).substr(-2);
226
+ } else {
227
+ // Dateformat: dd.mm.yyyy
228
+ result.date = dtparts[2] + '-' + ('0' + dtparts[1]).substr(-2) + '-' + ('0' + dtparts[0]).substr(-2);
229
+ }
230
+ }
231
+ }
232
+ if (parts[0].indexOf('-') >= 0) {
233
+ // Dateformat: yyyy-mm-dd
234
+ const dtparts = parts[0].split('-');
235
+ if (dtparts.length === 3) {
236
+ result.date = dtparts[0] + '-' + ('0' + dtparts[1]).substr(-2) + '-' + ('0' + dtparts[2]).substr(-2);
237
+ }
238
+ }
239
+ }
240
+ if (parts[1]) {
241
+ parts.shift();
242
+ let time = parts.join(' ');
243
+ result.time = parseTime(time, pmDesignator);
244
+ }
245
+ return result;
246
+ }
247
+
248
+ function parseHead(head, rights) {
249
+ let space = (rights > 0);
250
+ let count = 1;
251
+ let from = 0;
252
+ let to = 0;
253
+ let result = [];
254
+ for (let i = 0; i < head.length; i++) {
255
+ if (count <= rights) {
256
+ if (/\s/.test(head[i]) && !space) {
257
+ to = i - 1;
258
+ result.push({
259
+ from: from,
260
+ to: to + 1,
261
+ cap: head.substring(from, to + 1)
262
+ });
263
+ from = to + 2;
264
+ count++;
265
+ }
266
+ space = head[i] === ' ';
267
+ } else {
268
+ if (!/\s/.test(head[i]) && space) {
269
+ to = i - 1;
270
+ if (from < to) {
271
+ result.push({
272
+ from: from,
273
+ to: to,
274
+ cap: head.substring(from, to)
275
+ });
276
+ }
277
+ from = to + 1;
278
+ count++;
279
+ }
280
+ space = head[i] === ' ';
281
+ }
282
+ }
283
+ to = 5000;
284
+ result.push({
285
+ from: from,
286
+ to: to,
287
+ cap: head.substring(from, to)
288
+ });
289
+ let len = result.length;
290
+ for (let i = 0; i < len; i++) {
291
+ if (result[i].cap.replace(/\s/g, '').length === 0) {
292
+ if (i + 1 < len) {
293
+ result[i].to = result[i + 1].to;
294
+ result[i].cap = result[i].cap + result[i + 1].cap;
295
+ result.splice(i + 1, 1);
296
+ len = len - 1;
297
+ }
298
+ }
299
+ }
300
+ return result;
301
+ }
302
+
303
+ function findObjectByKey(array, key, value) {
304
+ for (let i = 0; i < array.length; i++) {
305
+ if (array[i][key] === value) {
306
+ return i;
307
+ }
308
+ }
309
+ return -1;
310
+ }
311
+
312
+ function getWmic() {
313
+ if (os.type() === 'Windows_NT' && !wmicPath) {
314
+ wmicPath = WINDIR + '\\system32\\wbem\\wmic.exe';
315
+ if (!fs.existsSync(wmicPath)) {
316
+ try {
317
+ const wmicPathArray = execSync('WHERE WMIC', execOptsWin).toString().split('\r\n');
318
+ if (wmicPathArray && wmicPathArray.length) {
319
+ wmicPath = wmicPathArray[0];
320
+ } else {
321
+ wmicPath = 'wmic';
322
+ }
323
+ } catch (e) {
324
+ wmicPath = 'wmic';
325
+ }
326
+ }
327
+ }
328
+ return wmicPath;
329
+ }
330
+
331
+ function wmic(command) {
332
+ return new Promise((resolve) => {
333
+ process.nextTick(() => {
334
+ try {
335
+ powerShell(getWmic() + ' ' + command).then(stdout => {
336
+ resolve(stdout, '');
337
+ });
338
+ } catch (e) {
339
+ resolve('', e);
340
+ }
341
+ });
342
+ });
343
+ }
344
+
345
+ function getVboxmanage() {
346
+ return _windows ? `"${process.env.VBOX_INSTALL_PATH || process.env.VBOX_MSI_INSTALL_PATH}\\VBoxManage.exe"` : 'vboxmanage';
347
+ }
348
+
349
+ function powerShellProceedResults(data) {
350
+ let id = '';
351
+ let parts;
352
+ let res = '';
353
+ // startID
354
+ if (data.indexOf(_psCmdStart) >= 0) {
355
+ parts = data.split(_psCmdStart);
356
+ const parts2 = parts[1].split(_psIdSeperator);
357
+ id = parts2[0];
358
+ if (parts2.length > 1) {
359
+ data = parts2.slice(1).join(_psIdSeperator);
360
+ }
361
+ }
362
+ // result;
363
+ if (data.indexOf(_psCmdSeperator) >= 0) {
364
+ parts = data.split(_psCmdSeperator);
365
+ res = parts[0];
366
+ }
367
+ let remove = -1;
368
+ for (let i = 0; i < _psCmds.length; i++) {
369
+ if (_psCmds[i].id === id) {
370
+ remove = i;
371
+ _psCmds[i].callback(res);
372
+ }
373
+ }
374
+ if (remove >= 0) {
375
+ _psCmds.splice(remove, 1);
376
+ }
377
+ }
378
+
379
+ function powerShellStart() {
380
+ if (!_psChild) {
381
+ _psChild = spawn('powershell.exe', ['-NoProfile', '-NoLogo', '-InputFormat', 'Text', '-NoExit', '-Command', '-'], {
382
+ stdio: 'pipe',
383
+ windowsHide: true,
384
+ maxBuffer: 1024 * 20000,
385
+ encoding: 'UTF-8',
386
+ env: util._extend({}, process.env, { LANG: 'en_US.UTF-8' })
387
+ });
388
+ if (_psChild && _psChild.pid) {
389
+ _psPersistent = true;
390
+ _psChild.stdout.on('data', function (data) {
391
+ _psResult = _psResult + data.toString('utf8');
392
+ if (data.indexOf(_psCmdSeperator) >= 0) {
393
+ powerShellProceedResults(_psResult);
394
+ _psResult = '';
395
+ }
396
+ });
397
+ _psChild.stderr.on('data', function () {
398
+ powerShellProceedResults(_psResult + _psError);
399
+ });
400
+ _psChild.on('error', function () {
401
+ powerShellProceedResults(_psResult + _psError);
402
+ });
403
+ _psChild.on('close', function () {
404
+ _psChild.kill();
405
+ });
406
+ }
407
+ }
408
+ }
409
+
410
+ function powerShellRelease() {
411
+ try {
412
+ if (_psChild) {
413
+ _psChild.stdin.write('exit' + os.EOL);
414
+ _psChild.stdin.end();
415
+ _psPersistent = false;
416
+ }
417
+ } catch (e) {
418
+ if (_psChild) { _psChild.kill(); }
419
+ }
420
+ _psChild = null;
421
+ }
422
+
423
+ function powerShell(cmd) {
424
+
425
+ if (_psPersistent) {
426
+ const id = Math.random().toString(36).substring(2, 12);
427
+ return new Promise((resolve) => {
428
+ process.nextTick(() => {
429
+ function callback(data) {
430
+ resolve(data);
431
+ }
432
+ _psCmds.push({
433
+ id,
434
+ cmd,
435
+ callback,
436
+ start: new Date()
437
+ });
438
+ try {
439
+ if (_psChild && _psChild.pid) {
440
+ _psChild.stdin.write(_psToUTF8 + 'echo ' + _psCmdStart + id + _psIdSeperator + '; ' + os.EOL + cmd + os.EOL + 'echo ' + _psCmdSeperator + os.EOL);
441
+ }
442
+ } catch (e) {
443
+ resolve('');
444
+ }
445
+ });
446
+ });
447
+
448
+ } else {
449
+ let result = '';
450
+
451
+ return new Promise((resolve) => {
452
+ process.nextTick(() => {
453
+ try {
454
+ const child = spawn('powershell.exe', ['-NoProfile', '-NoLogo', '-InputFormat', 'Text', '-NoExit', '-ExecutionPolicy', 'Unrestricted', '-Command', '-'], {
455
+ stdio: 'pipe',
456
+ windowsHide: true,
457
+ maxBuffer: 1024 * 20000,
458
+ encoding: 'UTF-8',
459
+ env: util._extend({}, process.env, { LANG: 'en_US.UTF-8' })
460
+ });
461
+
462
+ if (child && !child.pid) {
463
+ child.on('error', function () {
464
+ resolve(result);
465
+ });
466
+ }
467
+ if (child && child.pid) {
468
+ child.stdout.on('data', function (data) {
469
+ result = result + data.toString('utf8');
470
+ });
471
+ child.stderr.on('data', function () {
472
+ child.kill();
473
+ resolve(result);
474
+ });
475
+ child.on('close', function () {
476
+ child.kill();
477
+
478
+ resolve(result);
479
+ });
480
+ child.on('error', function () {
481
+ child.kill();
482
+ resolve(result);
483
+ });
484
+ try {
485
+ child.stdin.write(_psToUTF8 + cmd + os.EOL);
486
+ child.stdin.write('exit' + os.EOL);
487
+ child.stdin.end();
488
+ } catch (e) {
489
+ child.kill();
490
+ resolve(result);
491
+ }
492
+ } else {
493
+ resolve(result);
494
+ }
495
+ } catch (e) {
496
+ resolve(result);
497
+ }
498
+ });
499
+ });
500
+ }
501
+ }
502
+
503
+ function execSafe(cmd, args, options) {
504
+ let result = '';
505
+ options = options || {};
506
+
507
+ return new Promise((resolve) => {
508
+ process.nextTick(() => {
509
+ try {
510
+ const child = spawn(cmd, args, options);
511
+
512
+ if (child && !child.pid) {
513
+ child.on('error', function () {
514
+ resolve(result);
515
+ });
516
+ }
517
+ if (child && child.pid) {
518
+ child.stdout.on('data', function (data) {
519
+ result += data.toString();
520
+ });
521
+ child.on('close', function () {
522
+ child.kill();
523
+ resolve(result);
524
+ });
525
+ child.on('error', function () {
526
+ child.kill();
527
+ resolve(result);
528
+ });
529
+ } else {
530
+ resolve(result);
531
+ }
532
+ } catch (e) {
533
+ resolve(result);
534
+ }
535
+ });
536
+ });
537
+ }
538
+
539
+ function getCodepage() {
540
+ if (_windows) {
541
+ if (!codepage) {
542
+ try {
543
+ const stdout = execSync('chcp', execOptsWin);
544
+ const lines = stdout.toString().split('\r\n');
545
+ const parts = lines[0].split(':');
546
+ codepage = parts.length > 1 ? parts[1].replace('.', '').trim() : '';
547
+ } catch (err) {
548
+ codepage = '437';
549
+ }
550
+ }
551
+ return codepage;
552
+ }
553
+ if (_linux || _darwin || _freebsd || _openbsd || _netbsd) {
554
+ if (!codepage) {
555
+ try {
556
+ const stdout = execSync('echo $LANG');
557
+ const lines = stdout.toString().split('\r\n');
558
+ const parts = lines[0].split('.');
559
+ codepage = parts.length > 1 ? parts[1].trim() : '';
560
+ if (!codepage) {
561
+ codepage = 'UTF-8';
562
+ }
563
+ } catch (err) {
564
+ codepage = 'UTF-8';
565
+ }
566
+ }
567
+ return codepage;
568
+ }
569
+ }
570
+
571
+ function smartMonToolsInstalled() {
572
+ if (_smartMonToolsInstalled !== null) {
573
+ return _smartMonToolsInstalled;
574
+ }
575
+ _smartMonToolsInstalled = false;
576
+ if (_windows) {
577
+ try {
578
+ const pathArray = execSync('WHERE smartctl 2>nul', execOptsWin).toString().split('\r\n');
579
+ if (pathArray && pathArray.length) {
580
+ _smartMonToolsInstalled = pathArray[0].indexOf(':\\') >= 0;
581
+ } else {
582
+ _smartMonToolsInstalled = false;
583
+ }
584
+ } catch (e) {
585
+ _smartMonToolsInstalled = false;
586
+ }
587
+ }
588
+ if (_linux || _darwin || _freebsd || _openbsd || _netbsd) {
589
+ const pathArray = execSync('which smartctl 2>/dev/null', execOptsWin).toString().split('\r\n');
590
+ _smartMonToolsInstalled = pathArray.length > 0;
591
+ }
592
+ return _smartMonToolsInstalled;
593
+ }
594
+
595
+ function isRaspberry() {
596
+ const PI_MODEL_NO = [
597
+ 'BCM2708',
598
+ 'BCM2709',
599
+ 'BCM2710',
600
+ 'BCM2711',
601
+ 'BCM2835',
602
+ 'BCM2836',
603
+ 'BCM2837',
604
+ 'BCM2837B0'
605
+ ];
606
+ let cpuinfo = [];
607
+ try {
608
+ cpuinfo = fs.readFileSync('/proc/cpuinfo', { encoding: 'utf8' }).toString().split('\n');
609
+ } catch (e) {
610
+ return false;
611
+ }
612
+ const hardware = getValue(cpuinfo, 'hardware');
613
+ return (hardware && PI_MODEL_NO.indexOf(hardware) > -1);
614
+ }
615
+
616
+ function isRaspbian() {
617
+ let osrelease = [];
618
+ try {
619
+ osrelease = fs.readFileSync('/etc/os-release', { encoding: 'utf8' }).toString().split('\n');
620
+ } catch (e) {
621
+ return false;
622
+ }
623
+ const id = getValue(osrelease, 'id', '=');
624
+ return (id && id.indexOf('raspbian') > -1);
625
+ }
626
+
627
+ function execWin(cmd, opts, callback) {
628
+ if (!callback) {
629
+ callback = opts;
630
+ opts = execOptsWin;
631
+ }
632
+ let newCmd = 'chcp 65001 > nul && cmd /C ' + cmd + ' && chcp ' + codepage + ' > nul';
633
+ exec(newCmd, opts, function (error, stdout) {
634
+ callback(error, stdout);
635
+ });
636
+ }
637
+
638
+ function darwinXcodeExists() {
639
+ const cmdLineToolsExists = fs.existsSync('/Library/Developer/CommandLineTools/usr/bin/');
640
+ const xcodeAppExists = fs.existsSync('/Applications/Xcode.app/Contents/Developer/Tools');
641
+ const xcodeExists = fs.existsSync('/Library/Developer/Xcode/');
642
+ return (cmdLineToolsExists || xcodeExists || xcodeAppExists);
643
+ }
644
+
645
+ function nanoSeconds() {
646
+ const time = process.hrtime();
647
+ if (!Array.isArray(time) || time.length !== 2) {
648
+ return 0;
649
+ }
650
+ return +time[0] * 1e9 + +time[1];
651
+ }
652
+
653
+ function countUniqueLines(lines, startingWith) {
654
+ startingWith = startingWith || '';
655
+ const uniqueLines = [];
656
+ lines.forEach(line => {
657
+ if (line.startsWith(startingWith)) {
658
+ if (uniqueLines.indexOf(line) === -1) {
659
+ uniqueLines.push(line);
660
+ }
661
+ }
662
+ });
663
+ return uniqueLines.length;
664
+ }
665
+
666
+ function countLines(lines, startingWith) {
667
+ startingWith = startingWith || '';
668
+ const uniqueLines = [];
669
+ lines.forEach(line => {
670
+ if (line.startsWith(startingWith)) {
671
+ uniqueLines.push(line);
672
+ }
673
+ });
674
+ return uniqueLines.length;
675
+ }
676
+
677
+ function sanitizeShellString(str, strict) {
678
+ if (typeof strict === 'undefined') { strict = false; }
679
+ const s = str || '';
680
+ let result = '';
681
+ for (let i = 0; i <= mathMin(s.length, 2000); i++) {
682
+ if (!(s[i] === undefined ||
683
+ s[i] === '>' ||
684
+ s[i] === '<' ||
685
+ s[i] === '*' ||
686
+ s[i] === '?' ||
687
+ s[i] === '[' ||
688
+ s[i] === ']' ||
689
+ s[i] === '|' ||
690
+ s[i] === '˚' ||
691
+ s[i] === '$' ||
692
+ s[i] === ';' ||
693
+ s[i] === '&' ||
694
+ s[i] === '(' ||
695
+ s[i] === ')' ||
696
+ s[i] === ']' ||
697
+ s[i] === '#' ||
698
+ s[i] === '\\' ||
699
+ s[i] === '\t' ||
700
+ s[i] === '\n' ||
701
+ s[i] === '\'' ||
702
+ s[i] === '`' ||
703
+ s[i] === '"' ||
704
+ s[i].length > 1 ||
705
+ (strict && s[i] === '@') ||
706
+ (strict && s[i] === ' ') ||
707
+ (strict && s[i] == '{') ||
708
+ (strict && s[i] == ')'))) {
709
+ result = result + s[i];
710
+ }
711
+ }
712
+ return result;
713
+ }
714
+
715
+ function isPrototypePolluted() {
716
+ const s = '1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
717
+ let notPolluted = true;
718
+ let st = '';
719
+
720
+ st.__proto__.replace = stringReplace;
721
+ st.__proto__.toLowerCase = stringToLower;
722
+ st.__proto__.toString = stringToString;
723
+ st.__proto__.substr = stringSubstr;
724
+
725
+ notPolluted = notPolluted || (s.length !== 62);
726
+ const ms = Date.now();
727
+ if (typeof ms === 'number' && ms > 1600000000000) {
728
+ const l = ms % 100 + 15;
729
+ for (let i = 0; i < l; i++) {
730
+ const r = Math.random() * 61.99999999 + 1;
731
+ const rs = parseInt(Math.floor(r).toString(), 10);
732
+ const rs2 = parseInt(r.toString().split('.')[0], 10);
733
+ const q = Math.random() * 61.99999999 + 1;
734
+ const qs = parseInt(Math.floor(q).toString(), 10);
735
+ const qs2 = parseInt(q.toString().split('.')[0], 10);
736
+ notPolluted = notPolluted && (r !== q);
737
+ notPolluted = notPolluted && rs === rs2 && qs === qs2;
738
+ st += s[rs - 1];
739
+ }
740
+ notPolluted = notPolluted && st.length === l;
741
+ // string manipulation
742
+ let p = Math.random() * l * 0.9999999999;
743
+ let stm = st.substr(0, p) + ' ' + st.substr(p, 2000);
744
+ stm.__proto__.replace = stringReplace;
745
+ let sto = stm.replace(/ /g, '');
746
+ notPolluted = notPolluted && st === sto;
747
+ p = Math.random() * l * 0.9999999999;
748
+ stm = st.substr(0, p) + '{' + st.substr(p, 2000);
749
+ sto = stm.replace(/{/g, '');
750
+ notPolluted = notPolluted && st === sto;
751
+ p = Math.random() * l * 0.9999999999;
752
+ stm = st.substr(0, p) + '*' + st.substr(p, 2000);
753
+ sto = stm.replace(/\*/g, '');
754
+ notPolluted = notPolluted && st === sto;
755
+ p = Math.random() * l * 0.9999999999;
756
+ stm = st.substr(0, p) + '$' + st.substr(p, 2000);
757
+ sto = stm.replace(/\$/g, '');
758
+ notPolluted = notPolluted && st === sto;
759
+
760
+ // lower
761
+ const stl = st.toLowerCase();
762
+ notPolluted = notPolluted && (stl.length === l) && stl[l - 1] && !(stl[l]);
763
+ for (let i = 0; i < l; i++) {
764
+ const s1 = st[i];
765
+ s1.__proto__.toLowerCase = stringToLower;
766
+ const s2 = stl ? stl[i] : '';
767
+ const s1l = s1.toLowerCase();
768
+ notPolluted = notPolluted && s1l[0] === s2 && s1l[0] && !(s1l[1]);
769
+ }
770
+ }
771
+ return !notPolluted;
772
+ }
773
+
774
+ function hex2bin(hex) {
775
+ return ('00000000' + (parseInt(hex, 16)).toString(2)).substr(-8);
776
+ }
777
+
778
+ function getFilesInPath(source) {
779
+ const lstatSync = fs.lstatSync;
780
+ const readdirSync = fs.readdirSync;
781
+ const join = path.join;
782
+
783
+ function isDirectory(source) {
784
+ return lstatSync(source).isDirectory();
785
+ }
786
+ function isFile(source) { return lstatSync(source).isFile(); }
787
+
788
+ function getDirectories(source) {
789
+ return readdirSync(source).map(function (name) { return join(source, name); }).filter(isDirectory);
790
+ }
791
+ function getFiles(source) {
792
+ return readdirSync(source).map(function (name) { return join(source, name); }).filter(isFile);
793
+ }
794
+
795
+ function getFilesRecursively(source) {
796
+ try {
797
+ let dirs = getDirectories(source);
798
+ let files = dirs
799
+ .map(function (dir) { return getFilesRecursively(dir); })
800
+ .reduce(function (a, b) { return a.concat(b); }, []);
801
+ return files.concat(getFiles(source));
802
+ } catch (e) {
803
+ return [];
804
+ }
805
+ }
806
+
807
+ if (fs.existsSync(source)) {
808
+ return getFilesRecursively(source);
809
+ } else {
810
+ return [];
811
+ }
812
+ }
813
+
814
+ function decodePiCpuinfo(lines) {
815
+
816
+ // https://www.raspberrypi.org/documentation/hardware/raspberrypi/revision-codes/README.md
817
+
818
+ const oldRevisionCodes = {
819
+ '0002': {
820
+ type: 'B',
821
+ revision: '1.0',
822
+ memory: 256,
823
+ manufacturer: 'Egoman',
824
+ processor: 'BCM2835'
825
+ },
826
+ '0003': {
827
+ type: 'B',
828
+ revision: '1.0',
829
+ memory: 256,
830
+ manufacturer: 'Egoman',
831
+ processor: 'BCM2835'
832
+ },
833
+ '0004': {
834
+ type: 'B',
835
+ revision: '2.0',
836
+ memory: 256,
837
+ manufacturer: 'Sony UK',
838
+ processor: 'BCM2835'
839
+ },
840
+ '0005': {
841
+ type: 'B',
842
+ revision: '2.0',
843
+ memory: 256,
844
+ manufacturer: 'Qisda',
845
+ processor: 'BCM2835'
846
+ },
847
+ '0006': {
848
+ type: 'B',
849
+ revision: '2.0',
850
+ memory: 256,
851
+ manufacturer: 'Egoman',
852
+ processor: 'BCM2835'
853
+ },
854
+ '0007': {
855
+ type: 'A',
856
+ revision: '2.0',
857
+ memory: 256,
858
+ manufacturer: 'Egoman',
859
+ processor: 'BCM2835'
860
+ },
861
+ '0008': {
862
+ type: 'A',
863
+ revision: '2.0',
864
+ memory: 256,
865
+ manufacturer: 'Sony UK',
866
+ processor: 'BCM2835'
867
+ },
868
+ '0009': {
869
+ type: 'A',
870
+ revision: '2.0',
871
+ memory: 256,
872
+ manufacturer: 'Qisda',
873
+ processor: 'BCM2835'
874
+ },
875
+ '000d': {
876
+ type: 'B',
877
+ revision: '2.0',
878
+ memory: 512,
879
+ manufacturer: 'Egoman',
880
+ processor: 'BCM2835'
881
+ },
882
+ '000e': {
883
+ type: 'B',
884
+ revision: '2.0',
885
+ memory: 512,
886
+ manufacturer: 'Sony UK',
887
+ processor: 'BCM2835'
888
+ },
889
+ '000f': {
890
+ type: 'B',
891
+ revision: '2.0',
892
+ memory: 512,
893
+ manufacturer: 'Egoman',
894
+ processor: 'BCM2835'
895
+ },
896
+ '0010': {
897
+ type: 'B+',
898
+ revision: '1.2',
899
+ memory: 512,
900
+ manufacturer: 'Sony UK',
901
+ processor: 'BCM2835'
902
+ },
903
+ '0011': {
904
+ type: 'CM1',
905
+ revision: '1.0',
906
+ memory: 512,
907
+ manufacturer: 'Sony UK',
908
+ processor: 'BCM2835'
909
+ },
910
+ '0012': {
911
+ type: 'A+',
912
+ revision: '1.1',
913
+ memory: 256,
914
+ manufacturer: 'Sony UK',
915
+ processor: 'BCM2835'
916
+ },
917
+ '0013': {
918
+ type: 'B+',
919
+ revision: '1.2',
920
+ memory: 512,
921
+ manufacturer: 'Embest',
922
+ processor: 'BCM2835'
923
+ },
924
+ '0014': {
925
+ type: 'CM1',
926
+ revision: '1.0',
927
+ memory: 512,
928
+ manufacturer: 'Embest',
929
+ processor: 'BCM2835'
930
+ },
931
+ '0015': {
932
+ type: 'A+',
933
+ revision: '1.1',
934
+ memory: 256,
935
+ manufacturer: '512MB Embest',
936
+ processor: 'BCM2835'
937
+ }
938
+ };
939
+
940
+ const processorList = [
941
+ 'BCM2835',
942
+ 'BCM2836',
943
+ 'BCM2837',
944
+ 'BCM2711',
945
+ ];
946
+ const manufacturerList = [
947
+ 'Sony UK',
948
+ 'Egoman',
949
+ 'Embest',
950
+ 'Sony Japan',
951
+ 'Embest',
952
+ 'Stadium'
953
+ ];
954
+ const typeList = {
955
+ '00': 'A',
956
+ '01': 'B',
957
+ '02': 'A+',
958
+ '03': 'B+',
959
+ '04': '2B',
960
+ '05': 'Alpha (early prototype)',
961
+ '06': 'CM1',
962
+ '08': '3B',
963
+ '09': 'Zero',
964
+ '0a': 'CM3',
965
+ '0c': 'Zero W',
966
+ '0d': '3B+',
967
+ '0e': '3A+',
968
+ '0f': 'Internal use only',
969
+ '10': 'CM3+',
970
+ '11': '4B',
971
+ '12': 'Zero 2 W',
972
+ '13': '400',
973
+ '14': 'CM4'
974
+ };
975
+
976
+ const revisionCode = getValue(lines, 'revision', ':', true);
977
+ const model = getValue(lines, 'model:', ':', true);
978
+ const serial = getValue(lines, 'serial', ':', true);
979
+
980
+ let result = {};
981
+ if ({}.hasOwnProperty.call(oldRevisionCodes, revisionCode)) {
982
+ // old revision codes
983
+ result = {
984
+ model,
985
+ serial,
986
+ revisionCode,
987
+ memory: oldRevisionCodes[revisionCode].memory,
988
+ manufacturer: oldRevisionCodes[revisionCode].manufacturer,
989
+ processor: oldRevisionCodes[revisionCode].processor,
990
+ type: oldRevisionCodes[revisionCode].type,
991
+ revision: oldRevisionCodes[revisionCode].revision,
992
+ };
993
+
994
+ } else {
995
+ // new revision code
996
+ const revision = ('00000000' + getValue(lines, 'revision', ':', true).toLowerCase()).substr(-8);
997
+ const memSizeCode = parseInt(hex2bin(revision.substr(2, 1)).substr(5, 3), 2) || 0;
998
+ const manufacturer = manufacturerList[parseInt(revision.substr(3, 1), 10)];
999
+ const processor = processorList[parseInt(revision.substr(4, 1), 10)];
1000
+ const typeCode = revision.substr(5, 2);
1001
+
1002
+
1003
+ result = {
1004
+ model,
1005
+ serial,
1006
+ revisionCode,
1007
+ memory: 256 * Math.pow(2, memSizeCode),
1008
+ manufacturer,
1009
+ processor,
1010
+ type: {}.hasOwnProperty.call(typeList, typeCode) ? typeList[typeCode] : '',
1011
+ revision: '1.' + revision.substr(7, 1),
1012
+ };
1013
+ }
1014
+ return result;
1015
+ }
1016
+
1017
+ function promiseAll(promises) {
1018
+ const resolvingPromises = promises.map(function (promise) {
1019
+ return new Promise(function (resolve) {
1020
+ let payload = new Array(2);
1021
+ promise.then(function (result) {
1022
+ payload[0] = result;
1023
+ })
1024
+ .catch(function (error) {
1025
+ payload[1] = error;
1026
+ })
1027
+ .then(function () {
1028
+ // The wrapped Promise returns an array: 0 = result, 1 = error ... we resolve all
1029
+ resolve(payload);
1030
+ });
1031
+ });
1032
+ });
1033
+ const errors = [];
1034
+ const results = [];
1035
+
1036
+ // Execute all wrapped Promises
1037
+ return Promise.all(resolvingPromises)
1038
+ .then(function (items) {
1039
+ items.forEach(function (payload) {
1040
+ if (payload[1]) {
1041
+ errors.push(payload[1]);
1042
+ results.push(null);
1043
+ } else {
1044
+ errors.push(null);
1045
+ results.push(payload[0]);
1046
+ }
1047
+ });
1048
+
1049
+ return {
1050
+ errors: errors,
1051
+ results: results
1052
+ };
1053
+ });
1054
+ }
1055
+
1056
+ function promisify(nodeStyleFunction) {
1057
+ return function () {
1058
+ const args = Array.prototype.slice.call(arguments);
1059
+ return new Promise(function (resolve, reject) {
1060
+ args.push(function (err, data) {
1061
+ if (err) {
1062
+ reject(err);
1063
+ } else {
1064
+ resolve(data);
1065
+ }
1066
+ });
1067
+ nodeStyleFunction.apply(null, args);
1068
+ });
1069
+ };
1070
+ }
1071
+
1072
+ function promisifySave(nodeStyleFunction) {
1073
+ return function () {
1074
+ const args = Array.prototype.slice.call(arguments);
1075
+ return new Promise(function (resolve) {
1076
+ args.push(function (err, data) {
1077
+ resolve(data);
1078
+ });
1079
+ nodeStyleFunction.apply(null, args);
1080
+ });
1081
+ };
1082
+ }
1083
+
1084
+ function linuxVersion() {
1085
+ let result = '';
1086
+ if (_linux) {
1087
+ try {
1088
+ result = execSync('uname -v').toString();
1089
+ } catch (e) {
1090
+ result = '';
1091
+ }
1092
+ }
1093
+ return result;
1094
+ }
1095
+
1096
+ function plistParser(xmlStr) {
1097
+ const tags = ['array', 'dict', 'key', 'string', 'integer', 'date', 'real', 'data', 'boolean', 'arrayEmpty'];
1098
+ const startStr = '<plist version';
1099
+
1100
+ let pos = xmlStr.indexOf(startStr);
1101
+ let len = xmlStr.length;
1102
+ while (xmlStr[pos] !== '>' && pos < len) {
1103
+ pos++;
1104
+ }
1105
+
1106
+ let depth = 0;
1107
+ let inTagStart = false;
1108
+ let inTagContent = false;
1109
+ let inTagEnd = false;
1110
+ let metaData = [{ tagStart: '', tagEnd: '', tagContent: '', key: '', data: null }];
1111
+ let c = '';
1112
+ let cn = xmlStr[pos];
1113
+
1114
+ while (pos < len) {
1115
+ c = cn;
1116
+ if (pos + 1 < len) { cn = xmlStr[pos + 1]; }
1117
+ if (c === '<') {
1118
+ inTagContent = false;
1119
+ if (cn === '/') { inTagEnd = true; }
1120
+ else if (metaData[depth].tagStart) {
1121
+ metaData[depth].tagContent = '';
1122
+ if (!metaData[depth].data) { metaData[depth].data = metaData[depth].tagStart === 'array' ? [] : {}; }
1123
+ depth++;
1124
+ metaData.push({ tagStart: '', tagEnd: '', tagContent: '', key: null, data: null });
1125
+ inTagStart = true;
1126
+ inTagContent = false;
1127
+ }
1128
+ else if (!inTagStart) { inTagStart = true; }
1129
+ } else if (c === '>') {
1130
+ if (metaData[depth].tagStart === 'true/') { inTagStart = false; inTagEnd = true; metaData[depth].tagStart = ''; metaData[depth].tagEnd = '/boolean'; metaData[depth].data = true; }
1131
+ if (metaData[depth].tagStart === 'false/') { inTagStart = false; inTagEnd = true; metaData[depth].tagStart = ''; metaData[depth].tagEnd = '/boolean'; metaData[depth].data = false; }
1132
+ if (metaData[depth].tagStart === 'array/') { inTagStart = false; inTagEnd = true; metaData[depth].tagStart = ''; metaData[depth].tagEnd = '/arrayEmpty'; metaData[depth].data = []; }
1133
+ if (inTagContent) { inTagContent = false; }
1134
+ if (inTagStart) {
1135
+ inTagStart = false;
1136
+ inTagContent = true;
1137
+ if (metaData[depth].tagStart === 'array') {
1138
+ metaData[depth].data = [];
1139
+ }
1140
+ if (metaData[depth].tagStart === 'dict') {
1141
+ metaData[depth].data = {};
1142
+ }
1143
+ }
1144
+ if (inTagEnd) {
1145
+ inTagEnd = false;
1146
+ if (metaData[depth].tagEnd && tags.indexOf(metaData[depth].tagEnd.substr(1)) >= 0) {
1147
+ if (metaData[depth].tagEnd === '/dict' || metaData[depth].tagEnd === '/array') {
1148
+ if (depth > 1 && metaData[depth - 2].tagStart === 'array') {
1149
+ metaData[depth - 2].data.push(metaData[depth - 1].data);
1150
+ }
1151
+ if (depth > 1 && metaData[depth - 2].tagStart === 'dict') {
1152
+ metaData[depth - 2].data[metaData[depth - 1].key] = metaData[depth - 1].data;
1153
+ }
1154
+ depth--;
1155
+ metaData.pop();
1156
+ metaData[depth].tagContent = '';
1157
+ metaData[depth].tagStart = '';
1158
+ metaData[depth].tagEnd = '';
1159
+ }
1160
+ else {
1161
+ if (metaData[depth].tagEnd === '/key' && metaData[depth].tagContent) {
1162
+ metaData[depth].key = metaData[depth].tagContent;
1163
+ } else {
1164
+ if (metaData[depth].tagEnd === '/real' && metaData[depth].tagContent) { metaData[depth].data = parseFloat(metaData[depth].tagContent) || 0; }
1165
+ if (metaData[depth].tagEnd === '/integer' && metaData[depth].tagContent) { metaData[depth].data = parseInt(metaData[depth].tagContent) || 0; }
1166
+ if (metaData[depth].tagEnd === '/string' && metaData[depth].tagContent) { metaData[depth].data = metaData[depth].tagContent || ''; }
1167
+ if (metaData[depth].tagEnd === '/boolean') { metaData[depth].data = metaData[depth].tagContent || false; }
1168
+ if (metaData[depth].tagEnd === '/arrayEmpty') { metaData[depth].data = metaData[depth].tagContent || []; }
1169
+ if (depth > 0 && metaData[depth - 1].tagStart === 'array') { metaData[depth - 1].data.push(metaData[depth].data); }
1170
+ if (depth > 0 && metaData[depth - 1].tagStart === 'dict') { metaData[depth - 1].data[metaData[depth].key] = metaData[depth].data; }
1171
+ }
1172
+ metaData[depth].tagContent = '';
1173
+ metaData[depth].tagStart = '';
1174
+ metaData[depth].tagEnd = '';
1175
+ }
1176
+ }
1177
+ metaData[depth].tagEnd = '';
1178
+ inTagStart = false;
1179
+ inTagContent = false;
1180
+ }
1181
+ } else {
1182
+ if (inTagStart) { metaData[depth].tagStart += c; }
1183
+ if (inTagEnd) { metaData[depth].tagEnd += c; }
1184
+ if (inTagContent) { metaData[depth].tagContent += c; }
1185
+ }
1186
+ pos++;
1187
+ }
1188
+ return metaData[0].data;
1189
+ }
1190
+
1191
+ function strIsNumeric(str) {
1192
+ return typeof str === 'string' && !isNaN(str) && !isNaN(parseFloat(str));
1193
+ }
1194
+
1195
+ function plistReader(output) {
1196
+ const lines = output.split('\n');
1197
+ for (let i = 0; i < lines.length; i++) {
1198
+ if (lines[i].indexOf(' = ') >= 0) {
1199
+ const lineParts = lines[i].split(' = ');
1200
+ lineParts[0] = lineParts[0].trim();
1201
+ if (!lineParts[0].startsWith('"')) {
1202
+ lineParts[0] = '"' + lineParts[0] + '"';
1203
+ }
1204
+ lineParts[1] = lineParts[1].trim();
1205
+ if (lineParts[1].indexOf('"') === -1 && lineParts[1].endsWith(';')) {
1206
+ const valueString = lineParts[1].substring(0, lineParts[1].length - 1);
1207
+ if (!strIsNumeric(valueString)) {
1208
+ lineParts[1] = `"${valueString}";`;
1209
+ }
1210
+ }
1211
+ if (lineParts[1].indexOf('"') >= 0 && lineParts[1].endsWith(';')) {
1212
+ const valueString = lineParts[1].substring(0, lineParts[1].length - 1).replace(/"/g, '');
1213
+ if (strIsNumeric(valueString)) {
1214
+ lineParts[1] = `${valueString};`;
1215
+ }
1216
+ }
1217
+ lines[i] = lineParts.join(' : ');
1218
+ }
1219
+ lines[i] = lines[i].replace(/\(/g, '[').replace(/\)/g, ']').replace(/;/g, ',').trim();
1220
+ if (lines[i].startsWith('}') && lines[i - 1] && lines[i - 1].endsWith(',')) {
1221
+ lines[i - 1] = lines[i - 1].substring(0, lines[i - 1].length - 1);
1222
+ }
1223
+ }
1224
+ output = lines.join('');
1225
+ let obj = {};
1226
+ try {
1227
+ obj = JSON.parse(output);
1228
+ } catch (e) {
1229
+ noop();
1230
+ }
1231
+ return obj;
1232
+ }
1233
+
1234
+ function semverCompare(v1, v2) {
1235
+ let res = 0;
1236
+ const parts1 = v1.split('.');
1237
+ const parts2 = v2.split('.');
1238
+ if (parts1[0] < parts2[0]) { res = 1; }
1239
+ else if (parts1[0] > parts2[0]) { res = -1; }
1240
+ else if (parts1[0] === parts2[0] && parts1.length >= 2 && parts2.length >= 2) {
1241
+ if (parts1[1] < parts2[1]) { res = 1; }
1242
+ else if (parts1[1] > parts2[1]) { res = -1; }
1243
+ else if (parts1[1] === parts2[1]) {
1244
+ if (parts1.length >= 3 && parts2.length >= 3) {
1245
+ if (parts1[2] < parts2[2]) { res = 1; }
1246
+ else if (parts1[2] > parts2[2]) { res = -1; }
1247
+ } else if (parts2.length >= 3) {
1248
+ res = 1;
1249
+ }
1250
+ }
1251
+ }
1252
+ return res;
1253
+ }
1254
+
1255
+ function noop() { }
1256
+
1257
+ exports.toInt = toInt;
1258
+ exports.execOptsWin = execOptsWin;
1259
+ exports.getCodepage = getCodepage;
1260
+ exports.execWin = execWin;
1261
+ exports.isFunction = isFunction;
1262
+ exports.unique = unique;
1263
+ exports.sortByKey = sortByKey;
1264
+ exports.cores = cores;
1265
+ exports.getValue = getValue;
1266
+ exports.decodeEscapeSequence = decodeEscapeSequence;
1267
+ exports.parseDateTime = parseDateTime;
1268
+ exports.parseHead = parseHead;
1269
+ exports.findObjectByKey = findObjectByKey;
1270
+ exports.getWmic = getWmic;
1271
+ exports.wmic = wmic;
1272
+ exports.darwinXcodeExists = darwinXcodeExists;
1273
+ exports.getVboxmanage = getVboxmanage;
1274
+ exports.powerShell = powerShell;
1275
+ exports.powerShellStart = powerShellStart;
1276
+ exports.powerShellRelease = powerShellRelease;
1277
+ exports.execSafe = execSafe;
1278
+ exports.nanoSeconds = nanoSeconds;
1279
+ exports.countUniqueLines = countUniqueLines;
1280
+ exports.countLines = countLines;
1281
+ exports.noop = noop;
1282
+ exports.isRaspberry = isRaspberry;
1283
+ exports.isRaspbian = isRaspbian;
1284
+ exports.sanitizeShellString = sanitizeShellString;
1285
+ exports.isPrototypePolluted = isPrototypePolluted;
1286
+ exports.decodePiCpuinfo = decodePiCpuinfo;
1287
+ exports.promiseAll = promiseAll;
1288
+ exports.promisify = promisify;
1289
+ exports.promisifySave = promisifySave;
1290
+ exports.smartMonToolsInstalled = smartMonToolsInstalled;
1291
+ exports.linuxVersion = linuxVersion;
1292
+ exports.plistParser = plistParser;
1293
+ exports.plistReader = plistReader;
1294
+ exports.stringReplace = stringReplace;
1295
+ exports.stringToLower = stringToLower;
1296
+ exports.stringToString = stringToString;
1297
+ exports.stringSubstr = stringSubstr;
1298
+ exports.stringTrim = stringTrim;
1299
+ exports.stringStartWith = stringStartWith;
1300
+ exports.mathMin = mathMin;
1301
+ exports.WINDIR = WINDIR;
1302
+ exports.getFilesInPath = getFilesInPath;
1303
+ exports.semverCompare = semverCompare;