Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/libpkgx/src/utils/Path.ts>default

`import`… but with pkging powers
Very Popular
Latest
class default
import { default } from "https://deno.land/x/libpkgx@v0.20.0/src/utils/Path.ts";

Constructors

new
default(input: string | Path)

Properties

readonly
string: string

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
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.parentis* Path.root.

prettyString(): string
read(): Promise<string>
readJSON(): Promise<unknown>
readLines(): AsyncIterableIterator<string>
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

Static Methods

abs(input: string | Path)
cwd(): Path
home(): Path
mktemp(opts?: { prefix?: string; dir?: Path; }): Path