@oxmc/node-smbios 1.0.0 → 1.0.2
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/README.md +7 -9
- package/package.json +12 -6
- package/src/windows/smbios_windows.cpp +48 -51
- package/binding.gyp +0 -49
- package/example.js +0 -94
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# node-smbios
|
|
2
2
|
|
|
3
|
-
[](https://www.npmjs.com/package/%40oxmc%2Fnode-smbios)
|
|
4
4
|
[](https://opensource.org/licenses/MIT)
|
|
5
5
|
|
|
6
6
|
Cross-platform Node.js native addon for reading SMBIOS (System Management BIOS) / DMI (Desktop Management Interface) hardware information.
|
|
@@ -17,7 +17,7 @@ Cross-platform Node.js native addon for reading SMBIOS (System Management BIOS)
|
|
|
17
17
|
## Installation
|
|
18
18
|
|
|
19
19
|
```bash
|
|
20
|
-
npm install node-smbios
|
|
20
|
+
npm install @oxmc/node-smbios
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
### How Installation Works
|
|
@@ -26,7 +26,7 @@ The package uses **prebuilt native binaries** for most users:
|
|
|
26
26
|
|
|
27
27
|
1. **First**: Attempts to download a prebuilt binary from [GitHub Releases](https://github.com/oxmc/node-smbios/releases)
|
|
28
28
|
- Binaries are available for common platforms: Windows, macOS, Linux
|
|
29
|
-
- Supports
|
|
29
|
+
- Supports N-API Versions: 3, 4, 5, 6, 7, 8, 9
|
|
30
30
|
- Covers architectures: x64, arm64
|
|
31
31
|
|
|
32
32
|
2. **Fallback**: If no prebuilt binary is available, it compiles from source
|
|
@@ -125,7 +125,7 @@ sudo pacman -S base-devel python
|
|
|
125
125
|
After installation, verify it works:
|
|
126
126
|
|
|
127
127
|
```bash
|
|
128
|
-
node -e "const smbios = require('node-smbios'); console.log(smbios.getSystemInfo());"
|
|
128
|
+
node -e "const smbios = require('@oxmc/node-smbios'); console.log(smbios.getSystemInfo());"
|
|
129
129
|
```
|
|
130
130
|
|
|
131
131
|
### Forcing Source Build
|
|
@@ -133,13 +133,13 @@ node -e "const smbios = require('node-smbios'); console.log(smbios.getSystemInfo
|
|
|
133
133
|
If you want to compile from source instead of using prebuilt binaries:
|
|
134
134
|
|
|
135
135
|
```bash
|
|
136
|
-
npm install node-smbios --build-from-source
|
|
136
|
+
npm install @oxmc/node-smbios --build-from-source
|
|
137
137
|
```
|
|
138
138
|
|
|
139
139
|
## Usage
|
|
140
140
|
|
|
141
141
|
```javascript
|
|
142
|
-
const smbios = require('node-smbios');
|
|
142
|
+
const smbios = require('@oxmc/node-smbios');
|
|
143
143
|
|
|
144
144
|
// Get BIOS information
|
|
145
145
|
const biosInfo = smbios.getBiosInfo();
|
|
@@ -305,7 +305,7 @@ This runs `node-gyp rebuild` which:
|
|
|
305
305
|
- `src/smbios_common.cpp` - Common utilities
|
|
306
306
|
- Platform-specific file: `src/windows/smbios_windows.cpp`, `src/mac/smbios_macos.cpp`, or `src/linux/smbios_linux.cpp`
|
|
307
307
|
3. Links with platform-specific libraries
|
|
308
|
-
4. Outputs
|
|
308
|
+
4. Outputs the compiled addon for all napi versions supported (/lib/{platform}-{arch}-napi-v{napi_version}/smbios.node) ex: /lib/win32-x64-napi-v9/smbios.node
|
|
309
309
|
|
|
310
310
|
### 4. Run Tests
|
|
311
311
|
|
|
@@ -418,8 +418,6 @@ This project uses automated releases via GitHub Actions. To create a new release
|
|
|
418
418
|
- Upload binaries to GitHub Releases
|
|
419
419
|
- Publish the package to npm
|
|
420
420
|
|
|
421
|
-
See [.github/RELEASE.md](.github/RELEASE.md) for more details on the release process.
|
|
422
|
-
|
|
423
421
|
## Troubleshooting
|
|
424
422
|
|
|
425
423
|
### Build Errors
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oxmc/node-smbios",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "A Node.js module designed to retrieve detailed system and hardware information from SMBIOS.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"install": "node-pre-gyp install --fallback-to-build",
|
|
8
|
-
"build": "node-gyp rebuild",
|
|
8
|
+
"build": "node-pre-gyp rebuild",
|
|
9
9
|
"clean": "node-gyp clean",
|
|
10
10
|
"test": "node example.js",
|
|
11
11
|
"package": "node-pre-gyp package",
|
|
@@ -13,11 +13,17 @@
|
|
|
13
13
|
},
|
|
14
14
|
"binary": {
|
|
15
15
|
"module_name": "smbios",
|
|
16
|
-
"module_path": "./
|
|
17
|
-
"package_name": "{module_name}-v{version}-{
|
|
16
|
+
"module_path": "./lib/{platform}-{arch}-napi-v{napi_build_version}",
|
|
17
|
+
"package_name": "{module_name}-v{version}-napi-v{napi_build_version}-{platform}-{arch}.tar.gz",
|
|
18
18
|
"host": "https://github.com/oxmc/node-smbios/releases/download/",
|
|
19
|
-
"remote_path": "v{version}"
|
|
19
|
+
"remote_path": "v{version}",
|
|
20
|
+
"napi_versions": [3, 4, 5, 6, 7, 8, 9]
|
|
20
21
|
},
|
|
22
|
+
"files": [
|
|
23
|
+
"index.js",
|
|
24
|
+
"lib/**/*",
|
|
25
|
+
"src/**/*"
|
|
26
|
+
],
|
|
21
27
|
"keywords": [
|
|
22
28
|
"smbios",
|
|
23
29
|
"dmi",
|
|
@@ -67,4 +73,4 @@
|
|
|
67
73
|
"linux",
|
|
68
74
|
"win32"
|
|
69
75
|
]
|
|
70
|
-
}
|
|
76
|
+
}
|
|
@@ -7,14 +7,22 @@
|
|
|
7
7
|
#include <comdef.h>
|
|
8
8
|
#include <Wbemidl.h>
|
|
9
9
|
#include <string>
|
|
10
|
-
#include <vector>
|
|
11
10
|
|
|
12
11
|
#pragma comment(lib, "wbemuuid.lib")
|
|
13
12
|
|
|
14
13
|
namespace smbios {
|
|
15
14
|
|
|
15
|
+
static std::string WideToUtf8(const wchar_t* wstr) {
|
|
16
|
+
if (!wstr) return "";
|
|
17
|
+
int len = WideCharToMultiByte(CP_UTF8, 0, wstr, -1, NULL, 0, NULL, NULL);
|
|
18
|
+
if (len <= 0) return "";
|
|
19
|
+
std::string result(len - 1, '\0');
|
|
20
|
+
WideCharToMultiByte(CP_UTF8, 0, wstr, -1, &result[0], len, NULL, NULL);
|
|
21
|
+
return result;
|
|
22
|
+
}
|
|
23
|
+
|
|
16
24
|
/**
|
|
17
|
-
*
|
|
25
|
+
* Lightweight WMI query class - no COM init/uninit, connection reuse
|
|
18
26
|
*/
|
|
19
27
|
class WMIQuery {
|
|
20
28
|
private:
|
|
@@ -24,38 +32,19 @@ private:
|
|
|
24
32
|
|
|
25
33
|
public:
|
|
26
34
|
WMIQuery() : pLoc(nullptr), pSvc(nullptr), initialized(false) {
|
|
27
|
-
//
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
// Set general COM security levels
|
|
34
|
-
hres = CoInitializeSecurity(
|
|
35
|
-
NULL, -1, NULL, NULL,
|
|
36
|
-
RPC_C_AUTHN_LEVEL_DEFAULT,
|
|
37
|
-
RPC_C_IMP_LEVEL_IMPERSONATE,
|
|
38
|
-
NULL, EOAC_NONE, NULL
|
|
39
|
-
);
|
|
40
|
-
|
|
41
|
-
if (FAILED(hres) && hres != RPC_E_TOO_LATE) {
|
|
42
|
-
CoUninitialize();
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
// Obtain the initial locator to WMI
|
|
47
|
-
hres = CoCreateInstance(
|
|
35
|
+
// Don't call CoInitialize - Node.js already initialized COM
|
|
36
|
+
// Don't call CoInitializeSecurity - it's already set or will fail with RPC_E_TOO_LATE
|
|
37
|
+
|
|
38
|
+
HRESULT hres = CoCreateInstance(
|
|
48
39
|
CLSID_WbemLocator, 0,
|
|
49
40
|
CLSCTX_INPROC_SERVER,
|
|
50
41
|
IID_IWbemLocator, (LPVOID*)&pLoc
|
|
51
42
|
);
|
|
52
43
|
|
|
53
44
|
if (FAILED(hres)) {
|
|
54
|
-
CoUninitialize();
|
|
55
45
|
return;
|
|
56
46
|
}
|
|
57
47
|
|
|
58
|
-
// Connect to WMI
|
|
59
48
|
hres = pLoc->ConnectServer(
|
|
60
49
|
_bstr_t(L"ROOT\\CIMV2"), NULL, NULL, 0,
|
|
61
50
|
NULL, 0, 0, &pSvc
|
|
@@ -63,11 +52,10 @@ public:
|
|
|
63
52
|
|
|
64
53
|
if (FAILED(hres)) {
|
|
65
54
|
pLoc->Release();
|
|
66
|
-
|
|
55
|
+
pLoc = nullptr;
|
|
67
56
|
return;
|
|
68
57
|
}
|
|
69
58
|
|
|
70
|
-
// Set security levels on the proxy
|
|
71
59
|
hres = CoSetProxyBlanket(
|
|
72
60
|
pSvc, RPC_C_AUTHN_WINNT, RPC_C_AUTHZ_NONE, NULL,
|
|
73
61
|
RPC_C_AUTHN_LEVEL_CALL, RPC_C_IMP_LEVEL_IMPERSONATE,
|
|
@@ -77,7 +65,8 @@ public:
|
|
|
77
65
|
if (FAILED(hres)) {
|
|
78
66
|
pSvc->Release();
|
|
79
67
|
pLoc->Release();
|
|
80
|
-
|
|
68
|
+
pSvc = nullptr;
|
|
69
|
+
pLoc = nullptr;
|
|
81
70
|
return;
|
|
82
71
|
}
|
|
83
72
|
|
|
@@ -85,9 +74,15 @@ public:
|
|
|
85
74
|
}
|
|
86
75
|
|
|
87
76
|
~WMIQuery() {
|
|
88
|
-
if (pSvc)
|
|
89
|
-
|
|
90
|
-
|
|
77
|
+
if (pSvc) {
|
|
78
|
+
pSvc->Release();
|
|
79
|
+
pSvc = nullptr;
|
|
80
|
+
}
|
|
81
|
+
if (pLoc) {
|
|
82
|
+
pLoc->Release();
|
|
83
|
+
pLoc = nullptr;
|
|
84
|
+
}
|
|
85
|
+
// Don't call CoUninitialize - we didn't initialize COM
|
|
91
86
|
}
|
|
92
87
|
|
|
93
88
|
std::string QueryProperty(const wchar_t* wmiClass, const wchar_t* property) {
|
|
@@ -98,7 +93,7 @@ public:
|
|
|
98
93
|
query += L" FROM ";
|
|
99
94
|
query += wmiClass;
|
|
100
95
|
|
|
101
|
-
IEnumWbemClassObject* pEnumerator =
|
|
96
|
+
IEnumWbemClassObject* pEnumerator = nullptr;
|
|
102
97
|
HRESULT hres = pSvc->ExecQuery(
|
|
103
98
|
bstr_t("WQL"),
|
|
104
99
|
bstr_t(query.c_str()),
|
|
@@ -106,40 +101,44 @@ public:
|
|
|
106
101
|
NULL, &pEnumerator
|
|
107
102
|
);
|
|
108
103
|
|
|
109
|
-
if (FAILED(hres)) {
|
|
104
|
+
if (FAILED(hres) || !pEnumerator) {
|
|
110
105
|
return "";
|
|
111
106
|
}
|
|
112
107
|
|
|
113
|
-
IWbemClassObject* pclsObj =
|
|
108
|
+
IWbemClassObject* pclsObj = nullptr;
|
|
114
109
|
ULONG uReturn = 0;
|
|
115
110
|
std::string result;
|
|
116
111
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
break;
|
|
121
|
-
}
|
|
122
|
-
|
|
112
|
+
hres = pEnumerator->Next(WBEM_INFINITE, 1, &pclsObj, &uReturn);
|
|
113
|
+
|
|
114
|
+
if (SUCCEEDED(hres) && uReturn == 1 && pclsObj) {
|
|
123
115
|
VARIANT vtProp;
|
|
124
116
|
VariantInit(&vtProp);
|
|
125
|
-
hr = pclsObj->Get(property, 0, &vtProp, 0, 0);
|
|
126
117
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
118
|
+
hres = pclsObj->Get(property, 0, &vtProp, 0, 0);
|
|
119
|
+
|
|
120
|
+
if (SUCCEEDED(hres)) {
|
|
121
|
+
if (vtProp.vt == VT_BSTR && vtProp.bstrVal) {
|
|
122
|
+
result = WideToUtf8(vtProp.bstrVal);
|
|
123
|
+
} else if (vtProp.vt == VT_I4) {
|
|
132
124
|
result = std::to_string(vtProp.lVal);
|
|
133
|
-
} else if (vtProp.vt ==
|
|
125
|
+
} else if (vtProp.vt == VT_UI4) {
|
|
126
|
+
result = std::to_string(vtProp.ulVal);
|
|
127
|
+
} else if (vtProp.vt == VT_I2) {
|
|
134
128
|
result = std::to_string(vtProp.iVal);
|
|
129
|
+
} else if (vtProp.vt == VT_UI2) {
|
|
130
|
+
result = std::to_string(vtProp.uiVal);
|
|
135
131
|
} else if (vtProp.vt == VT_UI1) {
|
|
136
132
|
result = std::to_string(vtProp.bVal);
|
|
133
|
+
} else if (vtProp.vt == VT_I8) {
|
|
134
|
+
result = std::to_string(vtProp.llVal);
|
|
135
|
+
} else if (vtProp.vt == VT_UI8) {
|
|
136
|
+
result = std::to_string(vtProp.ullVal);
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
139
|
|
|
140
140
|
VariantClear(&vtProp);
|
|
141
141
|
pclsObj->Release();
|
|
142
|
-
break; // Get only first result
|
|
143
142
|
}
|
|
144
143
|
|
|
145
144
|
pEnumerator->Release();
|
|
@@ -168,7 +167,6 @@ SystemInfo GetSystemInfo() {
|
|
|
168
167
|
info.uuid = wmi.QueryProperty(L"Win32_ComputerSystemProduct", L"UUID");
|
|
169
168
|
info.wakeUpType = wmi.QueryProperty(L"Win32_ComputerSystem", L"WakeUpType");
|
|
170
169
|
|
|
171
|
-
// Try to get serial number from ComputerSystemProduct
|
|
172
170
|
std::string serial = wmi.QueryProperty(L"Win32_ComputerSystemProduct", L"IdentifyingNumber");
|
|
173
171
|
if (serial.empty() || serial == "To Be Filled By O.E.M.") {
|
|
174
172
|
serial = wmi.QueryProperty(L"Win32_BIOS", L"SerialNumber");
|
|
@@ -222,7 +220,6 @@ MemoryInfo GetMemoryInfo() {
|
|
|
222
220
|
info.maxCapacity = wmi.QueryProperty(L"Win32_PhysicalMemoryArray", L"MaxCapacity");
|
|
223
221
|
info.memoryDevices = wmi.QueryProperty(L"Win32_PhysicalMemoryArray", L"MemoryDevices");
|
|
224
222
|
|
|
225
|
-
// Get available memory from OS
|
|
226
223
|
MEMORYSTATUSEX memStatus;
|
|
227
224
|
memStatus.dwLength = sizeof(memStatus);
|
|
228
225
|
if (GlobalMemoryStatusEx(&memStatus)) {
|
|
@@ -252,4 +249,4 @@ ChassisInfo GetChassisInfo() {
|
|
|
252
249
|
|
|
253
250
|
} // namespace smbios
|
|
254
251
|
|
|
255
|
-
#endif // _WIN32
|
|
252
|
+
#endif // _WIN32
|
package/binding.gyp
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"targets": [
|
|
3
|
-
{
|
|
4
|
-
"target_name": "smbios",
|
|
5
|
-
"cflags!": [ "-fno-exceptions" ],
|
|
6
|
-
"cflags_cc!": [ "-fno-exceptions" ],
|
|
7
|
-
"cflags_cc": [ "-std=c++17" ],
|
|
8
|
-
"sources": [
|
|
9
|
-
"src/binding.cpp",
|
|
10
|
-
"src/smbios_common.cpp"
|
|
11
|
-
],
|
|
12
|
-
"include_dirs": [
|
|
13
|
-
"<!@(node -p \"require('node-addon-api').include\")",
|
|
14
|
-
"<!@(node -p \"require('@mapbox/node-pre-gyp').include\")"
|
|
15
|
-
],
|
|
16
|
-
"defines": [ "NAPI_DISABLE_CPP_EXCEPTIONS" ],
|
|
17
|
-
"conditions": [
|
|
18
|
-
["OS=='win'", {
|
|
19
|
-
"sources": [ "src/windows/smbios_windows.cpp" ],
|
|
20
|
-
"libraries": [],
|
|
21
|
-
"msvs_settings": {
|
|
22
|
-
"VCCLCompilerTool": {
|
|
23
|
-
"ExceptionHandling": 1,
|
|
24
|
-
"AdditionalOptions": [ "/std:c++17" ]
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
}],
|
|
28
|
-
["OS=='mac'", {
|
|
29
|
-
"sources": [ "src/mac/smbios_macos.cpp" ],
|
|
30
|
-
"xcode_settings": {
|
|
31
|
-
"GCC_ENABLE_CPP_EXCEPTIONS": "YES",
|
|
32
|
-
"CLANG_CXX_LANGUAGE_STANDARD": "c++17",
|
|
33
|
-
"CLANG_CXX_LIBRARY": "libc++",
|
|
34
|
-
"MACOSX_DEPLOYMENT_TARGET": "10.13"
|
|
35
|
-
},
|
|
36
|
-
"link_settings": {
|
|
37
|
-
"libraries": [
|
|
38
|
-
"-framework IOKit",
|
|
39
|
-
"-framework CoreFoundation"
|
|
40
|
-
]
|
|
41
|
-
}
|
|
42
|
-
}],
|
|
43
|
-
["OS=='linux'", {
|
|
44
|
-
"sources": [ "src/linux/smbios_linux.cpp" ]
|
|
45
|
-
}]
|
|
46
|
-
]
|
|
47
|
-
}
|
|
48
|
-
]
|
|
49
|
-
}
|
package/example.js
DELETED
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Example usage of node-smbios
|
|
3
|
-
*
|
|
4
|
-
* This demonstrates how to retrieve SMBIOS information from the system.
|
|
5
|
-
* Run with: node example.js
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
const smbios = require('./index');
|
|
9
|
-
|
|
10
|
-
console.log('=== node-smbios Example ===\n');
|
|
11
|
-
|
|
12
|
-
try {
|
|
13
|
-
// Get BIOS information
|
|
14
|
-
console.log('--- BIOS Information ---');
|
|
15
|
-
const biosInfo = smbios.getBiosInfo();
|
|
16
|
-
console.log('Vendor:', biosInfo.vendor || 'N/A');
|
|
17
|
-
console.log('Version:', biosInfo.version || 'N/A');
|
|
18
|
-
console.log('Release Date:', biosInfo.releaseDate || 'N/A');
|
|
19
|
-
console.log('BIOS Characteristics:', biosInfo.biosCharacteristics || 'N/A');
|
|
20
|
-
console.log();
|
|
21
|
-
|
|
22
|
-
// Get System information
|
|
23
|
-
console.log('--- System Information ---');
|
|
24
|
-
const systemInfo = smbios.getSystemInfo();
|
|
25
|
-
console.log('Manufacturer:', systemInfo.manufacturer || 'N/A');
|
|
26
|
-
console.log('Product Name:', systemInfo.productName || 'N/A');
|
|
27
|
-
console.log('Serial Number:', systemInfo.serialNumber || 'N/A');
|
|
28
|
-
console.log('UUID:', systemInfo.uuid || 'N/A');
|
|
29
|
-
console.log('SKU Number:', systemInfo.skuNumber || 'N/A');
|
|
30
|
-
console.log('Family:', systemInfo.family || 'N/A');
|
|
31
|
-
console.log('Wake Up Type:', systemInfo.wakeUpType || 'N/A');
|
|
32
|
-
console.log();
|
|
33
|
-
|
|
34
|
-
// Get Board information
|
|
35
|
-
console.log('--- Board Information ---');
|
|
36
|
-
const boardInfo = smbios.getBoardInfo();
|
|
37
|
-
console.log('Manufacturer:', boardInfo.manufacturer || 'N/A');
|
|
38
|
-
console.log('Product:', boardInfo.product || 'N/A');
|
|
39
|
-
console.log('Version:', boardInfo.version || 'N/A');
|
|
40
|
-
console.log('Serial Number:', boardInfo.serialNumber || 'N/A');
|
|
41
|
-
console.log('Asset Tag:', boardInfo.assetTag || 'N/A');
|
|
42
|
-
console.log('Location in Chassis:', boardInfo.locationInChassis || 'N/A');
|
|
43
|
-
console.log();
|
|
44
|
-
|
|
45
|
-
// Get Processor information
|
|
46
|
-
console.log('--- Processor Information ---');
|
|
47
|
-
const procInfo = smbios.getProcessorInfo();
|
|
48
|
-
console.log('Manufacturer:', procInfo.manufacturer || 'N/A');
|
|
49
|
-
console.log('Name:', procInfo.version || 'N/A');
|
|
50
|
-
console.log('Socket:', procInfo.socketDesignation || 'N/A');
|
|
51
|
-
console.log('Type:', procInfo.processorType || 'N/A');
|
|
52
|
-
console.log('Family:', procInfo.processorFamily || 'N/A');
|
|
53
|
-
console.log('Max Speed:', procInfo.maxSpeed || 'N/A');
|
|
54
|
-
console.log('Current Speed:', procInfo.currentSpeed || 'N/A');
|
|
55
|
-
console.log('Core Count:', procInfo.coreCount || 'N/A');
|
|
56
|
-
console.log('Thread Count:', procInfo.threadCount || 'N/A');
|
|
57
|
-
console.log('L2 Cache:', procInfo.l2CacheSize || 'N/A');
|
|
58
|
-
console.log('L3 Cache:', procInfo.l3CacheSize || 'N/A');
|
|
59
|
-
console.log();
|
|
60
|
-
|
|
61
|
-
// Get Memory information
|
|
62
|
-
console.log('--- Memory Information ---');
|
|
63
|
-
const memInfo = smbios.getMemoryInfo();
|
|
64
|
-
console.log('Total Physical Memory:', memInfo.totalPhysicalMemory || 'N/A');
|
|
65
|
-
console.log('Available Physical Memory:', memInfo.availablePhysicalMemory || 'N/A');
|
|
66
|
-
console.log('Total Virtual Memory:', memInfo.totalVirtualMemory || 'N/A');
|
|
67
|
-
console.log('Available Virtual Memory:', memInfo.availableVirtualMemory || 'N/A');
|
|
68
|
-
console.log('Memory Devices:', memInfo.memoryDevices || 'N/A');
|
|
69
|
-
console.log('Max Capacity:', memInfo.maxCapacity || 'N/A');
|
|
70
|
-
console.log();
|
|
71
|
-
|
|
72
|
-
// Get Chassis information
|
|
73
|
-
console.log('--- Chassis Information ---');
|
|
74
|
-
const chassisInfo = smbios.getChassisInfo();
|
|
75
|
-
console.log('Manufacturer:', chassisInfo.manufacturer || 'N/A');
|
|
76
|
-
console.log('Type:', chassisInfo.type || 'N/A');
|
|
77
|
-
console.log('Version:', chassisInfo.version || 'N/A');
|
|
78
|
-
console.log('Serial Number:', chassisInfo.serialNumber || 'N/A');
|
|
79
|
-
console.log('Asset Tag:', chassisInfo.assetTag || 'N/A');
|
|
80
|
-
console.log('Boot Up State:', chassisInfo.bootUpState || 'N/A');
|
|
81
|
-
console.log('Power Supply State:', chassisInfo.powerSupplyState || 'N/A');
|
|
82
|
-
console.log('Thermal State:', chassisInfo.thermalState || 'N/A');
|
|
83
|
-
console.log();
|
|
84
|
-
|
|
85
|
-
// Get all information at once
|
|
86
|
-
console.log('--- All Information (Single Call) ---');
|
|
87
|
-
const allInfo = smbios.getAllInfo();
|
|
88
|
-
console.log(JSON.stringify(allInfo, null, 2));
|
|
89
|
-
|
|
90
|
-
} catch (error) {
|
|
91
|
-
console.error('Error:', error.message);
|
|
92
|
-
console.error('\nNote: Some information may require elevated privileges (administrator/root).');
|
|
93
|
-
process.exit(1);
|
|
94
|
-
}
|