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

Problem

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.

Problem courtesy of: erikvold

Solution

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

Solution courtesy of: Jörg W Mittag

View additional discussion.