상세 컨텐츠

본문 제목

[OS] os 모듈

Node.js

by 메타샤워 2023. 7. 19. 14:44

본문

OS 모듈

 
os 모듈은 cluster를 위해 코어의 개수를 셀때 사용되기도 하지만 많이 사용되는 모듈은 아니다..
서버 컴퓨터의 기본적인 하드웨어 자원들의 정보를 확인할 때 사용할 수 있다.
var os = require('os');
 
console.log( os.platform() );             // 플랫폼 정보 반환
console.log( os.endianness() );           // 엔디언 타입 반환 'BE' 또는 'LE'
console.log( os.hostname() );             // 서버의 호스트 이름 반환
console.log( os.type() );                 // 서버의 OS 타입 반환
console.log( os.platform() );             // 서버의 플랫폼 반환
console.log( os.arch() );                 // 서버의 CPU 아키텍처 반환
console.log( os.release() );              // 운영체제 OS 버전 반환
console.log( os.uptime() );               // 운영체제 시작된 시간 반환
console.log( os.loadavg() );              // load average에 담긴 정보 반환
console.log( os.totalmem() );             // 시스템 메모리 반환
console.log( os.freemem() );              // 사용 가능 메모리 반환
console.log( os.cpus() );                 // cpu 정보 반환
console.log( os.networkInterfaces() );    // 네트워크 정보 반환

'Node.js' 카테고리의 다른 글

socket.io를 이용한 웹 전자칠판  (0) 2023.07.19
[MYSQL] node.js에서 mysql 연결하기  (0) 2023.07.19
[fs] File System 모듈  (0) 2023.07.19
[Express] Express.js를 살펴 보자  (0) 2023.07.19
[Express] Express의 미들웨어 Connect  (0) 2023.07.19

관련글 더보기