@minecraft/creator-tools
Version:
Minecraft Creator Tools command line and libraries.
55 lines (54 loc) • 2.14 kB
TypeScript
import IFolder from "../storage/IFolder";
import IFile from "../storage/IFile";
import NodeFile from "./NodeFile";
import NodeStorage from "./NodeStorage";
import FolderBase from "../storage/FolderBase";
export interface IFilePathAndSize {
path: string;
size?: number;
hash?: string;
sourcePath?: string;
}
export interface FileListings {
[pathPlusSizePlusHash: string]: IFilePathAndSize | undefined;
}
export interface IListingsFile {
path: string;
files: IFilePathAndSize[];
}
export default class NodeFolder extends FolderBase implements IFolder {
private _name;
private _path;
folders: {
[id: string]: NodeFolder | undefined;
};
files: {
[id: string]: NodeFile | undefined;
};
private _storage;
private _parentFolder;
get storage(): NodeStorage;
get parentFolder(): NodeFolder | null;
get name(): string;
get fullPath(): string;
constructor(storage: NodeStorage, parentFolder: NodeFolder | null, parentPath: string, folderName: string);
scanForChanges(): Promise<void>;
ensureFile(name: string): NodeFile;
_removeFile(file: IFile): void;
_addExistingFile(file: NodeFile): void;
deleteThisFolder(): Promise<boolean>;
deleteAllFolderContents(): Promise<boolean>;
ensureFolder(name: string): NodeFolder;
_addExistingFolderToParent(folder: NodeFolder): void;
moveTo(newStorageRelativePath: string): Promise<boolean>;
exists(): Promise<boolean>;
ensureExists(): Promise<boolean>;
generateFileListings(listings?: FileListings): Promise<FileListings>;
generatePathHash(fileInfo: IFilePathAndSize): string;
copyContentsTo(destRootPath: string, fileInclusionList: IFilePathAndSize[], addFilesToInclusionList?: boolean, listings?: FileListings, destStorageRelativePath?: string, copyPath?: string): Promise<void>;
saveFilesList(pathDescriptor: string, inclusionList: IFilePathAndSize[]): Promise<void>;
copyContentsOut(destFolder: IFolder): Promise<void>;
createFile(name: string): Promise<IFile>;
loadSync(force?: boolean): Date;
load(force?: boolean): Promise<Date>;
}