What is the purpose of __filename variable?

Technology Community › Category: Node.js › What is the purpose of __filename variable?
VietMX Staff asked 5 years ago

The __filename represents the filename of the code being executed. This is the resolved absolute path of this code file. For a main program this is not necessarily the same filename used in the command line. The value inside a module is the path to that module file.