Search code examples
javascriptnode.jsnarwhal

Passing args to a JS command line utility (Node or Narwhal)


I want to use NodeJS or Narwhal to create a JS utility which takes an argument, like so:

$ node myscript.js http://someurl.com/for/somefile.js

or

$ js myscript.js http://someurl.com/for/somefile.js

but I'm wondering how I can get that argument within my script, or if that is even possible atm?

Thanks.


Solution

  • On Node.JS, that information is available in process.argv.