Nodejs commandline

From wikinotes
Revision as of 19:09, 23 May 2021 by Will (talk | contribs) (→‎Running Code)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Most cli related code resides in:


Running Code

node script.js foo bar baz

Parsing Arguments

process.argv     // string array of cli args
process.exit(1)  // exit with process exit-code

stdout, stderr, stdin

console.log('hello world')    # print to stdout
console.error('hello world')  # print to stderr
process.stdin