module.exports = path.dirname(process.mainModule.filename)
process.mainModule.filename is deprecated in nodejs. Is there any alternative method to get a current directory of the file?
CodePudding user response:
- The entry point of the current application can be obtained by checking
require.main.filename
. __dirname
gets you the directory the module is in.process.cwd()
gets the current working directory.
Chances are you want one of these.