AbstractStaticbaseReturn the last portion of a path. Similar to the Unix basename command. Often used to extract the file name from a fully qualified path.
The path to evaluate.
The last portion of the given path.
StaticcreateCreates a file at the given path.
The path of the new file to create.
The data to write into the file. Can be a raw data string or an array of lines, which are joined by \n.
Whether or not to recursively create the file.
StaticcreateCreates a new read stream on the file at the given path.
The path to read from.
Optionaloptions: ReadStreamOptionsAdditional streaming options.
The newly created read stream.
StaticcreateCreates a new write stream on the file at the given path.
The path to write to.
Optionaloptions: WriteStreamOptionsAdditional streaming options.
The newly created write stream.
StaticdirReturn the directory name of a path. Similar to the Unix dirname command.
The path to evaluate.
The name of the directory as a string.
StaticexistsChecks if a file at the given path exists.
The path to check.
True when a file could be accessed and false otherwise.
StaticextensionReturn 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.
The path to evaluate.
The file extension.
StaticgetGets a path from the provided segments.
The segments to get the path from.
The cleaned up path.
StaticglobPerform an asynchronous glob search for the pattern(s) specified.
The pattern to search for.
The matching paths.
StaticmkdirCreates a directory at the given path.
The path of the directory to create.
Whether or not missing directories in the path should be created as well. Defaults to true.
StaticreaddirGets the root level subdirectories and files of the directory at the provided path.
The path of the directory to get the contents of.
An array of the directory contents.
StaticreadReads the file content at the given path. Expects utf-8.
The path of the file to read.
The content as a single string.
StaticreadSame as readFile, but returns the content as an array of lines instead.
The path of the file to read the lines from.
The content as an array of line strings.
StaticrelativeSolve the relative path from {from} to {to} based on the current working directory. 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.
The fully resolved relative path.
StaticrenameRenames "from" to "to".
The old path.
The new path.
StaticresolveThe right-most parameter is considered {to}. Other parameters are considered an array of {from}. Starting from leftmost {from} parameter, 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.
The paths that should be resolved.
The resolved path.
StaticrmRemoves either a file or directory.
The path to remove.
Whether or not subdirectories should be deleted as well. Defaults to true.
StaticstatGives information about the file or directory at the provided path.
The path to get info on.
Information like file size etc.
StaticupdateUpdates the file at the given path with the given data. Can either replace, prepend or append.
The path of the new file to create.
The data to write into the file. Can be a raw data string or an array of lines, which are joined by \n.
Whether the data should replace the current content or be pre-/appended.
StaticupsertEither creates or overrides the file at the given path with the given data.
The path of the file to create/override.
The data to write into the file. Can be a raw data string or an array of lines, which are joined by \n.
Encapsulates functionality of the fs package.