Skip to main content
Module

x/libpkgx/mod.ts>Path

`import`… but with pkging powers
Extremely Popular
Latest
class Path
Re-export
import { Path } from "https://deno.land/x/libpkgx@v0.18.1/mod.ts";

Constructors

new
Path(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

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>
relative(unnamed 0: { to: Path; }): string
rm(unnamed 0?)
split(): [Path, string]
toString(): string
walk(): AsyncIterable<[Path, Deno.DirEntry]>
write(unnamed 0: ({ text: string; } | { json: PlainObject; space?: number; }) & { force?: boolean; }): Path

Static Methods

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