1

So, I'm learning svelte + sapper, and I want to use systeminformation to retrieve detailed hardware, system and OS information.

I installed it with ' npm i systeminformation ' and it shows on node_modules, but I don't know how to use/require/import it. For example, I want to see my cpu information, but I don't know how to use it on my .svelte file.

This is what I want to use:
https://www.npmjs.com/package/systeminformation
https://systeminformation.io/gettingstarted.html

I'm so sorry if this is a really noob question, and thank you so much for any help in advance!!! Also, english is not my main language, so... sorry if i could not express my doubt properly.
Thank you again! :D

2 Answers2

1

systeminformation is purely for node and will not work in the browser, at most it might work in a server route for sapper but even then it will only give you information about the server you are running

it will not work in a .svelte component.

Stephane Vanraes
  • 4,759
  • 2
  • 4
  • 15
  • Ahh, okay!!! Thank you so much!!!! Is there a way to collect system data, like cpu, temperature, ram, wifi, and others on svelte? – steniffy.18 Feb 05 '21 at 14:26
  • there is this: https://stackoverflow.com/questions/9514179/how-to-find-the-operating-system-version-using-javascript but generally I don't think it's possible due to security reasons (I wouldn't personally want a random website be able to tell what temperature my computer is running) – Stephane Vanraes Feb 05 '21 at 22:34
-1

Check svelte-adaptive-sensors which export stores for system info.

From the readme :

Sensors to help you deliver adaptive sensors to users depending on their network-type, memory, cpu, and saveData settings. A svelte version of react-adaptive-hooks although there are very few differences between the two libraries currently.

Jérémie B
  • 9,558
  • 1
  • 18
  • 37