node.js get relative to project/src path of file August 13, 2023 by Tarik You can use path.relative: var relativePath = path.relative(process.cwd(), someFilePath);