To get the system CPU temperature in TypeScript, you can make use of the node-cpu-temperature
library. First, install the library using npm
:
index.ts33 chars2 lines
Then, import the library and use it to get the CPU temperature:
index.ts238 chars8 lines
The getTemperature()
function returns a promise that resolves with the CPU temperature in Celsius. You can then use this value as needed in your TypeScript code.
gistlibby LogSnag