Options
All
  • Public
  • Public/Protected
  • All
Menu

Module "canonical-path"

Index

Variables

Const delimiter

delimiter: ";" | ":"

The platform-specific file delimiter. ';' or ':'. The platform-specific file delimiter. ';' or ':'. The platform-specific file delimiter. ';' or ':'. The platform-specific file delimiter. ';' or ':'. The platform-specific file delimiter. ';' or ':'. The platform-specific file delimiter. ';' or ':'. The platform-specific file delimiter. ';' or ':'.

Const sep

sep: "\" | "/"

The platform-specific file separator. '\' or '/'. The platform-specific file separator. '\' or '/'. The platform-specific file separator. '\' or '/'. The platform-specific file separator. '\' or '/'. The platform-specific file separator. '\' or '/'. The platform-specific file separator. '\' or '/'. The platform-specific file separator. '\' or '/'.

Functions

basename

  • basename(p: string, ext?: string): string
  • basename(p: string, ext?: string): string
  • basename(p: string, ext?: string): string
  • basename(p: string, ext?: string): string
  • basename(p: string, ext?: string): string
  • basename(p: string, ext?: string): string
  • basename(p: string, ext?: string): string
  • Return the last portion of a path. Similar to the Unix basename command. Often used to extract the file name from a fully qualified path.

    Parameters

    • p: string

      the path to evaluate.

    • Optional ext: string

      optionally, an extension to remove from the result.

    Returns string

  • Return the last portion of a path. Similar to the Unix basename command. Often used to extract the file name from a fully qualified path.

    Parameters

    • p: string

      the path to evaluate.

    • Optional ext: string

      optionally, an extension to remove from the result.

    Returns string

  • Return the last portion of a path. Similar to the Unix basename command. Often used to extract the file name from a fully qualified path.

    Parameters

    • p: string

      the path to evaluate.

    • Optional ext: string

      optionally, an extension to remove from the result.

    Returns string

  • Return the last portion of a path. Similar to the Unix basename command. Often used to extract the file name from a fully qualified path.

    Parameters

    • p: string

      the path to evaluate.

    • Optional ext: string

      optionally, an extension to remove from the result.

    Returns string

  • Return the last portion of a path. Similar to the Unix basename command. Often used to extract the file name from a fully qualified path.

    Parameters

    • p: string

      the path to evaluate.

    • Optional ext: string

      optionally, an extension to remove from the result.

    Returns string

  • Return the last portion of a path. Similar to the Unix basename command. Often used to extract the file name from a fully qualified path.

    Parameters

    • p: string

      the path to evaluate.

    • Optional ext: string

      optionally, an extension to remove from the result.

    Returns string

  • Return the last portion of a path. Similar to the Unix basename command. Often used to extract the file name from a fully qualified path.

    Parameters

    • p: string

      the path to evaluate.

    • Optional ext: string

      optionally, an extension to remove from the result.

    Returns string

canonical

  • canonical(p: string): string
  • canonical(p: string): string
  • canonical(p: string): string
  • canonical(p: string): string
  • canonical(p: string): string
  • canonical(p: string): string
  • canonical(p: string): string
  • Returns the canonical form of a path.

    Parameters

    • p: string

      the path to make canonical.

    Returns string

  • Returns the canonical form of a path.

    Parameters

    • p: string

      the path to make canonical.

    Returns string

  • Returns the canonical form of a path.

    Parameters

    • p: string

      the path to make canonical.

    Returns string

  • Returns the canonical form of a path.

    Parameters

    • p: string

      the path to make canonical.

    Returns string

  • Returns the canonical form of a path.

    Parameters

    • p: string

      the path to make canonical.

    Returns string

  • Returns the canonical form of a path.

    Parameters

    • p: string

      the path to make canonical.

    Returns string

  • Returns the canonical form of a path.

    Parameters

    • p: string

      the path to make canonical.

    Returns string

dirname

  • dirname(p: string): string
  • dirname(p: string): string
  • dirname(p: string): string
  • dirname(p: string): string
  • dirname(p: string): string
  • dirname(p: string): string
  • dirname(p: string): string
  • Return the directory name of a path. Similar to the Unix dirname command.

    Parameters

    • p: string

      the path to evaluate.

    Returns string

  • Return the directory name of a path. Similar to the Unix dirname command.

    Parameters

    • p: string

      the path to evaluate.

    Returns string

  • Return the directory name of a path. Similar to the Unix dirname command.

    Parameters

    • p: string

      the path to evaluate.

    Returns string

  • Return the directory name of a path. Similar to the Unix dirname command.

    Parameters

    • p: string

      the path to evaluate.

    Returns string

  • Return the directory name of a path. Similar to the Unix dirname command.

    Parameters

    • p: string

      the path to evaluate.

    Returns string

  • Return the directory name of a path. Similar to the Unix dirname command.

    Parameters

    • p: string

      the path to evaluate.

    Returns string

  • Return the directory name of a path. Similar to the Unix dirname command.

    Parameters

    • p: string

      the path to evaluate.

    Returns string

extname

  • extname(p: string): string
  • extname(p: string): string
  • extname(p: string): string
  • extname(p: string): string
  • extname(p: string): string
  • extname(p: string): string
  • extname(p: string): string
  • Return the extension of the path, from the last '.' to end of string in the last portion of the path. If there is no '.' in the last portion of the path or the first character of it is '.', then it returns an empty string

    Parameters

    • p: string

      the path to evaluate.

    Returns string

  • Return the extension of the path, from the last '.' to end of string in the last portion of the path. If there is no '.' in the last portion of the path or the first character of it is '.', then it returns an empty string

    Parameters

    • p: string

      the path to evaluate.

    Returns string

  • Return the extension of the path, from the last '.' to end of string in the last portion of the path. If there is no '.' in the last portion of the path or the first character of it is '.', then it returns an empty string

    Parameters

    • p: string

      the path to evaluate.

    Returns string

  • Return the extension of the path, from the last '.' to end of string in the last portion of the path. If there is no '.' in the last portion of the path or the first character of it is '.', then it returns an empty string

    Parameters

    • p: string

      the path to evaluate.

    Returns string

  • Return the extension of the path, from the last '.' to end of string in the last portion of the path. If there is no '.' in the last portion of the path or the first character of it is '.', then it returns an empty string

    Parameters

    • p: string

      the path to evaluate.

    Returns string

  • Return the extension of the path, from the last '.' to end of string in the last portion of the path. If there is no '.' in the last portion of the path or the first character of it is '.', then it returns an empty string

    Parameters

    • p: string

      the path to evaluate.

    Returns string

  • Return the extension of the path, from the last '.' to end of string in the last portion of the path. If there is no '.' in the last portion of the path or the first character of it is '.', then it returns an empty string

    Parameters

    • p: string

      the path to evaluate.

    Returns string

format

  • format(pathObject: FormatInputPathObject): string
  • format(pathObject: FormatInputPathObject): string
  • format(pathObject: FormatInputPathObject): string
  • format(pathObject: FormatInputPathObject): string
  • format(pathObject: FormatInputPathObject): string
  • format(pathObject: FormatInputPathObject): string
  • format(pathObject: FormatInputPathObject): string
  • Returns a path string from an object - the opposite of parse().

    Parameters

    • pathObject: FormatInputPathObject

    Returns string

  • Returns a path string from an object - the opposite of parse().

    Parameters

    • pathObject: FormatInputPathObject

    Returns string

  • Returns a path string from an object - the opposite of parse().

    Parameters

    • pathObject: FormatInputPathObject

    Returns string

  • Returns a path string from an object - the opposite of parse().

    Parameters

    • pathObject: FormatInputPathObject

    Returns string

  • Returns a path string from an object - the opposite of parse().

    Parameters

    • pathObject: FormatInputPathObject

    Returns string

  • Returns a path string from an object - the opposite of parse().

    Parameters

    • pathObject: FormatInputPathObject

    Returns string

  • Returns a path string from an object - the opposite of parse().

    Parameters

    • pathObject: FormatInputPathObject

    Returns string

isAbsolute

  • isAbsolute(path: string): boolean
  • isAbsolute(path: string): boolean
  • isAbsolute(path: string): boolean
  • isAbsolute(path: string): boolean
  • isAbsolute(path: string): boolean
  • isAbsolute(path: string): boolean
  • isAbsolute(path: string): boolean
  • Determines whether {path} is an absolute path. An absolute path will always resolve to the same location, regardless of the working directory.

    Parameters

    • path: string

      path to test.

    Returns boolean

  • Determines whether {path} is an absolute path. An absolute path will always resolve to the same location, regardless of the working directory.

    Parameters

    • path: string

      path to test.

    Returns boolean

  • Determines whether {path} is an absolute path. An absolute path will always resolve to the same location, regardless of the working directory.

    Parameters

    • path: string

      path to test.

    Returns boolean

  • Determines whether {path} is an absolute path. An absolute path will always resolve to the same location, regardless of the working directory.

    Parameters

    • path: string

      path to test.

    Returns boolean

  • Determines whether {path} is an absolute path. An absolute path will always resolve to the same location, regardless of the working directory.

    Parameters

    • path: string

      path to test.

    Returns boolean

  • Determines whether {path} is an absolute path. An absolute path will always resolve to the same location, regardless of the working directory.

    Parameters

    • path: string

      path to test.

    Returns boolean

  • Determines whether {path} is an absolute path. An absolute path will always resolve to the same location, regardless of the working directory.

    Parameters

    • path: string

      path to test.

    Returns boolean

join

  • join(...paths: string[]): string
  • join(...paths: string[]): string
  • join(...paths: string[]): string
  • join(...paths: string[]): string
  • join(...paths: string[]): string
  • join(...paths: string[]): string
  • join(...paths: string[]): string
  • Join all arguments together and normalize the resulting path. Arguments must be strings. In v0.8, non-string arguments were silently ignored. In v0.10 and up, an exception is thrown.

    Parameters

    • Rest ...paths: string[]

      paths to join.

    Returns string

  • Join all arguments together and normalize the resulting path. Arguments must be strings. In v0.8, non-string arguments were silently ignored. In v0.10 and up, an exception is thrown.

    Parameters

    • Rest ...paths: string[]

      paths to join.

    Returns string

  • Join all arguments together and normalize the resulting path. Arguments must be strings. In v0.8, non-string arguments were silently ignored. In v0.10 and up, an exception is thrown.

    Parameters

    • Rest ...paths: string[]

      paths to join.

    Returns string

  • Join all arguments together and normalize the resulting path. Arguments must be strings. In v0.8, non-string arguments were silently ignored. In v0.10 and up, an exception is thrown.

    Parameters

    • Rest ...paths: string[]

      paths to join.

    Returns string

  • Join all arguments together and normalize the resulting path. Arguments must be strings. In v0.8, non-string arguments were silently ignored. In v0.10 and up, an exception is thrown.

    Parameters

    • Rest ...paths: string[]

      paths to join.

    Returns string

  • Join all arguments together and normalize the resulting path. Arguments must be strings. In v0.8, non-string arguments were silently ignored. In v0.10 and up, an exception is thrown.

    Parameters

    • Rest ...paths: string[]

      paths to join.

    Returns string

  • Join all arguments together and normalize the resulting path. Arguments must be strings. In v0.8, non-string arguments were silently ignored. In v0.10 and up, an exception is thrown.

    Parameters

    • Rest ...paths: string[]

      paths to join.

    Returns string

normalize

  • normalize(p: string): string
  • normalize(p: string): string
  • normalize(p: string): string
  • normalize(p: string): string
  • normalize(p: string): string
  • normalize(p: string): string
  • normalize(p: string): string
  • Normalize a string path, reducing '..' and '.' parts. When multiple slashes are found, they're replaced by a single one; when the path contains a trailing slash, it is preserved. On Windows backslashes are used.

    Parameters

    • p: string

      string path to normalize.

    Returns string

  • Normalize a string path, reducing '..' and '.' parts. When multiple slashes are found, they're replaced by a single one; when the path contains a trailing slash, it is preserved. On Windows backslashes are used.

    Parameters

    • p: string

      string path to normalize.

    Returns string

  • Normalize a string path, reducing '..' and '.' parts. When multiple slashes are found, they're replaced by a single one; when the path contains a trailing slash, it is preserved. On Windows backslashes are used.

    Parameters

    • p: string

      string path to normalize.

    Returns string

  • Normalize a string path, reducing '..' and '.' parts. When multiple slashes are found, they're replaced by a single one; when the path contains a trailing slash, it is preserved. On Windows backslashes are used.

    Parameters

    • p: string

      string path to normalize.

    Returns string

  • Normalize a string path, reducing '..' and '.' parts. When multiple slashes are found, they're replaced by a single one; when the path contains a trailing slash, it is preserved. On Windows backslashes are used.

    Parameters

    • p: string

      string path to normalize.

    Returns string

  • Normalize a string path, reducing '..' and '.' parts. When multiple slashes are found, they're replaced by a single one; when the path contains a trailing slash, it is preserved. On Windows backslashes are used.

    Parameters

    • p: string

      string path to normalize.

    Returns string

  • Normalize a string path, reducing '..' and '.' parts. When multiple slashes are found, they're replaced by a single one; when the path contains a trailing slash, it is preserved. On Windows backslashes are used.

    Parameters

    • p: string

      string path to normalize.

    Returns string

parse

  • parse(pathString: string): ParsedPath
  • parse(pathString: string): ParsedPath
  • parse(pathString: string): ParsedPath
  • parse(pathString: string): ParsedPath
  • parse(pathString: string): ParsedPath
  • parse(pathString: string): ParsedPath
  • parse(pathString: string): ParsedPath
  • Returns an object from a path string - the opposite of format().

    Parameters

    • pathString: string

      path to evaluate.

    Returns ParsedPath

  • Returns an object from a path string - the opposite of format().

    Parameters

    • pathString: string

      path to evaluate.

    Returns ParsedPath

  • Returns an object from a path string - the opposite of format().

    Parameters

    • pathString: string

      path to evaluate.

    Returns ParsedPath

  • Returns an object from a path string - the opposite of format().

    Parameters

    • pathString: string

      path to evaluate.

    Returns ParsedPath

  • Returns an object from a path string - the opposite of format().

    Parameters

    • pathString: string

      path to evaluate.

    Returns ParsedPath

  • Returns an object from a path string - the opposite of format().

    Parameters

    • pathString: string

      path to evaluate.

    Returns ParsedPath

  • Returns an object from a path string - the opposite of format().

    Parameters

    • pathString: string

      path to evaluate.

    Returns ParsedPath

relative

  • relative(from: string, to: string): string
  • relative(from: string, to: string): string
  • relative(from: string, to: string): string
  • relative(from: string, to: string): string
  • relative(from: string, to: string): string
  • relative(from: string, to: string): string
  • relative(from: string, to: string): string
  • Solve the relative path from {from} to {to}. At times we have two absolute paths, and we need to derive the relative path from one to the other. This is actually the reverse transform of path.resolve.

    Parameters

    • from: string
    • to: string

    Returns string

  • Solve the relative path from {from} to {to}. At times we have two absolute paths, and we need to derive the relative path from one to the other. This is actually the reverse transform of path.resolve.

    Parameters

    • from: string
    • to: string

    Returns string

  • Solve the relative path from {from} to {to}. At times we have two absolute paths, and we need to derive the relative path from one to the other. This is actually the reverse transform of path.resolve.

    Parameters

    • from: string
    • to: string

    Returns string

  • Solve the relative path from {from} to {to}. At times we have two absolute paths, and we need to derive the relative path from one to the other. This is actually the reverse transform of path.resolve.

    Parameters

    • from: string
    • to: string

    Returns string

  • Solve the relative path from {from} to {to}. At times we have two absolute paths, and we need to derive the relative path from one to the other. This is actually the reverse transform of path.resolve.

    Parameters

    • from: string
    • to: string

    Returns string

  • Solve the relative path from {from} to {to}. At times we have two absolute paths, and we need to derive the relative path from one to the other. This is actually the reverse transform of path.resolve.

    Parameters

    • from: string
    • to: string

    Returns string

  • Solve the relative path from {from} to {to}. At times we have two absolute paths, and we need to derive the relative path from one to the other. This is actually the reverse transform of path.resolve.

    Parameters

    • from: string
    • to: string

    Returns string

resolve

  • resolve(...pathSegments: string[]): string
  • resolve(...pathSegments: string[]): string
  • resolve(...pathSegments: string[]): string
  • resolve(...pathSegments: string[]): string
  • resolve(...pathSegments: string[]): string
  • resolve(...pathSegments: string[]): string
  • resolve(...pathSegments: string[]): string
  • The right-most parameter is considered {to}. Other parameters are considered an array of {from}.

    Starting from leftmost {from} paramter, resolves {to} to an absolute path.

    If {to} isn't already absolute, {from} arguments are prepended in right to left order, until an absolute path is found. If after using all {from} paths still no absolute path is found, the current working directory is used as well. The resulting path is normalized, and trailing slashes are removed unless the path gets resolved to the root directory.

    Parameters

    • Rest ...pathSegments: string[]

      string paths to join. Non-string arguments are ignored.

    Returns string

  • The right-most parameter is considered {to}. Other parameters are considered an array of {from}.

    Starting from leftmost {from} paramter, resolves {to} to an absolute path.

    If {to} isn't already absolute, {from} arguments are prepended in right to left order, until an absolute path is found. If after using all {from} paths still no absolute path is found, the current working directory is used as well. The resulting path is normalized, and trailing slashes are removed unless the path gets resolved to the root directory.

    Parameters

    • Rest ...pathSegments: string[]

      string paths to join. Non-string arguments are ignored.

    Returns string

  • The right-most parameter is considered {to}. Other parameters are considered an array of {from}.

    Starting from leftmost {from} paramter, resolves {to} to an absolute path.

    If {to} isn't already absolute, {from} arguments are prepended in right to left order, until an absolute path is found. If after using all {from} paths still no absolute path is found, the current working directory is used as well. The resulting path is normalized, and trailing slashes are removed unless the path gets resolved to the root directory.

    Parameters

    • Rest ...pathSegments: string[]

      string paths to join. Non-string arguments are ignored.

    Returns string

  • The right-most parameter is considered {to}. Other parameters are considered an array of {from}.

    Starting from leftmost {from} paramter, resolves {to} to an absolute path.

    If {to} isn't already absolute, {from} arguments are prepended in right to left order, until an absolute path is found. If after using all {from} paths still no absolute path is found, the current working directory is used as well. The resulting path is normalized, and trailing slashes are removed unless the path gets resolved to the root directory.

    Parameters

    • Rest ...pathSegments: string[]

      string paths to join. Non-string arguments are ignored.

    Returns string

  • The right-most parameter is considered {to}. Other parameters are considered an array of {from}.

    Starting from leftmost {from} paramter, resolves {to} to an absolute path.

    If {to} isn't already absolute, {from} arguments are prepended in right to left order, until an absolute path is found. If after using all {from} paths still no absolute path is found, the current working directory is used as well. The resulting path is normalized, and trailing slashes are removed unless the path gets resolved to the root directory.

    Parameters

    • Rest ...pathSegments: string[]

      string paths to join. Non-string arguments are ignored.

    Returns string

  • The right-most parameter is considered {to}. Other parameters are considered an array of {from}.

    Starting from leftmost {from} paramter, resolves {to} to an absolute path.

    If {to} isn't already absolute, {from} arguments are prepended in right to left order, until an absolute path is found. If after using all {from} paths still no absolute path is found, the current working directory is used as well. The resulting path is normalized, and trailing slashes are removed unless the path gets resolved to the root directory.

    Parameters

    • Rest ...pathSegments: string[]

      string paths to join. Non-string arguments are ignored.

    Returns string

  • The right-most parameter is considered {to}. Other parameters are considered an array of {from}.

    Starting from leftmost {from} paramter, resolves {to} to an absolute path.

    If {to} isn't already absolute, {from} arguments are prepended in right to left order, until an absolute path is found. If after using all {from} paths still no absolute path is found, the current working directory is used as well. The resulting path is normalized, and trailing slashes are removed unless the path gets resolved to the root directory.

    Parameters

    • Rest ...pathSegments: string[]

      string paths to join. Non-string arguments are ignored.

    Returns string

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method