Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Node.js: process.argv vs. process.ARGV

I notice that Node defines both process.argv and process.ARGV (capitalized). The later isn't mentioned in the documentation and is, in every case I've encountered so far, the same object.

Is ARGV just a historic holdover, or does it have a purpose?

like image 371
Trevor Burnham Avatar asked Apr 28 '11 22:04

Trevor Burnham


People also ask

What is process argv in node JS?

The process. argv() method is used for returning all the command-line arguments that were passed when the Node. js process was being launched. The first element will always contains the same value as process. execPath.

Is process argv an array?

The process module has a property named argv that stores all the command-line arguments passed when you issue the command to start the NodeJS process. The command-line arguments are stored as an array inside the property. As you can see from the log result above, the argv property contains a single array.

What is process CWD?

process. cwd() returns the current working directory, i.e. the directory from which you invoked the node command. __dirname returns the directory name of the directory containing the JavaScript source code file.

What is process Hrtime?

The process. hrtime() method to measure code execution time which returns array which include current high-resolution real time in a [seconds, nanoseconds].


1 Answers

process.ARGV has been removed entirely since v0.5.10.

like image 86
Matthew Flaschen Avatar answered Sep 20 '22 05:09

Matthew Flaschen