• Tutorials Logic, IN
  • +91 8092939553
  • info@tutorialslogic.com

NodeJS Path Modules

Path Modules

The NodeJS path module is used to handle and transform files paths. This module provides a way of working with directories and file paths in NodeJS. To include the path module, use the require() method:-

										    
											var path = require('path');
											
										

The NodeJS path module is one of the very important modules, which provides various methods to deal with files paths, which includes the following:-

Path Module MethodDescription
basename()It returns the last portion of a path.
dirname()It return the directory name of a path.
extname()It returns the file extension of a path.
format()It formats a path object into a path string.
isAbsolute()It returns true if a path is an absolute path, else it returns false.
join()It joins the specified paths into one.
normalize()It normalizes the specified path.
parse()It returns an object from a path string.
relative()It returns the relative path from one specified path to another specified path.
resolve()It resolves the specified paths into an absolute path.