@oxmc/node-smbios 1.0.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.
package/README.md ADDED
@@ -0,0 +1,473 @@
1
+ # node-smbios
2
+
3
+ [![npm version](https://badge.fury.io/js/node-smbios.svg)](https://www.npmjs.com/package/node-smbios)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
+
6
+ Cross-platform Node.js native addon for reading SMBIOS (System Management BIOS) / DMI (Desktop Management Interface) hardware information.
7
+
8
+ ## Features
9
+
10
+ - 🖥️ **Cross-platform** - Works on Windows, macOS, and Linux
11
+ - ⚡ **Fast** - Native C++ implementation for optimal performance
12
+ - 📦 **Easy to use** - Simple JavaScript API
13
+ - 🔒 **No external dependencies** - Uses platform-native APIs
14
+ - 🎯 **Comprehensive** - Reads BIOS, System, Board, Processor, Memory, and Chassis information
15
+ - 🔧 **Stable** - Uses N-API for compatibility across Node.js versions
16
+
17
+ ## Installation
18
+
19
+ ```bash
20
+ npm install node-smbios
21
+ ```
22
+
23
+ ### How Installation Works
24
+
25
+ The package uses **prebuilt native binaries** for most users:
26
+
27
+ 1. **First**: Attempts to download a prebuilt binary from [GitHub Releases](https://github.com/oxmc/node-smbios/releases)
28
+ - Binaries are available for common platforms: Windows, macOS, Linux
29
+ - Supports Node.js versions: 16, 18, 20, 22
30
+ - Covers architectures: x64, arm64
31
+
32
+ 2. **Fallback**: If no prebuilt binary is available, it compiles from source
33
+ - Requires build tools (see below)
34
+ - Takes longer but works on any platform
35
+
36
+ **Benefits:**
37
+ - ✅ Most users get instant installation (no compilation needed)
38
+ - ✅ No build tools required for common platforms
39
+ - ✅ Automatic fallback ensures compatibility
40
+
41
+ ### Build Tools (Only if Compiling from Source)
42
+
43
+ **Node.js:**
44
+ - Node.js >= 16.0.0
45
+ - npm (comes with Node.js)
46
+
47
+ **Build Tools:**
48
+
49
+ The package requires native compilation tools on each platform:
50
+
51
+ #### Windows
52
+
53
+ You need Visual Studio Build Tools (or full Visual Studio) with C++ support:
54
+
55
+ **Option 1: Install Visual Studio 2022 or later**
56
+ - Download from [Visual Studio Downloads](https://visualstudio.microsoft.com/downloads/)
57
+ - During installation, select "Desktop development with C++" workload
58
+ - Includes MSVC compiler, Windows SDK, and MSBuild
59
+
60
+ **Option 2: Install Build Tools only**
61
+ ```bash
62
+ npm install --global windows-build-tools
63
+ ```
64
+
65
+ **Required components:**
66
+ - MSVC C++ compiler
67
+ - Windows SDK (10 or 11)
68
+ - MSBuild
69
+
70
+ **Dependencies/Libraries used:**
71
+ - Windows Management Instrumentation (WMI) - Built into Windows
72
+ - `wbemuuid.lib` - Links automatically via `#pragma comment`
73
+
74
+ #### macOS
75
+
76
+ Install Xcode Command Line Tools:
77
+
78
+ ```bash
79
+ xcode-select --install
80
+ ```
81
+
82
+ **Required components:**
83
+ - Clang/LLVM C++ compiler
84
+ - macOS SDK
85
+
86
+ **System frameworks used:**
87
+ - `IOKit.framework` - For hardware information access
88
+ - `CoreFoundation.framework` - For data type conversions
89
+
90
+ **Minimum macOS version:** 10.13 (High Sierra)
91
+
92
+ #### Linux
93
+
94
+ Install build essentials and development tools:
95
+
96
+ **Debian/Ubuntu:**
97
+ ```bash
98
+ sudo apt-get update
99
+ sudo apt-get install -y build-essential python3
100
+ ```
101
+
102
+ **Red Hat/Fedora/CentOS:**
103
+ ```bash
104
+ sudo yum install gcc gcc-c++ make python3
105
+ # or on newer versions:
106
+ sudo dnf install gcc gcc-c++ make python3
107
+ ```
108
+
109
+ **Arch Linux:**
110
+ ```bash
111
+ sudo pacman -S base-devel python
112
+ ```
113
+
114
+ **Required components:**
115
+ - GCC/G++ compiler (version 7.0+)
116
+ - GNU Make
117
+ - Python 3 (for node-gyp)
118
+
119
+ **System dependencies:**
120
+ - No external libraries required (reads from `/sys/class/dmi/id/` and `/proc/`)
121
+ - May require read permissions for DMI files (usually root or `sudo`)
122
+
123
+ ### Verifying Installation
124
+
125
+ After installation, verify it works:
126
+
127
+ ```bash
128
+ node -e "const smbios = require('node-smbios'); console.log(smbios.getSystemInfo());"
129
+ ```
130
+
131
+ ### Forcing Source Build
132
+
133
+ If you want to compile from source instead of using prebuilt binaries:
134
+
135
+ ```bash
136
+ npm install node-smbios --build-from-source
137
+ ```
138
+
139
+ ## Usage
140
+
141
+ ```javascript
142
+ const smbios = require('node-smbios');
143
+
144
+ // Get BIOS information
145
+ const biosInfo = smbios.getBiosInfo();
146
+ console.log('BIOS Vendor:', biosInfo.vendor);
147
+ console.log('BIOS Version:', biosInfo.version);
148
+ console.log('Release Date:', biosInfo.releaseDate);
149
+
150
+ // Get System information
151
+ const systemInfo = smbios.getSystemInfo();
152
+ console.log('Manufacturer:', systemInfo.manufacturer);
153
+ console.log('Product:', systemInfo.productName);
154
+ console.log('Serial:', systemInfo.serialNumber);
155
+ console.log('UUID:', systemInfo.uuid);
156
+
157
+ // Get Board information
158
+ const boardInfo = smbios.getBoardInfo();
159
+ console.log('Board Manufacturer:', boardInfo.manufacturer);
160
+ console.log('Board Product:', boardInfo.product);
161
+
162
+ // Get Processor information
163
+ const procInfo = smbios.getProcessorInfo();
164
+ console.log('CPU:', procInfo.version);
165
+ console.log('Cores:', procInfo.coreCount);
166
+ console.log('Threads:', procInfo.threadCount);
167
+
168
+ // Get Memory information
169
+ const memInfo = smbios.getMemoryInfo();
170
+ console.log('Total Memory:', memInfo.totalPhysicalMemory);
171
+ console.log('Available Memory:', memInfo.availablePhysicalMemory);
172
+
173
+ // Get Chassis information
174
+ const chassisInfo = smbios.getChassisInfo();
175
+ console.log('Chassis Type:', chassisInfo.type);
176
+ console.log('Manufacturer:', chassisInfo.manufacturer);
177
+
178
+ // Get ALL information at once
179
+ const allInfo = smbios.getAllInfo();
180
+ console.log(JSON.stringify(allInfo, null, 2));
181
+ ```
182
+
183
+ ## API Reference
184
+
185
+ ### `getBiosInfo()`
186
+
187
+ Returns BIOS information:
188
+ - `vendor` - BIOS manufacturer
189
+ - `version` - BIOS version
190
+ - `releaseDate` - BIOS release date
191
+ - `biosCharacteristics` - Additional BIOS characteristics
192
+
193
+ ### `getSystemInfo()`
194
+
195
+ Returns system information:
196
+ - `manufacturer` - System manufacturer
197
+ - `productName` - System product/model name
198
+ - `serialNumber` - System serial number
199
+ - `uuid` - System UUID
200
+ - `skuNumber` - SKU number
201
+ - `family` - Product family
202
+ - `wakeUpType` - Wake-up type
203
+
204
+ ### `getBoardInfo()`
205
+
206
+ Returns motherboard/baseboard information:
207
+ - `manufacturer` - Board manufacturer
208
+ - `product` - Board product name
209
+ - `version` - Board version
210
+ - `serialNumber` - Board serial number
211
+ - `assetTag` - Asset tag
212
+ - `locationInChassis` - Location in chassis
213
+
214
+ ### `getProcessorInfo()`
215
+
216
+ Returns processor information:
217
+ - `manufacturer` - CPU manufacturer
218
+ - `version` - CPU model name
219
+ - `socketDesignation` - CPU socket
220
+ - `processorType` - Processor type
221
+ - `processorFamily` - Processor family
222
+ - `maxSpeed` - Maximum speed (MHz)
223
+ - `currentSpeed` - Current speed (MHz)
224
+ - `coreCount` - Number of cores
225
+ - `threadCount` - Number of threads
226
+ - `l2CacheSize` - L2 cache size (KB)
227
+ - `l3CacheSize` - L3 cache size (KB)
228
+
229
+ ### `getMemoryInfo()`
230
+
231
+ Returns memory information:
232
+ - `totalPhysicalMemory` - Total physical memory (bytes)
233
+ - `availablePhysicalMemory` - Available physical memory (bytes)
234
+ - `totalVirtualMemory` - Total virtual memory (bytes)
235
+ - `availableVirtualMemory` - Available virtual memory (bytes)
236
+ - `memoryDevices` - Number of memory devices
237
+ - `maxCapacity` - Maximum memory capacity
238
+
239
+ ### `getChassisInfo()`
240
+
241
+ Returns chassis information:
242
+ - `manufacturer` - Chassis manufacturer
243
+ - `type` - Chassis type
244
+ - `version` - Chassis version
245
+ - `serialNumber` - Chassis serial number
246
+ - `assetTag` - Asset tag
247
+ - `bootUpState` - Boot-up state
248
+ - `powerSupplyState` - Power supply state
249
+ - `thermalState` - Thermal state
250
+
251
+ ### `getAllInfo()`
252
+
253
+ Returns all information in a single object with keys: `bios`, `system`, `board`, `processor`, `memory`, `chassis`.
254
+
255
+ ## Platform-Specific Notes
256
+
257
+ ### Windows
258
+ - Uses **WMI** (Windows Management Instrumentation)
259
+ - Supports Windows 7 and later
260
+ - May require administrator privileges for some detailed information
261
+
262
+ ### macOS
263
+ - Uses **IOKit** framework
264
+ - Accesses IORegistry for system information
265
+ - Works on macOS 10.13 and later
266
+ - Some processor/memory details may require additional system calls
267
+
268
+ ### Linux
269
+ - Reads from `/sys/class/dmi/id/` for DMI information
270
+ - Reads from `/proc/cpuinfo` and `/proc/meminfo` for processor and memory details
271
+ - May require root privileges to access some DMI files
272
+ - Works on most modern Linux distributions
273
+
274
+ ## Building from Source
275
+
276
+ If you want to build the addon from source or contribute to development:
277
+
278
+ ### 1. Clone the Repository
279
+
280
+ ```bash
281
+ git clone https://github.com/oxmc/node-smbios.git
282
+ cd node-smbios
283
+ ```
284
+
285
+ ### 2. Install Dependencies
286
+
287
+ ```bash
288
+ npm install
289
+ ```
290
+
291
+ This installs:
292
+ - `node-addon-api` - N-API C++ wrapper classes
293
+ - `node-gyp` - Build tool for native addons
294
+
295
+ ### 3. Build the Native Addon
296
+
297
+ ```bash
298
+ npm run build
299
+ ```
300
+
301
+ This runs `node-gyp rebuild` which:
302
+ 1. Generates platform-specific build files (Visual Studio solution on Windows, Makefile on Unix)
303
+ 2. Compiles the C++ source files:
304
+ - `src/binding.cpp` - N-API bindings
305
+ - `src/smbios_common.cpp` - Common utilities
306
+ - Platform-specific file: `src/windows/smbios_windows.cpp`, `src/mac/smbios_macos.cpp`, or `src/linux/smbios_linux.cpp`
307
+ 3. Links with platform-specific libraries
308
+ 4. Outputs `build/Release/smbios.node` (the compiled addon)
309
+
310
+ ### 4. Run Tests
311
+
312
+ ```bash
313
+ npm test
314
+ ```
315
+
316
+ This runs `example.js` which demonstrates all API functions.
317
+
318
+ ### Build Configuration
319
+
320
+ The build process is configured in `binding.gyp`:
321
+
322
+ **Common settings:**
323
+ - C++11 or later required
324
+ - N-API based (no V8 API dependencies)
325
+ - Exception handling enabled
326
+
327
+ **Platform-specific compilation:**
328
+ - **Windows**: Compiles with MSVC, links against `wbemuuid.lib` for WMI
329
+ - **macOS**: Compiles with Clang, links against IOKit and CoreFoundation frameworks
330
+ - **Linux**: Compiles with GCC, no external libraries needed
331
+
332
+ ### Development Commands
333
+
334
+ ```bash
335
+ # Clean build artifacts
336
+ npm run clean
337
+
338
+ # Rebuild (clean + build)
339
+ npm run build
340
+
341
+ # Install and build (as end user would)
342
+ npm install
343
+
344
+ # Run example/test
345
+ npm test
346
+ ```
347
+
348
+ ### Project Structure
349
+
350
+ ```
351
+ node-smbios/
352
+ ├── src/
353
+ │ ├── binding.cpp # N-API entry point
354
+ │ ├── smbios_common.h # Common data structures
355
+ │ ├── smbios_common.cpp # Utility functions
356
+ │ ├── windows/
357
+ │ │ └── smbios_windows.cpp # Windows WMI implementation
358
+ │ ├── mac/
359
+ │ │ └── smbios_macos.cpp # macOS IOKit implementation
360
+ │ └── linux/
361
+ │ └── smbios_linux.cpp # Linux /sys/dmi implementation
362
+ ├── binding.gyp # node-gyp configuration
363
+ ├── package.json # npm package configuration
364
+ ├── index.js # JavaScript entry point
365
+ └── example.js # Usage examples
366
+ ```
367
+
368
+ ### Debugging Build Issues
369
+
370
+ **Enable verbose output:**
371
+ ```bash
372
+ npm run build -- --verbose
373
+ ```
374
+
375
+ **Check node-gyp version:**
376
+ ```bash
377
+ npx node-gyp --version
378
+ ```
379
+
380
+ **Manually rebuild:**
381
+ ```bash
382
+ npx node-gyp clean
383
+ npx node-gyp configure
384
+ npx node-gyp build
385
+ ```
386
+
387
+ **Common issues:**
388
+ - **Python not found**: node-gyp requires Python 3.x
389
+ - **Compiler not found**: Install platform build tools (see Prerequisites)
390
+ - **Permission errors**: On Linux, some DMI files require root access
391
+
392
+ ## Contributing
393
+
394
+ Contributions are welcome! Please feel free to submit a Pull Request.
395
+
396
+ 1. Fork the repository
397
+ 2. Create your feature branch (`git checkout -b feature/amazing-feature`)
398
+ 3. Commit your changes (`git commit -m 'Add some amazing feature'`)
399
+ 4. Push to the branch (`git push origin feature/amazing-feature`)
400
+ 5. Open a Pull Request
401
+
402
+ ## Releasing
403
+
404
+ This project uses automated releases via GitHub Actions. To create a new release:
405
+
406
+ 1. Update the version in `package.json`:
407
+ ```bash
408
+ npm version patch # or minor, or major
409
+ ```
410
+
411
+ 2. Push the tag to GitHub:
412
+ ```bash
413
+ git push && git push --tags
414
+ ```
415
+
416
+ 3. GitHub Actions will automatically:
417
+ - Build native binaries for all supported platforms (Windows, macOS, Linux)
418
+ - Upload binaries to GitHub Releases
419
+ - Publish the package to npm
420
+
421
+ See [.github/RELEASE.md](.github/RELEASE.md) for more details on the release process.
422
+
423
+ ## Troubleshooting
424
+
425
+ ### Build Errors
426
+
427
+ **Windows:**
428
+ ```bash
429
+ npm install --global windows-build-tools
430
+ ```
431
+
432
+ **macOS:**
433
+ ```bash
434
+ xcode-select --install
435
+ ```
436
+
437
+ **Linux (Debian/Ubuntu):**
438
+ ```bash
439
+ sudo apt-get install build-essential
440
+ ```
441
+
442
+ ### Permission Issues
443
+
444
+ Some SMBIOS information may require elevated privileges:
445
+
446
+ **Windows:** Run as Administrator
447
+
448
+ **Linux:** Run with sudo or add your user to appropriate groups
449
+
450
+ **macOS:** Usually works without special privileges
451
+
452
+ ## License
453
+
454
+ MIT License - see [LICENSE](LICENSE) file for details.
455
+
456
+ ## Author
457
+
458
+ Your Name <your.email@example.com>
459
+
460
+ ## Acknowledgments
461
+
462
+ - Uses [node-addon-api](https://github.com/nodejs/node-addon-api) for N-API bindings
463
+ - Inspired by system information tools across different platforms
464
+
465
+ ## Related Projects
466
+
467
+ - [systeminformation](https://www.npmjs.com/package/systeminformation) - Comprehensive system and OS information
468
+ - [node-dmidecode](https://www.npmjs.com/package/node-dmidecode) - Linux dmidecode wrapper
469
+ - [wmi-client](https://www.npmjs.com/package/wmi-client) - Windows WMI client
470
+
471
+ ## Changelog
472
+
473
+ See [CHANGELOG.md](CHANGELOG.md) for release history.
package/binding.gyp ADDED
@@ -0,0 +1,49 @@
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 ADDED
@@ -0,0 +1,94 @@
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
+ }
package/index.js ADDED
@@ -0,0 +1,33 @@
1
+ /**
2
+ * node-smbios - Cross-platform SMBIOS information reader
3
+ *
4
+ * This module provides a simple interface to read SMBIOS information
5
+ * from the system using native C++ code.
6
+ */
7
+
8
+ try {
9
+ // Try to load prebuilt binary via node-pre-gyp
10
+ const binding_path = require('@mapbox/node-pre-gyp').find(
11
+ require('path').resolve(__dirname, './package.json')
12
+ );
13
+ module.exports = require(binding_path);
14
+ } catch (err) {
15
+ try {
16
+ // Fall back to Release build
17
+ module.exports = require('./build/Release/smbios.node');
18
+ } catch (err2) {
19
+ try {
20
+ // Fall back to Debug build
21
+ module.exports = require('./build/Debug/smbios.node');
22
+ } catch (err3) {
23
+ // If no build is available, throw a helpful error
24
+ throw new Error(
25
+ 'Native addon not found. Please run "npm install" or "npm run build" to compile the native addon.\n' +
26
+ 'Original error: ' + err.message
27
+ );
28
+ }
29
+ }
30
+ }
31
+
32
+ // Add version information
33
+ module.exports.version = require('./package.json').version;