update systeminformation

This commit is contained in:
yeyang
2023-01-04 21:01:23 +08:00
parent 6eed241a53
commit 88929aa67c
7 changed files with 49 additions and 48 deletions

6
node_modules/.package-lock.json generated vendored
View File

@@ -5,9 +5,9 @@
"requires": true,
"packages": {
"node_modules/systeminformation": {
"version": "5.16.5",
"resolved": "https://registry.npmmirror.com/systeminformation/-/systeminformation-5.16.5.tgz",
"integrity": "sha512-puU4XTFWvyBLOe3CT3ztcJfRmcpjevNHJa4ZVWoRsMnfYqaZkEUeMvidDOeTj7lIEhYOWvVnVjEpSJJ6bc8g3g==",
"version": "5.16.9",
"resolved": "https://registry.npmmirror.com/systeminformation/-/systeminformation-5.16.9.tgz",
"integrity": "sha512-QTlv3GGSromPeLVW3pzM6uxU8RbkacW9e0+ZX23GAXaX+XE0UToSygAxCJDHSty6RB9lAFHCHg+FfiXFChi/+w==",
"os": [
"darwin",
"linux",

View File

@@ -28,6 +28,29 @@
[![Caretaker][caretaker-image]][caretaker-url]
[![MIT license][license-img]][license-url]
## Merry Christmas and Happy new year
```
.''.
.''. . *''* :_\/_:
:_\/_: _\(/_ .:.*_\/_* : /\ :
.''.: /\ : ./)\ ':'* /\ * : '..'.
:_\/_:'.:::. ' *''* * '.\'/.' _\(/_
: /\ : ::::: *_\/_* -= o =- /)\
'..' ':::' * /\ * .'/.\'. '
*..* :
*
* /.\ * * . *
. /..'\ . . * .
*/'.'\* . . . * *
* /.''.'\ * . . . *
. */.'.'.\*
.........".""""/'.''.'.\""."."........".".".......................
^^^[_]^^^*
```
I wish you all a Merry Christmas and a peaceful New Year 2023.
## The Systeminformation Project
This is amazing. Started as a small project just for myself, it now has > 15,000 lines of code, > 500 versions published, up to 5 mio downloads per month, > 100 mio downloads overall. #1 NPM ranking for backend packages. Thank you to all who contributed to this project!
## New Version 5.0

View File

@@ -190,7 +190,7 @@ function printer(callback) {
for (let i = 0; i < parts.length; i++) {
const printer = parseWindowsPrinters(parts[i].split('\n'), i);
if (printer.name || printer.model) {
result.push(parseWindowsPrinters(parts[i].split('\n'), i));
result.push(printer);
}
}
}

View File

@@ -653,12 +653,12 @@ function processes(callback) {
function parseProcesses2(lines) {
function formatDateTime(time) {
const month = ('0' + (time.getMonth() + 1).toString()).substr(-2);
const month = ('0' + (time.getMonth() + 1).toString()).slice(-2);
const year = time.getFullYear().toString();
const day = ('0' + time.getDate().toString()).substr(-2);
const hours = time.getHours().toString();
const mins = time.getMinutes().toString();
const secs = ('0' + time.getSeconds().toString()).substr(-2);
const day = ('0' + time.getDate().toString()).slice(-2);
const hours = ('0' + time.getHours().toString()).slice(-2);
const mins = ('0' + time.getMinutes().toString()).slice(-2);
const secs = ('0' + time.getSeconds().toString()).slice(-2);
return (year + '-' + month + '-' + day + ' ' + hours + ':' + mins + ':' + secs);
}
@@ -847,7 +847,7 @@ function processes(callback) {
let additionalCommand = false;
lines.forEach((line) => {
if (additionalCommand && line.toLowerCase().startsWith(' ')) {
commandLine = commandLine + line.trim();
commandLine += ' ' + line.trim();
} else {
additionalCommand = false;
}

View File

@@ -28,7 +28,6 @@ const _windows = (_platform === 'win32');
const _freebsd = (_platform === 'freebsd');
const _openbsd = (_platform === 'openbsd');
const _netbsd = (_platform === 'netbsd');
// const _sunos = (_platform === 'sunos');
let _cores = 0;
let wmicPath = '';
@@ -281,14 +280,14 @@ function parseHead(head, rights) {
space = head[i] === ' ';
}
}
to = 1000;
to = 5000;
result.push({
from: from,
to: to,
cap: head.substring(from, to)
});
let len = result.length;
for (var i = 0; i < len; i++) {
for (let i = 0; i < len; i++) {
if (result[i].cap.replace(/\s/g, '').length === 0) {
if (i + 1 < len) {
result[i].to = result[i + 1].to;
@@ -343,21 +342,6 @@ function wmic(command) {
});
}
// function wmic(command, options) {
// options = options || execOptsWin;
// return new Promise((resolve) => {
// process.nextTick(() => {
// try {
// exec(WINDIR + '\\system32\\chcp.com 65001 | ' + getWmic() + ' ' + command, options, function (error, stdout) {
// resolve(stdout, error);
// }).stdin.end();
// } catch (e) {
// resolve('', e);
// }
// });
// });
// }
function getVboxmanage() {
return _windows ? `"${process.env.VBOX_INSTALL_PATH || process.env.VBOX_MSI_INSTALL_PATH}\\VBoxManage.exe"` : 'vboxmanage';
}
@@ -384,8 +368,6 @@ function powerShellProceedResults(data) {
for (let i = 0; i < _psCmds.length; i++) {
if (_psCmds[i].id === id) {
remove = i;
// console.log(`----- TIME : ${(new Date() - _psCmds[i].start) * 0.001} s`);
_psCmds[i].callback(res);
}
}
@@ -441,7 +423,7 @@ function powerShellRelease() {
function powerShell(cmd) {
if (_psPersistent) {
const id = Math.random().toString(36).substr(2, 10);
const id = Math.random().toString(36).substring(2, 12);
return new Promise((resolve) => {
process.nextTick(() => {
function callback(data) {
@@ -469,7 +451,6 @@ function powerShell(cmd) {
return new Promise((resolve) => {
process.nextTick(() => {
try {
// const start = new Date();
const child = spawn('powershell.exe', ['-NoLogo', '-InputFormat', 'Text', '-NoExit', '-ExecutionPolicy', 'Unrestricted', '-Command', '-'], {
stdio: 'pipe',
windowsHide: true,
@@ -493,7 +474,6 @@ function powerShell(cmd) {
});
child.on('close', function () {
child.kill();
// console.log(`----- TIME : ${(new Date() - start) * 0.001} s`);
resolve(result);
});
@@ -1014,7 +994,6 @@ function decodePiCpuinfo(lines) {
} else {
// new revision code
const revision = ('00000000' + getValue(lines, 'revision', ':', true).toLowerCase()).substr(-8);
// const revisionStyleNew = hex2bin(revision.substr(2, 1)).substr(4, 1) === '1';
const memSizeCode = parseInt(hex2bin(revision.substr(2, 1)).substr(5, 3), 2) || 0;
const manufacturer = manufacturerList[parseInt(revision.substr(3, 1), 10)];
const processor = processorList[parseInt(revision.substr(4, 1), 10)];
@@ -1038,7 +1017,7 @@ function decodePiCpuinfo(lines) {
function promiseAll(promises) {
const resolvingPromises = promises.map(function (promise) {
return new Promise(function (resolve) {
var payload = new Array(2);
let payload = new Array(2);
promise.then(function (result) {
payload[0] = result;
})
@@ -1051,8 +1030,8 @@ function promiseAll(promises) {
});
});
});
var errors = [];
var results = [];
const errors = [];
const results = [];
// Execute all wrapped Promises
return Promise.all(resolvingPromises)
@@ -1076,7 +1055,7 @@ function promiseAll(promises) {
function promisify(nodeStyleFunction) {
return function () {
var args = Array.prototype.slice.call(arguments);
const args = Array.prototype.slice.call(arguments);
return new Promise(function (resolve, reject) {
args.push(function (err, data) {
if (err) {
@@ -1092,7 +1071,7 @@ function promisify(nodeStyleFunction) {
function promisifySave(nodeStyleFunction) {
return function () {
var args = Array.prototype.slice.call(arguments);
const args = Array.prototype.slice.call(arguments);
return new Promise(function (resolve) {
args.push(function (err, data) {
resolve(data);

View File

@@ -1,6 +1,6 @@
{
"name": "systeminformation",
"version": "5.16.5",
"version": "5.16.9",
"description": "Advanced, lightweight system and OS information library",
"license": "MIT",
"author": "Sebastian Hildebrandt <hildebrandt@plus-innovations.com> (https://plus-innovations.com)",

15
package-lock.json generated
View File

@@ -10,13 +10,12 @@
"license": "ISC",
"dependencies": {
"systeminformation": "^5.16.5"
},
"devDependencies": {}
}
},
"node_modules/systeminformation": {
"version": "5.16.5",
"resolved": "https://registry.npmmirror.com/systeminformation/-/systeminformation-5.16.5.tgz",
"integrity": "sha512-puU4XTFWvyBLOe3CT3ztcJfRmcpjevNHJa4ZVWoRsMnfYqaZkEUeMvidDOeTj7lIEhYOWvVnVjEpSJJ6bc8g3g==",
"version": "5.16.9",
"resolved": "https://registry.npmmirror.com/systeminformation/-/systeminformation-5.16.9.tgz",
"integrity": "sha512-QTlv3GGSromPeLVW3pzM6uxU8RbkacW9e0+ZX23GAXaX+XE0UToSygAxCJDHSty6RB9lAFHCHg+FfiXFChi/+w==",
"os": [
"darwin",
"linux",
@@ -37,9 +36,9 @@
},
"dependencies": {
"systeminformation": {
"version": "5.16.5",
"resolved": "https://registry.npmmirror.com/systeminformation/-/systeminformation-5.16.5.tgz",
"integrity": "sha512-puU4XTFWvyBLOe3CT3ztcJfRmcpjevNHJa4ZVWoRsMnfYqaZkEUeMvidDOeTj7lIEhYOWvVnVjEpSJJ6bc8g3g=="
"version": "5.16.9",
"resolved": "https://registry.npmmirror.com/systeminformation/-/systeminformation-5.16.9.tgz",
"integrity": "sha512-QTlv3GGSromPeLVW3pzM6uxU8RbkacW9e0+ZX23GAXaX+XE0UToSygAxCJDHSty6RB9lAFHCHg+FfiXFChi/+w=="
}
}
}