Functions -
filepath
absolute | Retrieves the absolute path from the provided location. |
build | Joins any number of path elements into a single path |
extension | Retrieves the extension of the file path. The extension is the suffix beginning at the final dot in the final element of path. it is empty if there is no dot. |
filename | Retrieves the base name of the file from the provided location. The last element of path. Trailing path separators are removed before extracting the last element. |
getPathListSeparator | Returns path list separator of underline operating system. |
getPathSeparator | Returns path separator of underline operating system. |
isAbsolute | Reports whether the path is absolute. A path is absolute if it is independent of the current directory. On Unix, a path is absolute if it starts with the root. On Windows, a path is absolute if it has a prefix and starts with the root: c:\windows is absolute |
isReservedName | Reports whether the filename is reserved. Reserved words only exist in windows. |
matches | Reports whether all of filename matches the provided pattern, not just a substring. An error is returned if the pattern is malformed. |
normalize | Returns the shortest path name equivalent to path by purely lexical processing. Replace multiple Separator elements with a single one. Eliminate each . path name element (the current directory). Eliminate each inner .. path name element (the parent directory) |
parent | Returns the enclosing parent directory. If the path is empty, parent returns ".". The returned path does not end in a separator unless it is the root directory. |
relative | Returns a relative path that is logically equivalent to target path when joined to base path with an intervening separator. An error is returned if target path can't be made relative to base path. |
resolve | Returns the filepath after the evaluation of any symbolic links. If path is relative, the result will be relative to the current directory, unless one of the components is an absolute symbolic link. Resolve calls normalize on the result. |
split | Splits a list of paths joined by the OS-specific Path Separator. |
Retrieves the absolute path from the provided location.
Parameters
- path string
-
String value of file path.
-
Return Type
(string | Error) The absolute path reference or an error if the path cannot be derived
Joins any number of path elements into a single path
Parameters
- parts string[]
-
String values of file path parts.
-
Return Type
(string | Error) String value of file path.
Retrieves the extension of the file path. The extension is the suffix beginning at the final dot in the final element of path. it is empty if there is no dot.
Parameters
- path string
-
String value of file path.
-
Return Type
(string | Error) Returns the extension of the file. Empty string if no extension.
Retrieves the base name of the file from the provided location. The last element of path. Trailing path separators are removed before extracting the last element.
Parameters
- path string
-
String value of file path.
-
Return Type
(string | Error) Returns the name of the file
Returns path list separator of underline operating system.
-
Return Type
(string) String value of path list separator
Returns path separator of underline operating system.
-
Return Type
(string) String value of path separator
Reports whether the path is absolute. A path is absolute if it is independent of the current directory. On Unix, a path is absolute if it starts with the root. On Windows, a path is absolute if it has a prefix and starts with the root: c:\windows is absolute
Parameters
- path string
-
String value of file path.
-
Return Type
(boolean | Error) True if path is absolute, else false
Reports whether the filename is reserved. Reserved words only exist in windows.
Parameters
- name string
-
filename
-
Return Type
(boolean) true, if path is Windows reserved name.
Reports whether all of filename matches the provided pattern, not just a substring. An error is returned if the pattern is malformed.
Parameters
- path string
-
String value of the file path.
- pattern string
-
String value of the target file path.
-
Return Type
(boolean | Error) True if filename of the path matches with the pattern, else false
Returns the shortest path name equivalent to path by purely lexical processing. Replace multiple Separator elements with a single one. Eliminate each . path name element (the current directory). Eliminate each inner .. path name element (the parent directory)
Parameters
- path string
-
String value of file path.
-
Return Type
(string | Error) Normalized file path
Returns the enclosing parent directory. If the path is empty, parent returns ".". The returned path does not end in a separator unless it is the root directory.
Parameters
- path string
-
String value of file path.
-
Return Type
(string | Error) Path of parent folder or error occurred while getting parent directory
Returns a relative path that is logically equivalent to target path when joined to base path with an intervening separator. An error is returned if target path can't be made relative to base path.
Parameters
- base string
-
String value of the base file path.
- target string
-
String value of the target file path.
-
Return Type
(string | Error) Returns the extension of the file. Empty string if no extension.
Returns the filepath after the evaluation of any symbolic links. If path is relative, the result will be relative to the current directory, unless one of the components is an absolute symbolic link. Resolve calls normalize on the result.
Parameters
- path string
-
String value of file path.
-
Return Type
(string | Error) Resolved file path