Path

Path

The path module provides functions for file and directory paths. Use require('path') to access this module.

isAbsolute(path)

  • path <string>
  • Returns: <boolean>

Determines if the given path is absolute or not.

format(pathObj)

  • pathObj <object>
    • root <string>
    • dir <string>
    • base <string>
    • name <string>
    • ext <string>
  • Returns: <string>

Returns a formatted path string from a given path object.

parse(path)

  • path <string>
  • Returns: <object>
    • root <string>
    • dir <string>
    • base <string>
    • name <string>
    • ext <string>

Returns a path object parsed from a given path string.

normalize(path)

  • path <string>
  • Returns: <string>

Normalizes the given path, resolving '.' and '..' segments.

join(...paths)

  • ...paths <string[]>
  • Returns: <string>

Joins all path segments together.

resolve(...paths)

  • ...paths <string[]>
  • Returns: <string>

Resolves a sequence of path segments into an absolute path.

sep

  • <string>

Path segment separator.