import { Path } from "https://deno.land/x/libpkgx@v0.19/mod.ts";
Constructors
new
Path(input: string | Path)Methods
basename(): string
components(): string[]
extname(): string
isDirectory(): Path | undefined
isExecutableFile(): Path | undefined
isReadableFile(): Path | undefined
ls(): AsyncIterable<[Path, Deno.DirEntry]>
Moves a file.
Path.root.join("bar").mv({to: Path.home.join("foo")})
// => Path("/Users/mxcl/foo")
- Parameter to: Destination filename.
- Parameter into: Destination directory (you get `into/${this.basename()`)
- Parameter overwrite: If true overwrites any entry that already exists at the destination.
- Returns: `to` to allow chaining.
- Note: `force` will still throw if `to` is a directory.
- Note: Throws if `overwrite` is `false` yet `to` isalready* identical to
`self` because even thoughour policy* is to noop if the desired
end result preexists, checking for this condition is too expensive a
trade-off.
Returns the parent directory for this path.
Path is not aware of the nature of the underlying file, but this is
irrlevant since the operation is the same irrespective of this fact.
- Note: always returns a valid path, Path.root.parent
is* Path.root
.
prettyLocalString(): string
prettyString(): string
read(): Promise<string>
readJSON(): Promise<unknown>
readLines(): AsyncIterableIterator<string>
If the path represents an actual entry that is a symlink, returns the symlink’s absolute destination.
- Important: This is not exhaustive, the resulting path may still contain a symlink.
- Important: The path will only be different if the last path component is a symlink, any symlinks in prior components are not resolved.
- Note: If file exists but isn’t a symlink, returns `self`.
- Note: If symlink destination does not exist, is*not** an error.
readYAML(): Promise<unknown>
rm(unnamed 0?)
toString(): string
walk(): AsyncIterable<[Path, Deno.DirEntry]>
Static Properties
root: Path