Created
July 12, 2022 09:27
-
-
Save Kirill89/7f76f5bd36f878cbc5f03218b9e10620 to your computer and use it in GitHub Desktop.
How to get __dirname in mjs
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 'node:path'; | |
import {fileURLToPath} from 'node:url'; | |
const SCRIPT_FOLDER = path.dirname(fileURLToPath(import.meta.url)); | |
const DATA_FOLDER = path.join(SCRIPT_FOLDER, 'data'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment