#Porting my app from Electron to Tauri, getting system information.

2 messages · Page 1 of 1 (latest)

sly dawn
#

Hello, i'm porting my app from Electron to Tauri, i have a section where all the system information is displayed, such as the OS, Storage Size, RAM Capacity, GPU Model, CPU Model etc. In my electron app i did it by using systeminformation npm package like this :

`const os = require('os');
const { ipcRenderer } = require('electron');
const fs = require('fs');
const path = require('path');

const computerName = os.userInfo().username;
const hostName = os.hostname();

document.getElementById('username').innerHTML = computerName;
document.getElementById('hostname').innerHTML = hostName;

const si = require('systeminformation');

si.baseboard().then(data => {
document.getElementById('pc-mobo').innerHTML = data.model;
});
si.cpu().then(data => {
document.getElementById('pc-cpu').innerHTML = data.brand;
});
si.diskLayout().then(data => {
document.getElementById('pc-storage').innerHTML = Math.round(data[0].size / Math.pow(1024, 3)) + " GB";
});
si.mem().then(data => {
document.getElementById('pc-ram').innerHTML = Math.round(data.total / Math.pow(1024, 3)) + " GB";
});
si.graphics().then(data => {
document.getElementById('pc-gpu').innerHTML = data.controllers[0].model;
});
si.osInfo().then(data => {
document.getElementById('pc-os').innerHTML = data.distro;
});`

How can i achieve the same thing in Tauri? I have 0 experience with Rust and this is the last thing i need to complete the port of my app. Thanks.

silent otter