Skip to content

exists

Vérifie qu'un chemin existe.

Exemple

ts
import { 
SF
} from "@duplojs/server-utils";
import {
E
} from "@duplojs/utils";
const
result
= await
SF
.
exists
("/tmp/file.txt");
if (
E
.
isRight
(
result
)) {
// file.txt is exist }

Syntaxe

typescript
function exists(
  path: string | URL
): Promise<FileSystemLeft | E.Ok>

Paramètres

  • path : chemin a verifier.

Valeur de retour

  • E.Ok : si le chemin existe.
  • FileSystemLeft : si le chemin n'existe pas ou si la verification échoue.

Voir aussi

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

Diffusé sous licence MIT.