mirror of
https://github.com/fluxscape/fluxscape.git
synced 2026-01-13 15:52:55 +01:00
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:
53
packages/noodl-platform/src/filesystem/common.ts
Normal file
53
packages/noodl-platform/src/filesystem/common.ts
Normal 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;
|
||||
}
|
||||
1
packages/noodl-platform/src/filesystem/index.ts
Normal file
1
packages/noodl-platform/src/filesystem/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export * from "./common";
|
||||
Reference in New Issue
Block a user