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.
|
||||
27
02_advanced/uebungen/u32_os-info/package-lock.json
generated
Normal file
27
02_advanced/uebungen/u32_os-info/package-lock.json
generated
Normal file
@@ -0,0 +1,27 @@
|
||||
{
|
||||
"name": "u32_os-info",
|
||||
"version": "1.0.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "u32_os-info",
|
||||
"version": "1.0.0",
|
||||
"dependencies": {
|
||||
"chalk": "^5.6.2"
|
||||
}
|
||||
},
|
||||
"node_modules/chalk": {
|
||||
"version": "5.6.2",
|
||||
"resolved": "https://registry.npmjs.org/chalk/-/chalk-5.6.2.tgz",
|
||||
"integrity": "sha512-7NzBL0rN6fMUW+f7A6Io4h40qQlG+xGmtMxfbnH/K7TAtt8JQWVQK+6g0UXKMeVJoyV5EkkNsErQ8pVD3bLHbA==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": "^12.17.0 || ^14.13 || >=16.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/chalk/chalk?sponsor=1"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
14
02_advanced/uebungen/u32_os-info/package.json
Normal file
14
02_advanced/uebungen/u32_os-info/package.json
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"name": "u32_os-info",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"keywords": [],
|
||||
"type": "module",
|
||||
"dependencies": {
|
||||
"chalk": "^5.6.2"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user