///
export declare type FileVisitor = (file: File) => boolean | void | Promise;
export interface File {
readonly path: string;
readonly content: Promise;
readonly stats: Promise;
}
export declare namespace File {
interface Stats {
mode: number;
}
}
export interface Directory {
readonly path: string;
dir(name: string): Promise;
file(name: string): Promise;
visit(visitor: FileVisitor): Promise;
}
export interface Tree {
get(path: string): Promise;
getDir(path: string): Promise;
overwrite(path: string, content: Buffer | string, stat?: File.Stats): void;
create(path: string, content: Buffer | string, stat?: File.Stats): void;
delete(path: string): void;
move(from: string, to: string): void;
}
export declare namespace Tree {
type Action = OverwriteAction | CreateAction | DeleteAction | MoveAction;
interface OverwriteAction {
type: 'overwrite';
path: string;
content?: Buffer;
stat?: File.Stats;
}
interface CreateAction {
type: 'create';
path: string;
content: Buffer;
stat?: File.Stats;
}
interface DeleteAction {
type: 'delete';
path: string;
}
interface MoveAction {
type: 'move';
from: string;
to: string;
}
}
export interface Host {
readFile(path: string): Buffer | Promise;
readDir(path: string): Host.readDir.Resp | Promise;
readStat(path: string): Host.Stats | Promise;
writeFile(path: string, content?: Buffer, options?: Host.writeFile.Options): void | Promise;
moveFile(from: string, to: string): void | Promise;
deleteFile(path: string): void | Promise;
mkdirp(path: string): void | Promise;
}
export declare namespace Host {
interface Stats extends File.Stats {
isFile(): boolean;
isDirectory(): boolean;
}
namespace readDir {
interface Resp {
files: string[];
dirs: string[];
}
}
namespace writeFile {
interface Options {
mode: number;
}
}
}
//# sourceMappingURL=interfaces.d.ts.map