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 if (
E
.
isRight
(
resolved
)) {
const
path
=
unwrap
(
resolved
);
// path: string }

Syntaxe

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

Paramètres

  • path : chemin a résoudre.

Valeur de retour

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

Voir aussi

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

Diffusé sous licence MIT.