Skip to content

realPath ​

Résout un chemin vers sa forme canonique.

Exemple ​

ts
import { 
SF
} from "@duplojs/server-utils";
import {
E
,
unwrap
} from "@duplojs/utils";
const
resolved
= await
SF
.
realPath
("/tmp/./file.txt");
// resolved: E.Success<string> | SF.FileSystemLeft<"real-path"> if (
E
.
isRight
(
resolved
)) {
const
path
=
unwrap
(
resolved
);
// path: string }

Syntaxe ​

typescript
function realPath(
  path: string
): Promise<FileSystemLeft<"real-path"> | E.Success<string>>

Paramètres ​

  • path : chemin a résoudre.

Valeur de retour ​

  • E.Success<string> : chemin résolu.
  • FileSystemLeft<"real-path"> : si la résolution échoue.

Voir aussi ​

  • stat - Récupère les informations d'un chemin.

Diffusé sous licence MIT.