Path.copySync() method
pathlib-ts > Path > copySync
Path.copySync() method
Section titled “Path.copySync() method”Recursively copy the file or directory tree to the destination synchronously.
Signature:
copySync(target: PathLike, options?: { preserveMetadata?: boolean; followSymlinks?: boolean; }): Path;Parameters
Section titled “Parameters”|
Parameter |
Type |
Description |
|---|---|---|
|
target |
Destination path or string. | |
|
options |
{ preserveMetadata?: boolean; followSymlinks?: boolean; } |
(Optional) Behaviour flags for metadata preservation and symlink handling. |
Returns:
The destination Path.
Remarks
Section titled “Remarks”Mirrors Path.copy() but executes synchronously.
Example
Section titled “Example”Duplicating a directory tree synchronously
import { Path } from "pathlib-ts";
const source = new Path("./templates");source.copySync("./.cache/templates");