Skip to main content

Node Global Object ↔ Top-Level Object access within Node.js w/o req CommonJS import

__dirname

Node Global Object to return string of directory path name containing file

__filename

Node Global Object to return string of full path to file

exports

global

global namespace object in Node.js

os

process

Node Global Object with info on current process instance (JS file being executed)

Source: Process | Node.js v18.3.0 Documentation

References

  1. __dirnameNode Global Object to return string of directory path name containing file

  2. __filenameNode Global Object to return string of full path to file

  3. processNode Global Object with info on current process instance (JS file being executed)