0

i'm asking myself if it is possible to see where the user is launching the program from ?
Example : script is in /home/user1/test.js, and the user is inside /home/user1/a-dir/, when he enters
$ node ../test.js
Is it possible to get where the user launched the program from ? (In this case, /home/user1/a-dir/ )

Thanks.

  • 2
    possible duplicate of [Determine command line working directory when running node bin script](http://stackoverflow.com/questions/12238477/determine-command-line-working-directory-when-running-node-bin-script) – Alexander O'Mara Jun 29 '15 at 16:18

1 Answers1

1

You can get the current directory of the process with process.cwd().

Calin
  • 2,110
  • 1
  • 21
  • 36