/** * @since 1.0.0 */ interface FsOptions { /** * Whether the content should overwrite the content of the file or append to it. * * @since 1.5.0 */ append?: boolean; } /** * @since 1.0.0 */ interface FsDirOptions { recursive?: boolean; } /** * @since 1.0.0 */ interface FileEntry { path: string; /** * Name of the directory/file * can be null if the path terminates with `..` */ name?: string; /** Children of this entry if it's a directory; null otherwise */ children?: FileEntry[]; } export declare namespace fs { type WriteTextFileFuncType = (path: string, contents: string, options?: FsOptions) => Promise; type WriteBinaryFileFuncType = (path: string, contents: Uint8Array, options?: FsOptions) => Promise; type CreateDirFuncType = (dir: string, options?: FsDirOptions) => Promise; type ExistsFuncType = (path: string) => Promise; type ReadBinaryFileFuncType = (filePath: string, options?: FsOptions) => Promise; type ReadTextFileFileFuncType = (filePath: string, options?: FsOptions) => Promise; type IsDirFuncType = (path: string) => Promise; type ReadDirFuncType = (dir: string, options?: FsDirOptions) => Promise; type RemoveDirFuncType = (dir: string, options?: FsDirOptions) => Promise; type RemoveFileFuncType = (file: string, options?: FsOptions) => Promise; } export declare class FsFuncs { exists?: fs.ExistsFuncType; writeTextFile?: fs.WriteTextFileFuncType; writeBinaryFile?: fs.WriteBinaryFileFuncType; removeFile?: fs.RemoveFileFuncType; readBinaryFile?: fs.ReadBinaryFileFuncType; readTextFile?: fs.ReadTextFileFileFuncType; isDir?: fs.IsDirFuncType; createDir?: fs.CreateDirFuncType; readDir?: fs.ReadDirFuncType; removeDir?: fs.RemoveDirFuncType; } export declare namespace dialog { /** * Extension filters for the file dialog. * * @since 1.0.0 */ export interface DialogFilter { /** Filter name. */ name: string; /** * Extensions to filter, without a `.` prefix. * @example * ```typescript * extensions: ['svg', 'png'] * ``` */ extensions: string[]; } /** * Options for the open dialog. * * @since 1.0.0 */ export interface OpenDialogOptions { /** The title of the dialog window. */ title?: string; /** The filters of the dialog. */ filters?: DialogFilter[]; /** Initial directory or file path. */ defaultPath?: string; /** Whether the dialog allows multiple selection or not. */ multiple?: boolean; /** Whether the dialog is a directory selection or not. */ directory?: boolean; /** * If `directory` is true, indicates that it will be read recursively later. * Defines whether subdirectories will be allowed on the scope or not. */ recursive?: boolean; } /** * Options for the save dialog. * * @since 1.0.0 */ interface SaveDialogOptions { /** The title of the dialog window. */ title?: string; /** The filters of the dialog. */ filters?: DialogFilter[]; /** * Initial directory or file path. * If it's a directory path, the dialog interface will change to that folder. * If it's not an existing directory, the file name will be set to the dialog's file name input and the dialog will be set to the parent folder. */ defaultPath?: string; } export type OpenFuncType = (options?: OpenDialogOptions) => Promise; export type SaveFuncType = (options?: SaveDialogOptions) => Promise; export {}; } export declare class DialogFuncs { open?: dialog.OpenFuncType; save?: dialog.SaveFuncType; } export declare const os: { wrap?: { fs: { exists: fs.ExistsFuncType; writeTextFile: fs.WriteTextFileFuncType; writeBinaryFile: fs.WriteBinaryFileFuncType; removeFile: fs.RemoveFileFuncType; readBinaryFile: fs.ReadBinaryFileFuncType; readTextFile: fs.ReadTextFileFileFuncType; isDir: fs.IsDirFuncType; createDir: fs.CreateDirFuncType; readDir: fs.ReadDirFuncType; removeDir: fs.RemoveDirFuncType; }; dialog: { open: dialog.OpenFuncType; save: dialog.SaveFuncType; }; }; }; export {};