https://github.com/adriancmiranda/read-argv
Read the process.argv as an object
https://github.com/adriancmiranda/read-argv
argv process
Last synced: 2 months ago
JSON representation
Read the process.argv as an object
- Host: GitHub
- URL: https://github.com/adriancmiranda/read-argv
- Owner: adriancmiranda
- License: mit
- Created: 2018-05-06T23:14:01.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2018-05-06T23:33:58.000Z (about 7 years ago)
- Last Synced: 2024-10-18T07:05:32.136Z (7 months ago)
- Topics: argv, process
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/read-argv
- Size: 2.93 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# read-argv
> Read the _[process.argv](https://nodejs.org/docs/latest/api/process.html#process_process_argv)_ as an objectThe [process.argv](https://nodejs.org/docs/latest/api/process.html#process_process_argv) property returns an array containing the command line arguments passed when the Node.js process was launched. The first element will be [process.execPath](https://nodejs.org/docs/latest/api/process.html#process_process_execpath) which will be read by the underscore variable. See **process.argv0** if access to the original value of **argv[0]** is needed. The second element will be the path to the JavaScript file being executed which will also be read by the underscore. The remaining elements will be any additional command line arguments.
## Usage:
```js
const readArgv = require('read-argv');const argv = readArgv(process.argv);
const files = argv._;
const args = argv.$.slice(3);
```