node:path
The built-in Node.js module for building and taking apart file paths correctly on every operating system.
In more detail
path.join("a", "b") uses / on Linux and macOS and \ on Windows, so paths built with it work everywhere. Use path.resolve() to turn a relative path into an absolute one.
Related terms
- node:fs — The built-in Node.js module for working with files and folders, in promise, callback and synchronous forms.
- directory — A folder: a named container in a filesystem that holds files and other directories.
Taught in
- Asynchronous File I/O: node:fs/promises & Handles — Node.js Internals & Backend Services
- Directory Traversal: Recursive Readdir & fs.watch — Node.js Internals & Backend Services