Created
November 18, 2022 14:56
-
-
Save himalay/c3f8ee776b2f9aa20c493cd0784ca495 to your computer and use it in GitHub Desktop.
Nodejs Global Variables in ES Module
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import path from 'path'; | |
import {fileURLToPath} from 'url'; | |
const __filename = fileURLToPath(import.meta.url); | |
const __dirname = path.dirname(__filename); | |
console.log('file-name 👉️', __filename); | |
console.log('directory-name 👉️', __dirname); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment