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

安稳与你 提交于 2019-12-25 04:21:46

问题


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.


回答1:


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



来源:https://stackoverflow.com/questions/22213792/how-do-i-find-the-current-working-directory-of-a-node-js-program-to-store-in-a-v

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!