Nodejs: get filename of caller function

前端 未结 7 1208
心在旅途
心在旅途 2020-11-30 03:41

I wonder how-to get an absolute path of a caller of a function?

Let say that:

in file a.js I call b(); b() is a functi

相关标签:
7条回答
  • 2020-11-30 04:09

    Use https://github.com/sindresorhus/callsites

    If you use the first answer you could mess up with other libraries trying to do the same thing. See for example: https://github.com/facebook/jest/issues/5303

    0 讨论(0)
提交回复
热议问题