I found it after looking through the documentation again. What I was looking for were the __filename
and __dirname
module-level variables.
__filename
is the file name of the current module. This is the resolved absolute path of the current module file. (ex:/home/kyle/some/dir/file.js
)__dirname
is the directory name of the current module. (ex:/home/kyle/some/dir
)
Related Contents:
- npm WARN package.json: No repository field
- TypeScript getting error TS2304: cannot find name ‘ require’
- Remove directory which is not empty
- npm – how to show the latest version of a package
- node.js require() cache – possible to invalidate?
- static files with express.js
- Error: unable to verify the first certificate in nodejs
- Nodemon Error: System limit for number of file watchers reached
- Node package ( Grunt ) installed but not available
- npm – install dependencies for a package in a different folder?
- Global npm install location on windows?
- How to display nodejs raw Buffer data as Hex string
- passport.js passport.initialize() middleware not in use
- How can I solve error gypgyp ERR!ERR! find VSfind VS msvs_version not set from command line or npm config?
- Using SHA-256 with NodeJS Crypto
- webSocketServer node.js how to differentiate clients
- Trouble install node.js with homebrew
- Where does elastic beanstalk t2 server store my node.js app files?
- how to stop node.js server
- How to disable WebStorm semicolon check?
- Username and Password not accepted when using nodemailer?
- Comments in Jade/pug
- CouchDB and Node.js – What module do you recommend? [closed]
- How to fix eslintrc The file does not match your project config?
- Read all text from stdin to a string
- Express routes parameter conditions
- Node.js or Express.js REST API document generator
- Get/View Memory & CPU usage via NodeJS
- MongoDB + nodejs : how to query ISODate fields?
- When installing a package with NPM, can you tell it to use a different version of one of its dependencies?
- npm run dev fails : ValidationError: Invalid options object
- What is the purpose of “pm2 save”?
- Docker Node Alpine Image Build Fails on node-gyp
- npm install without ssl
- Read remote file with node.js (http.get)
- How to run production site after build vue cli
- Sharp image library rotates image when resizing?
- How to retry 5xx requests using axios
- Unable to Change Favicon with Express.js
- Using Heroku Scheduler with Node.js
- NPM private git module on Heroku
- Getting GLIBC_2.28 not found
- “Cannot use import statement outside a module” with Axios
- What does “#!/bin/env” mean (at the top of a node.js script)?
- Is socket.io emit callback appropriate?
- Getting Error 402 while publishing package using npm
- How to access Google Chrome’s IndexedDB/LevelDB files?
- Sails.js populate nested associations
- How I can use “LIKE” operator on mongoose?
- when to disconnect and when to end a pg client or pool