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
): UnknownInterfacetypescript
function isUnknownInterface(
input: unknown
): input is UnknownInterfaceInterface 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
folderInterface- Crée une interface dossier.
