Skip to content

adriancmiranda/read-argv

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

read-argv

Read the process.argv as an object

The 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 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:

const readArgv = require('read-argv');

const argv = readArgv(process.argv);
const files = argv._;
const args = argv.$.slice(3);