leeand00
leeand00

Reputation: 26402

How do I find the current working directory of a node.js program to store in a variable?

I wish to store the directory my node.js script has been run from in a variable, how would I do this?

The fs module documentation doesn't seem to hold an answer to this.

Upvotes: 0

Views: 64

Answers (1)

karliwson
karliwson

Reputation: 3485

What you are looking for is __dirname: http://nodejs.org/docs/latest/api/globals.html#globals_dirname

Upvotes: 1

Related Questions