(bytes)
| 1 | const os = require('os'); |
| 2 | |
| 3 | function formatBytes(bytes) { |
| 4 | const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB']; |
| 5 | if (bytes === 0) return '0 Bytes'; |
| 6 | const i = Math.floor(Math.log(bytes) / Math.log(1024)); |
| 7 | return Math.round(bytes / Math.pow(1024, i) * 100) / 100 + ' ' + sizes[i]; |
| 8 | } |
| 9 | |
| 10 | function getSystemInfo() { |
| 11 | const totalMem = os.totalmem(); |