nuvira/server/api/getCpu.ts
2025-02-26 09:38:06 +01:00

16 lines
455 B
TypeScript

import si from 'systeminformation';
export default defineEventHandler(async () => {
try {
const cpuData = await si.cpu();
const cpuTemp = await si.cpuTemperature();
return {
info: cpuData, // `info` is the key, `cpuData` is the value
temps: cpuTemp // `temps` is the key, `cpuTemp` is the value
};
} catch (error) {
console.error('Error fetching CPU info:', error);
}
});