///
import type { Arguments } from '@kui-shell/core';
import type { FStat, VFS } from '..';
export interface BaseEntry {
mountPath: string;
isDirectory?: boolean;
isExecutable?: boolean;
}
export type Directory = BaseEntry;
export interface Leaf {
mountPath: string;
isExecutable?: boolean;
data: D;
}
export declare abstract class TrieVFS = Leaf> implements VFS {
readonly mountPath: string;
protected readonly trie: any;
readonly isLocal = false;
readonly isVirtual = true;
protected readonly prefix: RegExp;
constructor(mountPath?: string, trie?: any);
protected abstract loadAsString(leaf: L): string | Promise;
protected nameForDisplay(name: string, entry: Directory | L): string | Promise;
protected viewer(leaf: Leaf): string;
protected isLeaf(entry: Directory | L): entry is L;
/** Turn an ls-style glob into a nodejs-style regexp */
private glob2RegExp;
private dirPattern;
protected trieGet(filepath: string): BaseEntry[];
/** Looks in the trie for any matches for the given filepath, handling the "contents of directory" case */
private find;
/** Looks in the trie for a single precise match */
private findExact;
private enumerate;
ls({ parsedOptions }: Parameters[0], filepaths: string[]): Promise<{
name: string;
nameForDisplay: string;
path: string;
viewer: string;
stats: {
size: number;
mtimeMs: number;
mode: number;
uid: number;
gid: number;
};
dirent: {
mount: {
isLocal: boolean;
mountPath: string;
};
isFile: boolean;
isDirectory: boolean;
isSymbolicLink: boolean;
isSpecial: boolean;
isExecutable: boolean;
permissions: string;
username: string;
};
}[]>;
/** Insert filepath into directory */
cp(_: any, srcFilepaths: string[], dstFilepath: string): Promise;
/** Remove filepath */
rm(): ReturnType;
/** Fetch contents */
fstat(opts: Pick, filepath: string, withData: boolean, enoentOk: boolean): Promise;
fwrite(opts: Pick, filepath: string, data: string | Buffer): Promise;
/** Fetch content slice */
fslice(filename: string, offset: number, length: number): Promise;
/** Create a directory/bucket */
mkdir(opts: Pick): Promise;
/** Remove a directory/bucket */
rmdir(): Promise;
}