__dirname is the directory of the currently executing module (which is not necessarily the working directory). And path.join() adds a directory to a path with a platform specific separator, i.e. / on posix and \ on windows. So if you’re running say node /home/winzip/foo.js, which require()s ./bar/baz.js, which again goes like