如何找到node.js程序的当前工作目录以存储变量?

问题描述:

我想存储我的node.js脚本已经在一个变量中运行的目录,我该怎么做?如何找到node.js程序的当前工作目录以存储变量?

fs module documentation似乎并没有答案。

+0

错!看到这个问题:http://stackoverflow.com/questions/22209709/storing-the-directory-in-a-variable-that-a-node-js-script-has-been-run-from?lq=1 – leeand00

+0

@ leeand00错了什么? – karliwson