feat(preload): add file.list, file.pickFolder, file.pickFile convenience methods

This commit is contained in:
2026-06-05 15:13:16 +05:30
parent 650c266945
commit 3598d06240
7 changed files with 241 additions and 8 deletions
+4
View File
@@ -66,6 +66,10 @@ export const ipc = {
safeCall('file', 'write', path, content),
list: (dir: string): Promise<IpcResult<FileEntry[] | ChannelMissing>> =>
safeCall('file', 'list', dir),
pickFolder: (): Promise<IpcResult<string | null | ChannelMissing>> =>
safeCall('file', 'pickFolder'),
pickFile: (): Promise<IpcResult<string | null | ChannelMissing>> =>
safeCall('file', 'pickFile'),
onChange: (cb: (path: string) => void): (() => void) => {
if (typeof window === 'undefined' || !window.electronAPI?.file?.onChange) {
return () => {};