From the course: Node.js Essential Training
Unlock the full course today
Join today to access over 24,400 courses taught by industry experts.
Handling argument variables with process.argv - Node.js Tutorial
From the course: Node.js Essential Training
Handling argument variables with process.argv
- [Instructor] One important object that's available to us globally is the process object. So it can be accessed from absolutely anywhere, and it contains functionality that allows us to interact with information about the current process instance. With the process object, we can get environment information, read environment variables, communicate with the terminal, and we can exit the current process. So it gives us a way to work with that current process instance. So one of the things that we can do with the process object is collect information from the terminal. So this information is stored in the process.argv array. So check this out. We're going to get rid of the code that was here before and replace it with a console log to figure out what is available in this process.argv value. Now, we want to make sure that we're navigated to the right file here, and we can run node global. This will then return to us this…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
Inspecting the global object3m 46s
-
(Locked)
Using the require function3m 4s
-
(Locked)
Handling argument variables with process.argv3m 29s
-
(Locked)
Working with standard input3m 37s
-
(Locked)
Using standard output3m 13s
-
(Locked)
Creating a delay with setTimeout2m 3s
-
(Locked)
Incorporating setInterval2m 51s
-
(Locked)
Reporting progress with setInterval1m 43s
-
-
-
-