about-system 0.0.14 → 0.0.16
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 +3 -21
- package/package.json +4 -4
- package/src/about-system.js +2 -4
- package/src/test-speed-cloudflare.js +0 -51
package/README.md
CHANGED
|
@@ -27,6 +27,8 @@ npx about-system
|
|
|
27
27
|
|
|
28
28
|
A cross-platform Node.js implementation of the system info script with enhanced features, caching, and full customization support.
|
|
29
29
|
|
|
30
|
+
[NPM](https://www.npmjs.com/package/about-system-info)
|
|
31
|
+
|
|
30
32
|
## Examples
|
|
31
33
|
|
|
32
34
|

|
|
@@ -37,7 +39,7 @@ A cross-platform Node.js implementation of the system info script with enhanced
|
|
|
37
39
|
|
|
38
40
|
### Features
|
|
39
41
|
|
|
40
|
-
- **Cross-Platform**: Works on Windows, macOS,
|
|
42
|
+
- **Cross-Platform**: Works on any Linux, Windows PowerShell (most features), macOS, Android Termux
|
|
41
43
|
- **Smart Caching**: Configurable cache durations for different system info types
|
|
42
44
|
- **Customizable Output**: Control which info blocks to show and their order
|
|
43
45
|
- **Network Info**: Fetches IP, location, and ISP data from ipinfo.io
|
|
@@ -213,23 +215,3 @@ npm start
|
|
|
213
215
|
# Run with custom settings
|
|
214
216
|
npm start -- --set display.show_emojis false
|
|
215
217
|
```
|
|
216
|
-
|
|
217
|
-
### License
|
|
218
|
-
|
|
219
|
-
MIT License - see the original bash version for details.
|
|
220
|
-
|
|
221
|
-
### Contributing
|
|
222
|
-
|
|
223
|
-
1. Fork the repository
|
|
224
|
-
2. Create a feature branch
|
|
225
|
-
3. Make your changes
|
|
226
|
-
4. Test on multiple platforms
|
|
227
|
-
5. Submit a pull request
|
|
228
|
-
|
|
229
|
-
### Changelog
|
|
230
|
-
|
|
231
|
-
- **v0.0.3**: Initial Node.js implementation with cross-platform support
|
|
232
|
-
- Enhanced caching system
|
|
233
|
-
- Settings management
|
|
234
|
-
- Windows compatibility
|
|
235
|
-
- Shell integration improvements
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "about-system",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.16",
|
|
4
4
|
"description": "A Node.js script to display key system information with emojis. Cross-platform support for Windows, macOS, and Linux with customizable output and caching.",
|
|
5
5
|
"main": "src/about-system.js",
|
|
6
6
|
"bin": {
|
|
@@ -40,12 +40,12 @@
|
|
|
40
40
|
"system-monitoring"
|
|
41
41
|
],
|
|
42
42
|
"author": "vtempest",
|
|
43
|
-
"license": "
|
|
43
|
+
"license": "rights.institute/prosper",
|
|
44
44
|
"repository": {
|
|
45
45
|
"type": "git",
|
|
46
|
-
"url": "https://github.com/
|
|
46
|
+
"url": "https://github.com/OpenSourceAGI/StarterDOCS/tree/master/packages/about-system-info"
|
|
47
47
|
},
|
|
48
|
-
"homepage": "https://github.com/
|
|
48
|
+
"homepage": "https://github.com/OpenSourceAGI/StarterDOCS/tree/master/packages/about-system-info",
|
|
49
49
|
"files": [
|
|
50
50
|
"src/about-system.js",
|
|
51
51
|
"README.md",
|
package/src/about-system.js
CHANGED
|
@@ -7,9 +7,7 @@ import https from 'https';
|
|
|
7
7
|
import { fileURLToPath } from 'url';
|
|
8
8
|
|
|
9
9
|
const __filename = fileURLToPath(import.meta.url);
|
|
10
|
-
import { fileURLToPath } from 'url';
|
|
11
10
|
|
|
12
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
13
11
|
|
|
14
12
|
// Cache configuration
|
|
15
13
|
const CACHE_FILE = path.join(os.tmpdir(), 'systeminfo-cache.json');
|
|
@@ -976,7 +974,7 @@ const infoFunctions = {
|
|
|
976
974
|
const loads = loadavg.split(' ').slice(0, 3);
|
|
977
975
|
const color = colors[settings.colors.load_average] || colors.red;
|
|
978
976
|
const emoji = settings.display.show_emojis ? '⚖️ ' : '';
|
|
979
|
-
return `${color}${emoji}${loads.join(' ')}`;
|
|
977
|
+
return `${color}${emoji} ${loads.join(' ')}`;
|
|
980
978
|
} catch { }
|
|
981
979
|
return '';
|
|
982
980
|
},
|
|
@@ -1095,7 +1093,7 @@ const infoFunctions = {
|
|
|
1095
1093
|
if (serviceCount > 0) {
|
|
1096
1094
|
const color = colors[settings.colors.services_running] || colors.green;
|
|
1097
1095
|
const emoji = settings.display.show_emojis ? '⚙️ ' : '';
|
|
1098
|
-
const result = `${color}${emoji}${serviceCount} services`;
|
|
1096
|
+
const result = `${color}${emoji} ${serviceCount} services`;
|
|
1099
1097
|
setCachedValue(this.cache, 'services_running', result);
|
|
1100
1098
|
return result;
|
|
1101
1099
|
}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import ora from 'ora';
|
|
2
|
-
import { spawn, execSync } from 'child_process';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Tests the download speed in MB/s using Cloudflare's speed test.
|
|
7
|
-
* Optionally displays a spinner message during the test.
|
|
8
|
-
* Their official package is @cloudflare/speedtest and it shows errors and too much output.
|
|
9
|
-
* This script uses a process to hide the errors and give speed in MB/s via CLI or import.
|
|
10
|
-
* @param {boolean} [showMessage=true] - Whether to show explanation message while testing.
|
|
11
|
-
* @returns {Promise<string>} The measured download speed in MB/s as a string (e.g., "12.3").
|
|
12
|
-
*
|
|
13
|
-
* @example
|
|
14
|
-
* import { testDownloadSpeed } from './test-speed-cloudflare.js';
|
|
15
|
-
* const downloadSpeed = await testDownloadSpeed(false);
|
|
16
|
-
* console.log(downloadSpeed); // e.g., "12.3"
|
|
17
|
-
*/
|
|
18
|
-
export async function testDownloadSpeed(showMessage = true) {
|
|
19
|
-
var spinner;
|
|
20
|
-
if (showMessage)
|
|
21
|
-
spinner = ora('Testing download speed in MB/s using Cloudflare, runs for 1 minute').start();
|
|
22
|
-
|
|
23
|
-
// globally install @cloudflare/speedtest
|
|
24
|
-
await execSync('npm i -g @cloudflare/speedtest');
|
|
25
|
-
|
|
26
|
-
const result = await new Promise((resolve) => {
|
|
27
|
-
const child = spawn('node', [
|
|
28
|
-
'-e',
|
|
29
|
-
"import SpeedTest from '@cloudflare/speedtest'; new SpeedTest({iterations: 1}).onFinish = r => console.log((r.getDownloadBandwidth() / 8388608).toFixed(1))"
|
|
30
|
-
]);
|
|
31
|
-
|
|
32
|
-
let output = '';
|
|
33
|
-
child.stdout.on('data', (data) => {
|
|
34
|
-
output += data.toString();
|
|
35
|
-
});
|
|
36
|
-
// Extract last number from output
|
|
37
|
-
child.on('close', () => {
|
|
38
|
-
resolve(output.trim().split('\n').pop().match(/(\d+(\.\d+)?)/)?.[0]);
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
if (showMessage) spinner.succeed(result + ' MB/s');
|
|
44
|
-
return result;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
// try{
|
|
48
|
-
// run if file is executed directly
|
|
49
|
-
// if (process?.env.npm_lifecycle_event?.length > 0 || import.meta.url === `file://${process.argv[1]}` || import.meta.url === process.argv[1] || import.meta.url === `file://${process.cwd()}/${process.argv[1]}`)
|
|
50
|
-
testDownloadSpeed();
|
|
51
|
-
// } catch { }
|