What is the purpose of __filename variable?

Technology CommunityCategory: Node.jsWhat is the purpose of __filename variable?
VietMX Staff asked 3 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.