@huyooo/file-explorer-bridge-electron 0.4.27 → 0.4.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main/index.d.ts +18 -3
- package/dist/main/index.js +1 -1
- package/dist/preload/index.d.ts +14 -6
- package/dist/preload/index.js +1 -1
- package/dist/renderer/index.d.ts +11 -6
- package/package.json +3 -21
package/dist/main/index.d.ts
CHANGED
|
@@ -6,14 +6,29 @@ import { ClipboardAdapter } from '@huyooo/file-explorer-core';
|
|
|
6
6
|
* 只负责 IPC 通信,具体实现在 @huyooo/file-explorer-core 中
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
+
/** 媒体文件应用打开请求参数 */
|
|
10
|
+
interface MediaFileAppRequest {
|
|
11
|
+
filePath: string;
|
|
12
|
+
mediaType: 'image' | 'video' | 'audio';
|
|
13
|
+
fileUrl: string;
|
|
14
|
+
fileName: string;
|
|
15
|
+
}
|
|
9
16
|
/** 文件管理器配置选项 */
|
|
10
17
|
interface FileExplorerOptions {
|
|
11
18
|
/** 在新窗口中打开文件夹的回调 */
|
|
12
19
|
onOpenInNewWindow?: (folderPath: string) => void;
|
|
20
|
+
/**
|
|
21
|
+
* 宿主自定义媒体文件应用打开
|
|
22
|
+
* 设置后,bridge 不再处理专用预览宿主,而是委托宿主打开对应媒体扩展 app
|
|
23
|
+
*/
|
|
24
|
+
onOpenMediaFileApp?: (request: MediaFileAppRequest) => void;
|
|
25
|
+
/**
|
|
26
|
+
* 宿主关闭指定文件对应的媒体扩展 app
|
|
27
|
+
* 设置后,closeMediaFileApp IPC 会调用此回调
|
|
28
|
+
*/
|
|
29
|
+
onCloseMediaFileApp?: (filePath: string, mediaType: 'image' | 'video' | 'audio') => void;
|
|
13
30
|
/** IPC 通道名称前缀(允许宿主自定义,避免冲突) */
|
|
14
31
|
channelPrefix?: string;
|
|
15
|
-
/** 预览窗口 IPC 通道前缀(一般不需要改) */
|
|
16
|
-
previewChannelPrefix?: string;
|
|
17
32
|
}
|
|
18
33
|
interface RegisterFileExplorerOptions extends FileExplorerOptions {
|
|
19
34
|
/** 注入剪贴板适配器(例如 clipboard-files) */
|
|
@@ -27,4 +42,4 @@ interface RegisterFileExplorerOptions extends FileExplorerOptions {
|
|
|
27
42
|
*/
|
|
28
43
|
declare function registerFileExplorer(options?: RegisterFileExplorerOptions): void;
|
|
29
44
|
|
|
30
|
-
export { type FileExplorerOptions, type RegisterFileExplorerOptions, registerFileExplorer };
|
|
45
|
+
export { type FileExplorerOptions, type MediaFileAppRequest, type RegisterFileExplorerOptions, registerFileExplorer };
|
package/dist/main/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ipcMain as e,shell as
|
|
1
|
+
import{ipcMain as e,shell as a,BrowserWindow as r}from"electron";import n from"path";import{fileURLToPath as t}from"url";import{readDirectory as s,readFileContent as c,readImageAsBase64 as i,writeFileContent as l,createFolder as o,createFile as d,deleteFiles as u,renameFile as h,copyFiles as y,moveFiles as p,getFileInfo as m,getSystemPath as w,getThumbnailService as g,getApplicationIcon as f,copyFilesToClipboard as b,getClipboardFiles as F,pasteFiles as P,searchFiles as T,searchFilesStream as S,compressFiles as A,extractArchive as M,isArchiveFile as U,getWatchManager as I,showFileInfo as v,openInTerminal as C,openInEditor as z,getFileType as x,formatFileSize as D,formatDateTime as N,encodeFileUrl as O,getMediaService as W}from"@huyooo/file-explorer-core";import{promises as E}from"fs";n.dirname(t(import.meta.url));var H=new Map,j=null;var G=O,R={};function $(t={}){R=t;const O=t.channelPrefix||"file-explorer",$=e=>`${O}:${e}`,q={trashItem:async e=>{await a.trashItem(e)},openPath:async e=>{await a.openPath(e)}};e.handle($("readDirectory"),async(e,a,r)=>{const n=g();return await s(a,{urlEncoder:G,includeHidden:r?.includeHidden??!0,getThumbnailUrl:n?e=>n.getThumbnailUrl(e):void 0})}),e.handle($("readSystemPath"),async(e,a)=>{const r=w(a);if(!r)return[];const n=g();return await s(r,{urlEncoder:G,includeHidden:!0,getThumbnailUrl:n?e=>n.getThumbnailUrl(e):void 0})}),e.handle($("getSystemPath"),async(e,a)=>w(a)),e.handle($("readFileContent"),async(e,a)=>await c(a)),e.handle($("writeFileContent"),async(e,a,r)=>await l(a,r)),e.handle($("createFolder"),async(e,a,r)=>{const t=n.join(a,r);return await o(t)}),e.handle($("createFile"),async(e,a,r,t)=>{const s=n.join(a,r);return await d(s,t)}),e.handle($("deleteFiles"),async(e,a)=>{const r=g();return await u(a,{adapter:q,useTrash:!0,onDeleted:e=>r?.deleteThumbnail(e)})}),e.handle($("renameFile"),async(e,a,r)=>{const n=g();return await h(a,r,{onRenamed:e=>n?.deleteThumbnail(e)})}),e.handle($("copyFiles"),async(e,a,r)=>await y(a,r)),e.handle($("moveFiles"),async(e,a,r)=>await p(a,r)),e.handle($("getFileInfo"),async(e,a)=>await m(a)),e.handle($("readImageAsBase64"),async(e,a)=>await i(a)),e.handle($("openPath"),async(e,r)=>{try{return await a.openPath(r),{success:!0}}catch(e){return{success:!1,error:String(e)}}}),e.handle($("getApplicationIcon"),async(e,a)=>await f(a)),e.handle($("getThumbnailUrl"),async(e,a)=>{const r=g();return r?await r.getThumbnailUrl(a):null}),e.handle($("copyFilesToClipboard"),async(e,a)=>j?await b(a,j):{success:!1,error:"剪贴板适配器未初始化"}),e.handle($("getClipboardFiles"),async()=>j?F(j):{success:!1,error:"剪贴板适配器未初始化"}),e.handle($("pasteFiles"),async(e,a,r)=>await P(a,r)),e.handle($("searchFiles"),async(e,a,r,t)=>{try{const e=await T(a,r,t),s=g(),c=100,i=[];for(const a of e.slice(0,c))try{const e=await E.stat(a),r=x(a,e),t={id:a,name:n.basename(a),type:r,size:e.isDirectory()?void 0:D(e.size),dateModified:N(e.mtime),url:G(a)};if(s){const e=await s.getThumbnailUrl(a);e&&(t.thumbnailUrl=e)}i.push(t)}catch{}return{success:!0,data:{items:i,total:e.length}}}catch(e){return{success:!1,error:String(e)}}}),e.handle($("searchFilesStream"),async(e,a,r,t)=>{const s=g(),c=H.get(e.sender.id)??new Map;H.set(e.sender.id,c);const i=new AbortController;c.set(t,{controller:i});const l=async e=>{try{const a=await E.stat(e),r=x(e,a),t={id:e,name:n.basename(e),type:r,size:a.isDirectory()?void 0:D(a.size),dateModified:N(a.mtime),url:G(e)};if(s){const a=await s.getThumbnailUrl(e);a&&(t.thumbnailUrl=a)}return t}catch{return null}};return S(a,r,async(a,r)=>{if(i.signal.aborted)return;const n=[];for(const e of a){if(i.signal.aborted)return;const a=await l(e);a&&n.push(a)}i.signal.aborted||(e.sender.send($("searchResults"),{searchId:t,items:n,done:r}),r&&(c.delete(t),0===c.size&&H.delete(e.sender.id)))},100,{signal:i.signal}).catch(()=>{c.delete(t),0===c.size&&H.delete(e.sender.id)}),{success:!0}}),e.handle($("cancelSearch"),async(e,a)=>{const r=H.get(e.sender.id),n=r?.get(a);return n?(n.controller.abort(),r?.delete(a),r&&0===r.size&&H.delete(e.sender.id),{success:!0}):{success:!0}}),e.handle($("compressFiles"),async(e,a,r)=>{try{return await A(a,r,a=>{e.sender.send($("compressProgress"),a)})}catch(e){return{success:!1,error:String(e)}}}),e.handle($("extractArchive"),async(e,a,r)=>{try{return await M(a,r,a=>{e.sender.send($("extractProgress"),a)})}catch(e){return{success:!1,error:String(e)}}}),e.handle($("isArchiveFile"),async(e,a)=>U(a));const B=new Map;e.handle($("watchDirectory"),async(e,a,r)=>{try{const n=B.get(r);n&&(n(),B.delete(r));const t=I().watch(a,a=>{e.sender.send($("watchEvent"),{watchId:r,event:a})});return B.set(r,t),{success:!0}}catch(e){return{success:!1,error:String(e)}}}),e.handle($("unwatchDirectory"),async(e,a)=>{const r=B.get(a);return r&&(r(),B.delete(a)),{success:!0}}),e.handle($("showFileInfo"),async(e,a)=>await v(a)),e.handle($("openInTerminal"),async(e,a)=>await C(a)),e.handle($("openInEditor"),async(e,a)=>await z(a)),e.handle($("openInNewWindow"),async(e,r)=>{try{return R.onOpenInNewWindow?R.onOpenInNewWindow(r):await a.openPath(r),{success:!0}}catch(e){return{success:!1,error:String(e)}}}),e.on($("requestWindowFocus"),e=>{const a=r.fromWebContents(e.sender);a&&!a.isFocused()&&a.focus()}),e.handle($("mediaNeedsTranscode"),async(e,a)=>{const r=W();if(!r)return{success:!1,error:"媒体服务未初始化"};try{return{success:!0,data:await r.needsTranscode(a)}}catch(e){return{success:!1,error:String(e)}}}),e.handle($("mediaGetPlayableUrl"),async(e,a)=>{const r=W();if(!r)return{success:!1,error:"媒体服务未初始化"};try{return{success:!0,url:await r.getPlayableUrl(a,r=>{e.sender.send($("mediaTranscodeProgress"),{filePath:a,progress:r})})}}catch(e){return{success:!1,error:String(e)}}}),e.handle($("mediaGetMetadata"),async(e,a)=>{const r=W();if(!r)return{success:!1,error:"媒体服务未初始化"};try{return{success:!0,data:await r.getMetadata(a)}}catch(e){return{success:!1,error:String(e)}}}),e.handle($("mediaCleanupFile"),async(e,a)=>{const r=W();if(!r)return{success:!1,error:"媒体服务未初始化"};try{return await r.cleanupFile(a),{success:!0}}catch(e){return{success:!1,error:String(e)}}}),e.handle($("openMediaFileApp"),async(e,a,r)=>{try{const t=n.basename(a),s=W();let c;if("image"===r)c=G(a);else if(s){c=await s.getPlayableUrl(a,r=>{e.sender.send($("mediaTranscodeProgress"),{filePath:a,progress:r})})||G(a)}else c=G(a);return R.onOpenMediaFileApp?(R.onOpenMediaFileApp({filePath:a,mediaType:r,fileUrl:c,fileName:t}),{success:!0}):{success:!1,error:"请实现 onOpenMediaFileApp 以支持媒体文件应用"}}catch(e){return{success:!1,error:String(e)}}}),e.handle($("closeMediaFileApp"),async(e,a,r)=>(R.onCloseMediaFileApp&&R.onCloseMediaFileApp(a,r),{success:!0}))}function q(e={}){var a;e.clipboardAdapter&&(a=e.clipboardAdapter,j=a),$(e)}export{q as registerFileExplorer};
|
package/dist/preload/index.d.ts
CHANGED
|
@@ -6,9 +6,12 @@
|
|
|
6
6
|
/**
|
|
7
7
|
* 文件操作 API 类型
|
|
8
8
|
*/
|
|
9
|
+
interface ReadDirectoryOptions {
|
|
10
|
+
includeHidden?: boolean;
|
|
11
|
+
}
|
|
9
12
|
interface FileExplorerAPI {
|
|
10
13
|
/** 读取目录 */
|
|
11
|
-
readDirectory: (dirPath: string) => Promise<unknown[]>;
|
|
14
|
+
readDirectory: (dirPath: string, options?: ReadDirectoryOptions) => Promise<unknown[]>;
|
|
12
15
|
/** 读取系统路径目录 */
|
|
13
16
|
readSystemPath: (pathId: string) => Promise<unknown[]>;
|
|
14
17
|
/** 获取系统路径 */
|
|
@@ -120,6 +123,11 @@ interface FileExplorerAPI {
|
|
|
120
123
|
success: boolean;
|
|
121
124
|
error?: string;
|
|
122
125
|
}>;
|
|
126
|
+
/** 取消指定搜索 */
|
|
127
|
+
cancelSearch: (searchId: string) => Promise<{
|
|
128
|
+
success: boolean;
|
|
129
|
+
error?: string;
|
|
130
|
+
}>;
|
|
123
131
|
/** 监听搜索结果 */
|
|
124
132
|
onSearchResults: (callback: (data: {
|
|
125
133
|
searchId: string;
|
|
@@ -249,13 +257,13 @@ interface FileExplorerAPI {
|
|
|
249
257
|
success: boolean;
|
|
250
258
|
error?: string;
|
|
251
259
|
}>;
|
|
252
|
-
/**
|
|
253
|
-
|
|
260
|
+
/** 打开媒体文件应用 */
|
|
261
|
+
openMediaFileApp: (filePath: string, mediaType: 'image' | 'video' | 'audio') => Promise<{
|
|
254
262
|
success: boolean;
|
|
255
263
|
error?: string;
|
|
256
264
|
}>;
|
|
257
|
-
/**
|
|
258
|
-
|
|
265
|
+
/** 关闭媒体文件应用 */
|
|
266
|
+
closeMediaFileApp: (filePath: string, mediaType: 'image' | 'video' | 'audio') => Promise<{
|
|
259
267
|
success: boolean;
|
|
260
268
|
error?: string;
|
|
261
269
|
}>;
|
|
@@ -275,4 +283,4 @@ interface ExposeFileExplorerAPIOptions {
|
|
|
275
283
|
}
|
|
276
284
|
declare function exposeFileExplorerAPI(options?: ExposeFileExplorerAPIOptions): void;
|
|
277
285
|
|
|
278
|
-
export { type ExposeFileExplorerAPIOptions, type FileExplorerAPI, exposeFileExplorerAPI };
|
|
286
|
+
export { type ExposeFileExplorerAPIOptions, type FileExplorerAPI, type ReadDirectoryOptions, exposeFileExplorerAPI };
|
package/dist/preload/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{contextBridge as e,ipcRenderer as o}from"electron";function i(i={}){const n=i.apiName||"fileExplorerAPI",r=function(e={}){const i=e.channelPrefix||"file-explorer",n=e=>`${i}:${e}`;return{readDirectory:e=>o.invoke(n("readDirectory"),e),readSystemPath:e=>o.invoke(n("readSystemPath"),e),getSystemPath:e=>o.invoke(n("getSystemPath"),e),readFileContent:e=>o.invoke(n("readFileContent"),e),writeFileContent:(e,i)=>o.invoke(n("writeFileContent"),e,i),createFolder:(e,i)=>o.invoke(n("createFolder"),e,i),createFile:(e,i,r)=>o.invoke(n("createFile"),e,i,r),deleteFiles:e=>o.invoke(n("deleteFiles"),e),renameFile:(e,i)=>o.invoke(n("renameFile"),e,i),copyFiles:(e,i)=>o.invoke(n("copyFiles"),e,i),moveFiles:(e,i)=>o.invoke(n("moveFiles"),e,i),getFileInfo:e=>o.invoke(n("getFileInfo"),e),readImageAsBase64:e=>o.invoke(n("readImageAsBase64"),e),openPath:e=>o.invoke(n("openPath"),e),getApplicationIcon:e=>o.invoke(n("getApplicationIcon"),e),getThumbnailUrl:e=>o.invoke(n("getThumbnailUrl"),e),copyFilesToClipboard:e=>o.invoke(n("copyFilesToClipboard"),e),getClipboardFiles:()=>o.invoke(n("getClipboardFiles")),pasteFiles:(e,i)=>o.invoke(n("pasteFiles"),e,i),searchFiles:(e,i,r)=>o.invoke(n("searchFiles"),e,i,r),searchFilesStream:(e,i,r)=>o.invoke(n("searchFilesStream"),e,i,r),onSearchResults:e=>{const i=(o,i)=>{e(i)};return o.on(n("searchResults"),i),()=>o.removeListener(n("searchResults"),i)},compressFiles:(e,i)=>o.invoke(n("compressFiles"),e,i),extractArchive:(e,i)=>o.invoke(n("extractArchive"),e,i),isArchiveFile:e=>o.invoke(n("isArchiveFile"),e),onCompressProgress:e=>{const i=(o,i)=>{e(i)};return o.on(n("compressProgress"),i),()=>o.removeListener(n("compressProgress"),i)},onExtractProgress:e=>{const i=(o,i)=>{e(i)};return o.on(n("extractProgress"),i),()=>o.removeListener(n("extractProgress"),i)},watchDirectory:(e,i)=>o.invoke(n("watchDirectory"),e,i),unwatchDirectory:e=>o.invoke(n("unwatchDirectory"),e),onWatchEvent:e=>{const i=(o,i)=>{e(i)};return o.on(n("watchEvent"),i),()=>o.removeListener(n("watchEvent"),i)},showFileInfo:e=>o.invoke(n("showFileInfo"),e),openInTerminal:e=>o.invoke(n("openInTerminal"),e),openInEditor:e=>o.invoke(n("openInEditor"),e),openInNewWindow:e=>o.invoke(n("openInNewWindow"),e),requestWindowFocus:()=>o.send(n("requestWindowFocus")),mediaNeedsTranscode:e=>o.invoke(n("mediaNeedsTranscode"),e),mediaGetPlayableUrl:e=>o.invoke(n("mediaGetPlayableUrl"),e),mediaGetMetadata:e=>o.invoke(n("mediaGetMetadata"),e),onMediaTranscodeProgress:e=>{const i=(o,i)=>{e(i)};return o.on(n("mediaTranscodeProgress"),i),()=>o.removeListener(n("mediaTranscodeProgress"),i)},mediaCleanupFile:e=>o.invoke(n("mediaCleanupFile"),e),
|
|
1
|
+
import{contextBridge as e,ipcRenderer as o}from"electron";function i(i={}){const n=i.apiName||"fileExplorerAPI",r=function(e={}){const i=e.channelPrefix||"file-explorer",n=e=>`${i}:${e}`;return{readDirectory:(e,i)=>o.invoke(n("readDirectory"),e,i),readSystemPath:e=>o.invoke(n("readSystemPath"),e),getSystemPath:e=>o.invoke(n("getSystemPath"),e),readFileContent:e=>o.invoke(n("readFileContent"),e),writeFileContent:(e,i)=>o.invoke(n("writeFileContent"),e,i),createFolder:(e,i)=>o.invoke(n("createFolder"),e,i),createFile:(e,i,r)=>o.invoke(n("createFile"),e,i,r),deleteFiles:e=>o.invoke(n("deleteFiles"),e),renameFile:(e,i)=>o.invoke(n("renameFile"),e,i),copyFiles:(e,i)=>o.invoke(n("copyFiles"),e,i),moveFiles:(e,i)=>o.invoke(n("moveFiles"),e,i),getFileInfo:e=>o.invoke(n("getFileInfo"),e),readImageAsBase64:e=>o.invoke(n("readImageAsBase64"),e),openPath:e=>o.invoke(n("openPath"),e),getApplicationIcon:e=>o.invoke(n("getApplicationIcon"),e),getThumbnailUrl:e=>o.invoke(n("getThumbnailUrl"),e),copyFilesToClipboard:e=>o.invoke(n("copyFilesToClipboard"),e),getClipboardFiles:()=>o.invoke(n("getClipboardFiles")),pasteFiles:(e,i)=>o.invoke(n("pasteFiles"),e,i),searchFiles:(e,i,r)=>o.invoke(n("searchFiles"),e,i,r),searchFilesStream:(e,i,r)=>o.invoke(n("searchFilesStream"),e,i,r),cancelSearch:e=>o.invoke(n("cancelSearch"),e),onSearchResults:e=>{const i=(o,i)=>{e(i)};return o.on(n("searchResults"),i),()=>o.removeListener(n("searchResults"),i)},compressFiles:(e,i)=>o.invoke(n("compressFiles"),e,i),extractArchive:(e,i)=>o.invoke(n("extractArchive"),e,i),isArchiveFile:e=>o.invoke(n("isArchiveFile"),e),onCompressProgress:e=>{const i=(o,i)=>{e(i)};return o.on(n("compressProgress"),i),()=>o.removeListener(n("compressProgress"),i)},onExtractProgress:e=>{const i=(o,i)=>{e(i)};return o.on(n("extractProgress"),i),()=>o.removeListener(n("extractProgress"),i)},watchDirectory:(e,i)=>o.invoke(n("watchDirectory"),e,i),unwatchDirectory:e=>o.invoke(n("unwatchDirectory"),e),onWatchEvent:e=>{const i=(o,i)=>{e(i)};return o.on(n("watchEvent"),i),()=>o.removeListener(n("watchEvent"),i)},showFileInfo:e=>o.invoke(n("showFileInfo"),e),openInTerminal:e=>o.invoke(n("openInTerminal"),e),openInEditor:e=>o.invoke(n("openInEditor"),e),openInNewWindow:e=>o.invoke(n("openInNewWindow"),e),requestWindowFocus:()=>o.send(n("requestWindowFocus")),mediaNeedsTranscode:e=>o.invoke(n("mediaNeedsTranscode"),e),mediaGetPlayableUrl:e=>o.invoke(n("mediaGetPlayableUrl"),e),mediaGetMetadata:e=>o.invoke(n("mediaGetMetadata"),e),onMediaTranscodeProgress:e=>{const i=(o,i)=>{e(i)};return o.on(n("mediaTranscodeProgress"),i),()=>o.removeListener(n("mediaTranscodeProgress"),i)},mediaCleanupFile:e=>o.invoke(n("mediaCleanupFile"),e),openMediaFileApp:(e,i)=>o.invoke(n("openMediaFileApp"),e,i),closeMediaFileApp:(e,i)=>o.invoke(n("closeMediaFileApp"),e,i)}}({channelPrefix:i.channelPrefix});e.exposeInMainWorld(n,r)}export{i as exposeFileExplorerAPI};
|
package/dist/renderer/index.d.ts
CHANGED
|
@@ -9,10 +9,13 @@ import { FileItem, OperationResult, FileInfo, CompressOptions, CompressResult, E
|
|
|
9
9
|
/**
|
|
10
10
|
* Window 扩展类型
|
|
11
11
|
*/
|
|
12
|
+
interface ReadDirectoryOptions {
|
|
13
|
+
includeHidden?: boolean;
|
|
14
|
+
}
|
|
12
15
|
declare global {
|
|
13
16
|
interface Window {
|
|
14
17
|
fileExplorerAPI?: {
|
|
15
|
-
readDirectory: (dirPath: string) => Promise<FileItem[]>;
|
|
18
|
+
readDirectory: (dirPath: string, options?: ReadDirectoryOptions) => Promise<FileItem[]>;
|
|
16
19
|
readSystemPath: (pathId: string) => Promise<FileItem[]>;
|
|
17
20
|
getSystemPath: (pathId: string) => Promise<string | null>;
|
|
18
21
|
readFileContent: (filePath: string) => Promise<string>;
|
|
@@ -53,6 +56,7 @@ declare global {
|
|
|
53
56
|
total: number;
|
|
54
57
|
}>>;
|
|
55
58
|
searchFilesStream: (searchPath: string, pattern: string, searchId: string) => Promise<OperationResult>;
|
|
59
|
+
cancelSearch: (searchId: string) => Promise<OperationResult>;
|
|
56
60
|
onSearchResults: (callback: (data: {
|
|
57
61
|
searchId: string;
|
|
58
62
|
items: FileItem[];
|
|
@@ -86,8 +90,8 @@ declare global {
|
|
|
86
90
|
progress: TranscodeProgress;
|
|
87
91
|
}) => void) => () => void;
|
|
88
92
|
mediaCleanupFile: (filePath: string) => Promise<OperationResult>;
|
|
89
|
-
|
|
90
|
-
|
|
93
|
+
openMediaFileApp: (filePath: string, mediaType: 'image' | 'video' | 'audio') => Promise<OperationResult>;
|
|
94
|
+
closeMediaFileApp: (filePath: string, mediaType: 'image' | 'video' | 'audio') => Promise<OperationResult>;
|
|
91
95
|
};
|
|
92
96
|
}
|
|
93
97
|
}
|
|
@@ -102,7 +106,7 @@ declare global {
|
|
|
102
106
|
* ```
|
|
103
107
|
*/
|
|
104
108
|
declare function createFileExplorerClient(apiName?: string): {
|
|
105
|
-
readDirectory: (dirPath: string) => Promise<FileItem[]>;
|
|
109
|
+
readDirectory: (dirPath: string, options?: ReadDirectoryOptions) => Promise<FileItem[]>;
|
|
106
110
|
readSystemPath: (pathId: string) => Promise<FileItem[]>;
|
|
107
111
|
getSystemPath: (pathId: string) => Promise<string | null>;
|
|
108
112
|
readFileContent: (filePath: string) => Promise<string>;
|
|
@@ -143,6 +147,7 @@ declare function createFileExplorerClient(apiName?: string): {
|
|
|
143
147
|
total: number;
|
|
144
148
|
}>>;
|
|
145
149
|
searchFilesStream: (searchPath: string, pattern: string, searchId: string) => Promise<OperationResult>;
|
|
150
|
+
cancelSearch: (searchId: string) => Promise<OperationResult>;
|
|
146
151
|
onSearchResults: (callback: (data: {
|
|
147
152
|
searchId: string;
|
|
148
153
|
items: FileItem[];
|
|
@@ -176,8 +181,8 @@ declare function createFileExplorerClient(apiName?: string): {
|
|
|
176
181
|
progress: TranscodeProgress;
|
|
177
182
|
}) => void) => () => void;
|
|
178
183
|
mediaCleanupFile: (filePath: string) => Promise<OperationResult>;
|
|
179
|
-
|
|
180
|
-
|
|
184
|
+
openMediaFileApp: (filePath: string, mediaType: "image" | "video" | "audio") => Promise<OperationResult>;
|
|
185
|
+
closeMediaFileApp: (filePath: string, mediaType: "image" | "video" | "audio") => Promise<OperationResult>;
|
|
181
186
|
};
|
|
182
187
|
|
|
183
188
|
export { createFileExplorerClient };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@huyooo/file-explorer-bridge-electron",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.30",
|
|
4
4
|
"description": "File Explorer Electron Bridge - IPC integration for Electron apps",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/main/index.js",
|
|
@@ -9,17 +9,14 @@
|
|
|
9
9
|
"exports": {
|
|
10
10
|
"./main": {
|
|
11
11
|
"types": "./dist/main/index.d.ts",
|
|
12
|
-
"development": "./src/main/index.ts",
|
|
13
12
|
"import": "./dist/main/index.js"
|
|
14
13
|
},
|
|
15
14
|
"./preload": {
|
|
16
15
|
"types": "./dist/preload/index.d.ts",
|
|
17
|
-
"development": "./src/preload/index.ts",
|
|
18
16
|
"import": "./dist/preload/index.js"
|
|
19
17
|
},
|
|
20
18
|
"./renderer": {
|
|
21
19
|
"types": "./dist/renderer/index.d.ts",
|
|
22
|
-
"development": "./src/renderer/index.ts",
|
|
23
20
|
"import": "./dist/renderer/index.js"
|
|
24
21
|
}
|
|
25
22
|
},
|
|
@@ -33,8 +30,7 @@
|
|
|
33
30
|
"clean": "rm -rf dist"
|
|
34
31
|
},
|
|
35
32
|
"dependencies": {
|
|
36
|
-
"@huyooo/file-explorer-core": "^0.4.
|
|
37
|
-
"@huyooo/file-explorer-preview": "^0.4.27"
|
|
33
|
+
"@huyooo/file-explorer-core": "^0.4.30"
|
|
38
34
|
},
|
|
39
35
|
"peerDependencies": {
|
|
40
36
|
"electron": ">=20.0.0"
|
|
@@ -62,20 +58,6 @@
|
|
|
62
58
|
"author": "huyooo",
|
|
63
59
|
"license": "SEE LICENSE IN LICENSE",
|
|
64
60
|
"publishConfig": {
|
|
65
|
-
"access": "public"
|
|
66
|
-
"exports": {
|
|
67
|
-
"./main": {
|
|
68
|
-
"types": "./dist/main/index.d.ts",
|
|
69
|
-
"import": "./dist/main/index.js"
|
|
70
|
-
},
|
|
71
|
-
"./preload": {
|
|
72
|
-
"types": "./dist/preload/index.d.ts",
|
|
73
|
-
"import": "./dist/preload/index.js"
|
|
74
|
-
},
|
|
75
|
-
"./renderer": {
|
|
76
|
-
"types": "./dist/renderer/index.d.ts",
|
|
77
|
-
"import": "./dist/renderer/index.js"
|
|
78
|
-
}
|
|
79
|
-
}
|
|
61
|
+
"access": "public"
|
|
80
62
|
}
|
|
81
63
|
}
|