Skip to content

getCurrentWorkDirectory

Retourne le répertoire de travail courant. Cette version retourne un résultat Either. Si vous préférez une version qui lance une erreur directement, utilisez getCurrentWorkDirectoryOrThrow.

Exemple

ts
import { 
getCurrentWorkDirectory
} from "@duplojs/server-utils";
import {
E
,
unwrap
} from "@duplojs/utils";
const
result
=
getCurrentWorkDirectory
();
// currentPath: E.Error<unknown> | E.Success<string> if (
E
.
isRight
(
result
)) {
const
currentPath
=
unwrap
(
result
);
// currentPath: string }

Autres exemples

Version throw

ts
import { 
getCurrentWorkDirectoryOrThrow
} from "@duplojs/server-utils";
const
currentPath
=
getCurrentWorkDirectoryOrThrow
();
// currentPath: string

Syntaxe

typescript
function getCurrentWorkDirectory(): E.Error<unknown> | E.Success<string>

Paramètres

Cette fonction ne prend aucun paramètre.

Valeur de retour

  • E.Success<string> : le chemin absolu du répertoire courant.
  • E.Error<unknown> : si la lecture du répertoire courant échoue.

Voir aussi

Diffusé sous licence MIT.