import { BridgeContext } from "doric"; export type PathLike = string; export type Stats = {}; export function fs(context: BridgeContext) { return { getDocumentsDir: (options?: { external?: boolean }) => { return context.callNative( "fs", "getDocumentsDir", options || {} ) as Promise; }, exists: (path: PathLike) => { return context.callNative("fs", "exists", path) as Promise; }, stat: (path: PathLike) => { return context.callNative("fs", "stat", path) as Promise; }, isFile: (path: PathLike) => { return context.callNative("fs", "isFile", path) as Promise; }, isDirectory: (path: PathLike) => { return context.callNative("fs", "isDirectory", path) as Promise; }, mkdir: (path: PathLike) => { return context.callNative("fs", "mkdir", path) as Promise; }, readDir: (path: PathLike) => { return context.callNative("fs", "readDir", path) as Promise; }, readFile: (path: PathLike) => { return context.callNative("fs", "readFile", path) as Promise; }, writeFile: (path: PathLike, content: string) => { return context.callNative("fs", "writeFile", { path, content, }) as Promise; }, appendFile: (path: PathLike, content: string) => { return context.callNative("fs", "appendFile", { path, content, }) as Promise; }, delete: (path: PathLike) => { return context.callNative("fs", "delete", path) as Promise; }, rename: (src: PathLike, dest: PathLike) => { return context.callNative("fs", "rename", { src, dest, }) as Promise; }, copy: (src: PathLike, dest: PathLike) => { return context.callNative("fs", "copy", { src, dest, }) as Promise; }, choose: (options: { uniformTypeIdentifiers: string[]; mimeType: string; }) => { return context.callNative("fs", "choose", options) as Promise; }, }; }