Initial commit

This commit is contained in:
2019-11-19 18:54:40 +01:00
commit 6477f7a30c
1536 changed files with 170775 additions and 0 deletions

23
model/Temp.js Normal file
View File

@@ -0,0 +1,23 @@
const fs = require('fs')
module.exports = new class {
path = '/sys/class/hwmon/hwmon1'
getCores() {
const labels = fs.readdirSync(this.path).filter(file => file.startsWith('temp') && file.endsWith('_label'))
const temps = fs.readdirSync(this.path).filter(file => file.startsWith('temp') && file.endsWith('_input'))
const cores = [];
for (const labelFile of labels) {
const id = labelFile.replace('temp', '').replace('_label', '')
const label = fs.readFileSync(`${this.path}/${labelFile}`, { encoding: 'utf8' }).trim()
const temp = fs.readFileSync(`${this.path}/temp${id}_input`, { encoding: 'utf8' })
cores.push({
label,
temp: parseFloat(temp / 1000)
})
}
return cores
}
}