Skip to content

unknownInterface

Interface pour un chemin de type inconnu.

WARNING

L'objet UnknownInterface ne garantit pas l'existence réelle du chemin. C'est uniquement un helper pour representer une ressource et faciliter les opérations.

Exemple

ts
import { 
SF
} from "@duplojs/server-utils";
const
entry
=
SF
.
createUnknownInterface
("/tmp/entry");
const
name
=
entry
.
name
;
// name: string await
entry
.
exist
();
await
entry
.
stat
();
if (
SF
.
isUnknownInterface
(
entry
)) {
// entry: SF.UnknownInterface await
entry
.
stat
();
}

Syntaxe

typescript
function createUnknownInterface(
  path: string | URL
): UnknownInterface
typescript
function isUnknownInterface(
  input: unknown
): input is UnknownInterface

Interface UnknownInterface

typescript
interface UnknownInterface {
  name: string;
  path: string;
  getParentPath(): string;
  stat(): Promise<FileSystemLeft | E.Success<StatInfo>>;
  exist(): Promise<FileSystemLeft | E.Ok>;
}

Paramètres

  • path : chemin de la ressource.

Valeur de retour

  • UnknownInterface : interface avec des méthodes utilitaires (exist, stat, getParentPath).

Voir aussi

Diffusé sous licence MIT.