systeminformation 5.33.2 → 5.33.4

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 CHANGED
@@ -35,11 +35,14 @@ lines of code, > 750 versions published, up to 50 mio downloads per month, > 700
35
35
  mio downloads overall. Top 5 NPM ranking for backend packages. Thank you to all
36
36
  who contributed to this project!
37
37
 
38
- > **Upcoming Version 6** ⭐️⭐️⭐️
38
+ > **Version 6** beta just released ⭐️⭐️⭐️
39
39
  >
40
- > The upcoming version 6 of this package (written completely in TypeScript) will
41
- > come with a lot of new features and improvements. I also cleaned up the API so
42
- > there will also be some breaking changes. I will release the first beta soon.
40
+ > 🏆🏆🏆 We're proud to have just released the first beta of the new version 6 of systeminformation.
41
+ > Version 6 of this package (written completely in TypeScript) is
42
+ > comming with a lot of new features and improvements. We also cleaned up the API so
43
+ > there will also be some breaking changes.
44
+ >
45
+ > **Thanks to everyone testing this new version!**
43
46
 
44
47
  ## Please support this project ... ☕️
45
48
 
@@ -61,6 +64,36 @@ was not correct but this is now fixed with Deno >= 2.1.5.
61
64
  **Attention**: This library is supposed to be used as a backend/server-side
62
65
  library and **will definitely not work within a browser**.
63
66
 
67
+ ## Version 6.0 beta
68
+
69
+ If you want to test the new version 6.0 (currently in beta), you can eather install it this way:
70
+
71
+ ```bash
72
+ npm i systeminformation@beta
73
+ ```
74
+
75
+ Then just test it with your existing code - be sure to check all breaking changes. Docs can be found here:
76
+
77
+ - [V6 Docs][v6-docs-url]
78
+ - [V6 major changes][v6-changes-url]
79
+
80
+ If you want to run the whole test locally on your machines (without writing any code):
81
+
82
+ ```bash
83
+ # clone v6 branch
84
+ git clone -b v6 https://github.com/sebhildebrandt/systeminformation.git
85
+ cd systeminformation
86
+
87
+ # install dev dependencies
88
+ npm ci
89
+
90
+ # run tests
91
+ npm run ci # for the whole test run
92
+ npm run test # for testing individual functions
93
+ ```
94
+
95
+ Thank you for testing and reporting! Please report any issue with the prefix "v6.beta.0: "
96
+
64
97
  ## Current Version 5.0
65
98
 
66
99
  The current Version 5 - this major version release 5.0 - came with new
@@ -1213,3 +1246,5 @@ All other trademarks are the property of their respective owners.
1213
1246
  [mmon-npm-url]: https://npmjs.org/package/mmon
1214
1247
  [mmon-github-url]: https://github.com/sebhildebrandt/mmon
1215
1248
  [smc-code-url]: https://github.com/pcafstockf/smc-reader
1249
+ [v6-docs-url]: https://systeminformation.io/v6/
1250
+ [v6-changes-url]: https://systeminformation.io/v6/changes.html
package/lib/filesystem.js CHANGED
@@ -1729,12 +1729,29 @@ function diskLayout(callback) {
1729
1729
  util.noop();
1730
1730
  }
1731
1731
  }
1732
+ function hasControlCharacters(str) {
1733
+ return /\p{Cc}/u.test(str);
1734
+ }
1732
1735
  util.promiseAll(workload).then((data) => {
1733
1736
  let devices = data.results[0].toString().split(/\n\s*\n/);
1734
1737
  devices.forEach((device) => {
1735
1738
  const lines = device.split('\r\n');
1736
1739
  const size = util.getValue(lines, 'Size', ':').trim();
1737
1740
  const status = util.getValue(lines, 'Status', ':').trim().toLowerCase();
1741
+ let serialNum = util.getValue(lines, 'SerialNumber', ':').trim();
1742
+ if (hasControlCharacters(serialNum)) {
1743
+ const instanceId = util.getValue(lines, 'PNPDeviceId', ':').trim().split('\\')[2];
1744
+ if (instanceId) {
1745
+ const parts = instanceId.split('&');
1746
+ // instanceId can contain device serial number or be generated by PnP manager
1747
+ // in first case it will be "<serial number>&0"
1748
+ // in second case it will be opaque generated value that looks like this: "5&<8-symbol hex code>&0&000000"
1749
+ // https://learn.microsoft.com/en-us/windows-hardware/drivers/install/instance-ids
1750
+ if (parts.length == 2 && parts[1] === '0') {
1751
+ serialNum = parts[0]
1752
+ }
1753
+ }
1754
+ }
1738
1755
  if (size) {
1739
1756
  result.push({
1740
1757
  device: util.getValue(lines, 'DeviceId', ':'), // changed from PNPDeviceId to DeviceID (be be able to match devices)
@@ -1750,7 +1767,7 @@ function diskLayout(callback) {
1750
1767
  tracksPerCylinder: parseInt(util.getValue(lines, 'TracksPerCylinder', ':'), 10),
1751
1768
  sectorsPerTrack: parseInt(util.getValue(lines, 'SectorsPerTrack', ':'), 10),
1752
1769
  firmwareRevision: util.getValue(lines, 'FirmwareRevision', ':').trim(),
1753
- serialNum: util.getValue(lines, 'SerialNumber', ':').trim(),
1770
+ serialNum,
1754
1771
  interfaceType: util.getValue(lines, 'InterfaceType', ':').trim(),
1755
1772
  smartStatus: status === 'ok' ? 'Ok' : status === 'degraded' ? 'Degraded' : status === 'pred fail' ? 'Predicted Failure' : 'Unknown',
1756
1773
  temperature: null
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "systeminformation",
3
- "version": "5.33.2",
3
+ "version": "5.33.4",
4
4
  "description": "Advanced, lightweight system and OS information library",
5
5
  "license": "MIT",
6
6
  "author": "Sebastian Hildebrandt <hildebrandt@plus-innovations.com> (https://plus-innovations.com)",