import { default } from "https://deno.land/x/libpkgx@v0.20.0/src/utils/Path.ts";
Methods
basename(): string
chmod(mode: number): Path
chuzzle(): Path | undefined
components(): string[]
cp(opts: { into: Path; } | { to: Path; }): Path
eq(that: Path): boolean
exists(): Path | undefined
extname(): string
isDirectory(): Path | undefined
isEmpty(): Path | undefined
isExecutableFile(): Path | undefined
isFile(): Path | undefined
isReadableFile(): Path | undefined
isSymlink(): Path | undefined
join(...components: string[]): Path
ln(_: "s", unnamed 1: { target: Path; }): Path
ls(): AsyncIterable<[Path, Deno.DirEntry]>
mkdir(opts?: "p"): Path
mv(unnamed 0: { to: Path; force?: boolean; } | { into: Path; force?: boolean; }): Path
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.
neq(that: Path): boolean
parent(): Path
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>
readlink(): Path
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>
realpath(): Path
relative(unnamed 0: { to: Path; }): string
rm(unnamed 0?)
split(): [Path, string]
toString(): string
touch(): Path
walk(): AsyncIterable<[Path, Deno.DirEntry]>
write(unnamed 0: ({ text: string; } | { json: PlainObject; space?: number; }) & { force?: boolean; }): Path