Skip to content

copy

Copies a file or directory.

Example

ts
import { 
SF
} from "@duplojs/server-utils";
import {
E
} from "@duplojs/utils";
const
result
= await
SF
.
copy
("/tmp/src", "/tmp/dest");
// result: E.Ok | SF.FileSystemLeft if (
E
.
isRight
(
result
)) {
// element copy with success }

Syntax

typescript
function copy(
  fromPath: string | URL,
  toPath: string | URL
): Promise<FileSystemLeft | E.Ok>

Parameters

  • fromPath : source path.
  • toPath : destination path.

Return value

  • E.Ok : if the copy succeeds.
  • FileSystemLeft : if the copy fails.

See also

  • move - Moves a file or directory.

Released under the MIT license.