Tuesday 2 October 2018

__filename: Absolute path of the current module file

__filename returns the absolute path of the current module.

HelloWorld.js
console.log("HelloWorld.js fiel is located at %s", __dirname);
console.log("HelloWorld.js file absolute path %s",__filename);

Output
HelloWorld.js fiel is located at C:\Users\krishna\Documents\nodejs\examples
HelloWorld.js file absolute path
C:\Users\krishna\Documents\nodejs\examples\HelloWorld.js




Previous                                                 Next                                                 Home

No comments:

Post a Comment