get dir of current script

nodejs Директория текущего скрипта

Текущую директорию можно получить так:

import { fileURLToPath } from 'url';
import { dirname } from 'path';
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);

Источник: https://stackoverflow.com/a/62892482

Subscribe to RSS - get dir of current script