feat: added 03_dom
This commit is contained in:
35
02_advanced/uebungen/u32_os-info/index.js
Normal file
35
02_advanced/uebungen/u32_os-info/index.js
Normal file
@@ -0,0 +1,35 @@
|
||||
import os from 'node:os';
|
||||
import color from 'chalk';
|
||||
|
||||
const platform = os.platform();
|
||||
|
||||
const cpu = os.cpus().length;
|
||||
|
||||
console.log(color.yellow(`I am running on a machine with ${platform} and ${cpu} cores.`));
|
||||
|
||||
//console.log(os.cpus()); //gibt ein array aus jeweils cpu kernen
|
||||
console.log(os.type()); // Darwin
|
||||
console.log(os.version()); // Darwin mit kernelversion
|
||||
console.log(os.totalmem()); //RAM in bytes
|
||||
console.log(os.freemem());
|
||||
console.log(os.availableParallelism()); // 8 -> ein programm sollte max 8 parallele tasks ausführen?
|
||||
console.log(os.arch()); // cpu architektur -> arm64
|
||||
console.log(os.machine()); // arm64
|
||||
//console.log(os.networkInterfaces());
|
||||
console.log(os.hostname()); //MacBookAir
|
||||
console.log(os.release()); // die releasenr und nicht datum
|
||||
console.log(os.userInfo()); // Object mit Userinfos
|
||||
console.log(os.userInfo().username);
|
||||
|
||||
// Übung 32: Information zum Betriebssystem und der Anzahl der vorhandenen CPUs
|
||||
|
||||
// Im Kontext einer Monitoring-Lösung benötigt ein Kunde eine kleine CLI (Command Line Interface)-Anwendung, die es erlaubt, das aktuelle Betriebssystem und die Anzahl der CPUs auf dem jeweiligen Rechner zu ermitteln.
|
||||
|
||||
// Vorgehensweise
|
||||
|
||||
// 1.Schau dir die Online-Dokumentation zum os-Modul der Standardbibliothek an.
|
||||
// 2.Erstelle dann ein kurzes Node.js-Programm, das ausgibt, auf welcher Plattform es gerade läuft (also etwa »linux«, »darwin« (OS X) oder »win32«) und wie viele Kerne der Rechner hat.
|
||||
|
||||
// Hier eine mögliche Beispielausgabe:
|
||||
|
||||
// I am running on a machine with linux and 2 cores.
|
||||
Reference in New Issue
Block a user