unknownInterface
Interface for a path of unknown type.
WARNING
The UnknownInterface object does not guarantee that the path actually exists. It is only a helper to represent a resource and make operations easier.
Example
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();
}Syntax
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>;
}Parameters
path: resource path.
Return value
UnknownInterface: interface with utility methods (exist,stat,getParentPath).
See also
folderInterface- Creates a directory interface.
