Quantcast
Channel: Node: How to get the dirname where a script was called from? - Stack Overflow
Browsing all 2 articles
Browse latest View live

Answer by JohnnyHK for Node: How to get the dirname where a script was called...

What you want is process.cwd(), which returns the current working directory of the Node.js process.

View Article



Node: How to get the dirname where a script was called from?

Say I run a Node script from /foo/bar, though the script itself is located somewhere else (e.g. node_modules). Is there a way to get the working directory where the script was called from, i.e. /foo/bar?

View Article
Browsing all 2 articles
Browse latest View live




Latest Images