Node.js | path.join() Method
The path.join() method is used to join a number of path-segments using the platform-specific delimiter to form a single path. The final path is normalized after the joining takes place. The path-segments are specified using comma-separated values.
path.join( [...paths] )
Parameters: This function accepts one parameter as mentioned above and described below:
- paths: It is a comma-separated sequence of paths that would be joined together to make the final path.
Return Value: It returns a string with the complete normalized path containing all the segments.
Below examples illustrate the path.join() method in Node.js:
users\admin\files\index.html users\geeks\website\index.html users\index.html
files\readme.md . Dirname: G:\tutorials\nodejs-path-join Directory above: G:\tutorials