title: How can one get the file path of the caller function in node.js?
body: <p>Here is some sample code from three files:</p>
  
  <pre><code>// foo.js
  var myFunc = require("./myFunc");
  function foo(){
     myFunc("message");
  }
  
  // bar.js
  var myFunc = require("./myFunc");
  function bar(){
     myFunc("message");
  }
  
  // myFunc.js
  module.exports = myFunc;
  function myFunc(arg1){
     console.log(arg1);
     // Here I need the file path of the caller function
     // For example, "/path/to/foo.js" and "/path/to/bar.js"
  }
  </code></pre>
  
  <p>I need to get the file path of the caller function dynamically, without any extra argument passing, for <code>myFunc</code>.</p>