Skip to content

relocate

Relocate un chemin dans un nouveau dossier parent.

Exemple

ts
import { 
SF
} from "@duplojs/server-utils";
import {
E
,
unwrap
} from "@duplojs/utils";
const
result
= await
SF
.
relocate
("/tmp/example.txt", "/tmp/archive");
// result: E.Success<string> | SF.FileSystemLeft<"relocate"> if (
E
.
isRight
(
result
)) {
const
newPath
=
unwrap
(
result
);
// newPath: string }

Syntaxe

typescript
function relocate(
  fromPath: string,
  newParentPath: string
): Promise<FileSystemLeft<"relocate"> | E.Success<string>>

Parametres

  • fromPath : chemin a relocaliser.
  • newParentPath : dossier parent de destination.

Valeur de retour

  • E.Success<string> : le nouveau chemin lorsque la relocalisation reussit.
  • FileSystemLeft<"relocate"> : si la relocalisation echoue.

Voir aussi

  • move - Deplace un fichier ou un dossier.
  • rename - Renomme un fichier ou un dossier dans son dossier parent.

Diffusé sous licence MIT.