Argv (NodeJS)
Releases |
Latest () |
Pre () |
|
|
|
|
|
|
📝 Description
A NodeJS module to correctly slice off process.argv
.
📚 Documentation
Getting Started
- NodeJS ^ v12.20.0 || ^ v14.15.0 || >= v16.13.0
npm install @hugoalh/argv
/* Either */
import { ... } from "@hugoalh/argv";// Named Import
import * as argv from "@hugoalh/argv";// Namespace Import
API
Value
args
: <string[]>
Additional command line arguments.
binIndex
: <0 | 1>
Index of bin in process.argv
.
binPath
: <string>
Path of the file is execute.
isBundledElectronJSProgram
: <boolean>
Whether the process is execute from bundled ElectronJS program.
isElectronJSProgram
: <boolean>
Whether the process is execute from ElectronJS program.
isUnbundledElectronJSProgram
: <boolean>
Whether the process is execute from unbundled ElectronJS program.
programPath
: <string>
Path of the executable file is execute.
Example
argv.________ |
node bin.js args1 args2 ...argsn |
bin args1 args2 ...argsn |
electron bin.js args1 args2 ...argsn |
args |
["args1", "args2", ..., "argsn"] |
["args1", "args2", ..., "argsn"] |
["args1", "args2", ..., "argsn"] |
binIndex |
1 |
0 |
1 |
binPath |
"/path-to/bin.js" |
"/path-to/bin" |
"/path-to/bin.js" |
isBundledElectronJSProgram |
false |
true |
false |
isElectronJSProgram |
false |
true |
true |
isUnbundledElectronJSProgram |
false |
false |
true |
programPath |
"/path-to/node" |
"/path-to/bin" |
"/path-to/electron" |