Path.rename() method
pathlib-ts > Path > rename
Path.rename() method
Section titled “Path.rename() method”Rename this path to the given target and return the new path instance.
Signature:
rename(target: PathLike): Promise<Path>;Parameters
Section titled “Parameters”|
Parameter |
Type |
Description |
|---|---|---|
|
target |
Destination path or string. |
Returns:
Promise<Path>
Promise resolving to a Path representing the destination.
Remarks
Section titled “Remarks”Matches CPython semantics while returning a new Path pointing at the destination.
Example
Section titled “Example”Renaming build artifacts asynchronously
import { Path } from "pathlib-ts";
const artifact = new Path("./dist/app.tmp");await artifact.rename("./dist/app.js");