node.js - Path of the requiring script inside the required script -


i have 2 scripts: first requiring second.

1st script main.js:

... var = require(second); ... 

2d. script second.js

path = path/of/the/main/script 

i want access path of first script within second script without passing argument. way achieve it?

module.parent.filename holds file name of calling script. see here more information.


Comments