__dirname

import { dirname } from "path";
import { fileURLToPath } from "url";

const __dirname = dirname(fileURLToPath(import.meta.url)); 
const data = await readFile(__dirname + path);


Préférez vous peut être cette écriture ! 

import { URL } from "node:url";

const data = await readFile(new URL(path, import.meta.url));