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

Popular posts from this blog

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -

java - JavaFX 2 slider labelFormatter not being used -