현재 경로와 파일이름 읽기

const path = require("path");

console.log(__dirname);
console.log(__filename);

내 노트북

윈도우라서 위와 같이 떴고,

유닉스 계열(맥, 리눅스)이었다면

회사 맥미니

위와 같이 표기된다.

'NodeJS' 카테고리의 다른 글

[NodeJS] Timer  (0) 2022.06.12
[Node.js] Events `EventEmitter`  (0) 2022.06.05

+ Recent posts