The process.cwd() method returns the current working directory of the Node.js process.
process.cwd()
import { cwd } from 'node:process';console.log(`Current directory: ${cwd()}`);
v0.1.8