f_
frhyme.code
•javascript•⏱ 약 1분 소요

NodeJS - Passing Command line arguments

📑 목차 (Contents)
  • nodejs를 command line에서 실행할 때, argument를 넘겨주는 방법은 다음과 같습니다.
node pass_argv.js arg1 arg2
  • 그리고 process.argv에 담기는데요, 다음과 같이 array의 형태로 담깁니다.
  • node의 실행 경로, 현재 file의 경로 그리고 command line에서 입력받은 argument
[
  '/usr/local/bin/node',
  'current file path',
  'arg1',
  'arg2'
]

Wrap-up

  • 간단히 command line에서 argument를 node로 넘겨주는 방법을 정리하였습니다.

Reference

GitHub에서 이 글의 마크다운 원본 보기 & 수정 제안src/content/posts/2022-03-06-javascript12_passing_cmd_arg

💡RELATED ARTICLES · 함께 읽으면 좋은 연관 포스트

글 주소가 클립보드에 복사되었습니다.