-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
76 lines (63 loc) · 4.37 KB
/
app.js
File metadata and controls
76 lines (63 loc) · 4.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/*
.--. .--..-./`).--. .--.-./`) ________ .-''-.,---------. _______ .---. .---.
| | _/ / \ .-.'| |_ | \ .-.'| | .'_ _ \ \/ __ \ | | |_ _|
| (`' ) / / `-' | _( )_ | / `-' | .----'/ ( ` ) `--. ,---| ,_/ \__)| | ( ' )
|(_ ()_) `-'`"|(_ o _) | |`-'`"| _|____. (_ o _) | | \,-./ ) | '-(_{;}_)
| (_,_) __.---.| (_,_) \ | |.---.|_( )_ | (_,_)___| :_ _:\ '_ '`) | (_,_)
| |\ \ | | || |/ \| || |(_ o._)__' \ .---. (_I_) > (_) ) __| _ _--. |
| | \ `' | || ' /\ ` || ||(_,_) \ `-' / (_(=)_( . .-'_/ |( ' ) | |
| | \ /| || / \ || || | \ / (_I_) `-'`-' /(_{;}_)| |
`--' `'-' '---'`---' `---`'---''---' `'-..-' '---' `._____.' '(_,_) '---'
by picsacoder
Official Repo: https://github.com/picsacoder/kiwifetch
*/
const sysinfo = require('systeminformation');
const fs = require('fs');
const chalk = require('chalk');
const os = require('os')
function formatBytes(a,b=2,k=1024){with(Math){let d=floor(log(a)/log(k));return 0==a?"0 Bytes":parseFloat((a/pow(k,d)).toFixed(max(0,b)))+" "+["Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"][d]}}
//Source: https://stackoverflow.com/questions/15900485/correct-way-to-convert-size-in-bytes-to-kb-mb-gb-in-javascript
function format(seconds){function pad(s){return (s < 10 ? '0' : '') + s;}var hours = Math.floor(seconds / (60*60));var minutes = Math.floor(seconds % (60*60) / 60);var seconds = Math.floor(seconds % 60); return pad(hours) + ':' + pad(minutes) + ':' + pad(seconds);}
//Source: https://stackoverflow.com/questions/28705009/how-do-i-get-the-server-uptime-in-node-js/28706630
async function kiwifetch() {
try {
//Title (Change this to change the title)
let title = 'kiwifetch ッ影ズ'
//Getting data
const data_os = await sysinfo.osInfo();
const data_cpu = await sysinfo.cpu();
const data_ram = await sysinfo.mem();
const data_disk = await sysinfo.blockDevices();
let uptime = os.uptime()
//Print info
let info = `${data_cpu.manufacturer} ${data_cpu.brand} (${data_cpu.cores}) ${data_cpu.speed} GHz`
let info_ram = `${formatBytes(data_ram.active)}/${formatBytes(data_ram.total)}`
let info_os = `${data_os.distro} ${data_os.platform}`
let info_disk = `${data_disk[0].physical} ${formatBytes(data_disk[0].size)}`
let draw = `
${chalk.red(title)}
${info_os}
⠄⠄⠄⢀⣤⣾⣿⡟⠋⠄⠄⠄⣀⡿⠄⠊⠄⠄⠄⠄⠄⠄⢸⠇⠄⢀⠃⠙⣿⣿
⣤⠒⠛⠛⠛⠛⠛⠛⠉⠉⠉⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠸⠄⢀⠊⠄⠄⠈⢿ ${chalk.greenBright("【 CPU 】")}: ${chalk.magenta(info)}
⣿⣠⠤⠴⠶⠒⠶⠶⠤⠤⣤⣀⠄⠄⠄⠄⠄⠄⠄⠄⠄⢀⠃⠄⠂⣀⣀⣀⡀⠄
⡏⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠈⠙⠂⠄⠄⠄⠄⠄⠄⢀⢎⠐⠛⠋⠉⠉⠉⠉⠛ ${chalk.greenBright("【 RAM 】")}: ${chalk.magenta(info_ram)}
⡇⠄⠄⠄⣀⡀⠄⠄⠄⢀⡀⠄⠄⠄⠄⠄⠄⠄⠄⠄⠎⠁⠄⠄⠄⠄⠄⠄⠄⠄
⡧⠶⣿⣿⣿⣿⣿⣿⠲⠦⣭⡃⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⢀⡀⠄⠄⠄⠄⠄⠄ ${chalk.greenBright("【 DISK 】")}: ${chalk.magenta(info_disk)}
⡇⠄⣿⣿⣿⣿⣿⣿⡄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⢰⣾⣿⣿⣿⡟⠛⠶⠄
⡇⠄⣿⣿⣿⣿⣿⣿⡇⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⣼⣿⣿⣿⣿⡇⠄⠄⢀ ${chalk.greenBright("【 UPTIME 】")}: ${chalk.magenta(format(uptime))}
⡇⠄⢿⣿⣿⣿⣿⣷⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⣿⣿⣿⣿⣿⡇⠄⠄⢊
⢠⠄⠈⠛⠛⠛⠛⠋⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⢿⣿⣿⣿⡦⠁⠄⠄⣼
⢸⠄⠈⠉⠁⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠉⠉⠄⠄⠄⠄⢰⣿
⢸⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠁⠉⠄⢸⣿
⠄⣆⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⢀⣀⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⢸⣿
⠄⢿⣷⣶⣄⡀⠄⠄⠄⠄⠄⠄⠉⠉⠉⠉⠁⠄⠄⠄⠄⠄⠄⠄⠄⠄⢀⣴⣿⣿
⠄⢸⣿⣿⣿⣿⣷⣦⣤⣀⡀⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⣀⣠⣤⣶⣿⣿⣿⣿⣿
`
console.clear()
console.log(draw)
}
catch(e) {
console.log(e)
}
}
kiwifetch()