nodejs get root directory as a npm package code example Example: nodejs fs root folder path global.__basedir = __dirname;