Initial commit

Co-Authored-By: Eric Tuvesson <eric.tuvesson@gmail.com>
Co-Authored-By: mikaeltellhed <2311083+mikaeltellhed@users.noreply.github.com>
Co-Authored-By: kotte <14197736+mrtamagotchi@users.noreply.github.com>
Co-Authored-By: Anders Larsson <64838990+anders-topp@users.noreply.github.com>
Co-Authored-By: Johan  <4934465+joolsus@users.noreply.github.com>
Co-Authored-By: Tore Knudsen <18231882+torekndsn@users.noreply.github.com>
Co-Authored-By: victoratndl <99176179+victoratndl@users.noreply.github.com>
This commit is contained in:
Michael Cartner
2024-01-26 11:52:55 +01:00
commit b9c60b07dc
2789 changed files with 868795 additions and 0 deletions

View File

@@ -0,0 +1,53 @@
export type FileBlob = Buffer | string;
export interface FileInfo {
fullPath: string;
name: string;
isDirectory: boolean;
}
export interface FileStat {
size: number;
}
export type OpenDialogOptions = {
allowCreateDirectory?: boolean;
};
/**
* File System that is designed to be cross platform.
*/
export interface IFileSystem {
resolve(...paths: string[]): string;
join(...paths: string[]): string;
exists(path: string): boolean;
dirname(path: string): string;
basename(path: string): string;
file(path: string): FileStat;
writeFile(path: string, blob: FileBlob): Promise<void>;
writeFileOverride(path: string, blob: FileBlob): Promise<void>;
readFile(path: string): Promise<string>;
readBinaryFile(path: string): Promise<Buffer>;
removeFile(path: string): Promise<void>;
renameFile(oldPath: string, newPath: string): Promise<void>;
copyFile(from: string, to: string): Promise<void>;
copyFolder(from: string, to: string): Promise<void>;
readJson<T = any>(path: string): Promise<T>;
writeJson(path: string, obj: any): Promise<void>;
isDirectoryEmpty(path: string): Promise<boolean>;
listDirectory(path: string): Promise<FileInfo[]>;
/** List all the files in this folder recursively */
listDirectoryFiles(path: string): Promise<FileInfo[]>;
makeDirectory(path: string): Promise<void>;
removeDirRecursive(path: string): void;
openDialog(args: OpenDialogOptions): Promise<string>;
unzipUrl(url: string, to: string): Promise<void>;
makeUniquePath(path: string): string;
}

View File

@@ -0,0 +1 @@
export * from "./common";