What does the path module do and why use it?

Node.js modules, files and async · Freshers

Model answer

path builds and parses file paths correctly across operating systems: path.join('a', 'b'), path.resolve, path.extname. Use it instead of joining strings with slashes. In ES modules, get the current directory from import.meta.dirname (newer Node) or fileURLToPath(import.meta.url).

Learn this topic

Async JavaScript in Node: Promises, async/await and the Event Loop in the course Node.js and Express: Build a Back End API from Scratch.

Sign in to add your own answer.

More questions