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?
Say I run a Node script from /foo/bar , though the script itself is
Share
What you want is
process.cwd(), which returns the current working directory of the Node.js process.