Path.replaceSync() method
pathlib-ts > Path > replaceSync
Path.replaceSync() method
Section titled “Path.replaceSync() method”Replace the file or directory synchronously, overwriting the destination.
Signature:
replaceSync(target: PathLike): Path;Parameters
Section titled “Parameters”|
Parameter |
Type |
Description |
|---|---|---|
|
target |
Destination path or string. |
Returns:
A Path representing the destination.
Remarks
Section titled “Remarks”Mirrors Path.replace() but executes synchronously.
Example
Section titled “Example”Overwriting a manifest synchronously
import { Path } from "pathlib-ts";
const manifest = new Path("./dist/manifest.json.new");manifest.replaceSync("./dist/manifest.json");