diff --git a/doc/api/process.md b/doc/api/process.md index 5718c83e4fbcf4..2f069bd35ab7d5 100644 --- a/doc/api/process.md +++ b/doc/api/process.md @@ -958,6 +958,32 @@ $ bash -c 'exec -a customArgv0 ./node' 'customArgv0' ``` +## `process.argv1` + + + +* {string | undefined} + +The `process.argv1` property stores a read-only copy of the original value of +`argv[1]` passed when Node.js starts. + +```js +// test.js +console.log('argv1 ', process.argv1); +console.log('argv[1]', process.argv[1]); +``` + +```console +$ node ./test.js +argv1 ./test.js +argv[1] /absolute/path/to/test.js +``` + +`process.argv1` is `undefined` for cases where Node.js is run without a main +entry point (such as `node --eval`) and within worker threads. + ## `process.channel`