import { Path } from "https://dotland.deno.dev/x/dax@0.39.2/mod.ts";
Holds a reference to a path providing helper methods.
Create one via $
: const srcDir = $.path("src");
Constructors
Methods
Appends the provided bytes to the file.
Synchronously appends the provided bytes to the file.
Appends the provided text to the file.
Synchronously appends the provided text to the file.
Changes the ownership permissions of the file.
Synchronously changes the ownership permissions of the file.
Copies the file to the destination path synchronously.
Copies the file to the specified directory.
Copies the file to the specified directory synchronously.
Creates a symlink to the provided target path.
Creates a symlink at the provided path with the provided target text.
Synchronously creates a symlink to the provided target path.
Synchronously creates a symlink at the provided path with the provided target text.
Gets the directory path. In most cases, it is recommended
to use .parent()
instead since it will give you a Path
.
Ensures that a directory is empty. Deletes directory contents if the directory is not empty. If the directory does not exist, it is created. The directory itself is not deleted.
Ensures that the directory exists. If the directory structure does not exist, it is created. Like mkdir -p.
Synchronously ensures that the directory exists. If the directory structure does not exist, it is created. Like mkdir -p.
Ensures that the file exists. If the file that is requested to be created is in directories that do not exist these directories are created. If the file already exists, it is NOTMODIFIED.
Synchronously ensures that the file exists. If the file that is requested to be created is in directories that do not exist these directories are created. If the file already exists, it is NOTMODIFIED.
Expands the glob using the current path as the root.
Synchronously expands the glob using the current path as the root.
Returns the extension of the path with leading period or undefined if there is no extension.
Resolves the Deno.FileInfo
of this path without
following symlinks.
Synchronously resolves the Deno.FileInfo
of this path
without following symlinks.
Normalizes the path
, resolving '..'
and '.'
segments.
Note that resolving these segments does not necessarily mean that all will be eliminated.
A '..'
at the top-level will be preserved, and an empty path is canonically '.'
.
Opens the file and pipes it to the writable stream.
Synchronously reads only the directory file paths, not including symlinks.
Reads and parses the file as JSON, throwing if it doesn't exist or is not valid JSON.
Synchronously reads and parses the file as JSON, throwing if it doesn't exist or is not valid JSON.
Calls .readBytes()
, but returns undefined if the path doesn't exist.
Calls .readBytesSync()
, but returns undefined if the path doesn't exist.
Calls .readJson()
, but returns undefined if the file doesn't exist.
Calls .readJsonSync()
, but returns undefined if the file doesn't exist.
Calls .readText()
, but returns undefined when the path doesn't exist.
Calls .readTextSync()
, but returns undefined when the path doesn't exist.
Synchronously resolves to the absolute normalized path, with symbolic links resolved.
Removes the file or directory from the file system.
Removes the file or directory from the file system synchronously.
Moves the file or directory returning the renamed path synchronously.
Moves the file or directory to the specified directory.
Moves the file or directory to the specified directory synchronously.
Resolves the Deno.FileInfo
of this path following symlinks.
Synchronously resolves the Deno.FileInfo
of this
path following symlinks.
Walks the file tree rooted at the current path, yielding each file or directory in the tree filtered according to the given options.
Synchronously walks the file tree rooted at the current path, yielding each file or directory in the tree filtered according to the given options.
Gets a new path reference with the provided file or directory name.
Writes out the provided bytes to the file.
Writes out the provided object as compact JSON.
Writes out the provided object as formatted JSON.
Synchronously writes out the provided object as formatted JSON.
Synchronously writes out the provided object as compact JSON.
Synchronously writes out the provided bytes to the file.
Writes out the provided text to the file.
Synchronously writes out the provided text to the file.