assistsx-js 0.1.41 → 0.2.0

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.
Files changed (104) hide show
  1. package/README.md +32 -0
  2. package/dist/index.cjs +7957 -0
  3. package/dist/index.cjs.map +1 -0
  4. package/dist/index.d.mts +4231 -0
  5. package/dist/index.d.ts +4231 -30
  6. package/dist/index.global.js +46 -0
  7. package/dist/index.global.js.map +1 -0
  8. package/dist/index.js +7879 -30
  9. package/dist/index.js.map +1 -0
  10. package/package.json +11 -5
  11. package/src/{AssistsXAsync.ts → assistsx-async.ts} +8 -8
  12. package/src/{AssistsX.ts → assistsx.ts} +8 -8
  13. package/src/barutils/bar-utils.ts +3 -3
  14. package/src/filesystem/fileio/file-io.ts +2 -2
  15. package/src/filesystem/fileutils/file-utils.ts +2 -2
  16. package/src/filesystem/path.ts +2 -2
  17. package/src/floatingwindow/float.ts +4 -4
  18. package/src/gallery/gallery.ts +2 -2
  19. package/src/global.d.ts +6 -1
  20. package/src/imageutils/image-utils.ts +2 -2
  21. package/src/ime/ime.ts +2 -2
  22. package/src/index.ts +21 -20
  23. package/src/log/log-call-method.ts +28 -0
  24. package/src/log/log.ts +445 -0
  25. package/src/mlkit/mlkit.ts +3 -3
  26. package/src/network/http.ts +2 -2
  27. package/src/{NodeAsync.ts → node-async.ts} +5 -5
  28. package/src/{Node.ts → node.ts} +5 -5
  29. package/src/{StepAsync.ts → step-async.ts} +8 -8
  30. package/src/{Step.ts → step.ts} +7 -7
  31. package/dist/AccessibilityEventFilter.d.ts +0 -105
  32. package/dist/AccessibilityEventFilter.js +0 -89
  33. package/dist/AppInfo.d.ts +0 -45
  34. package/dist/AppInfo.js +0 -38
  35. package/dist/AssistsX.d.ts +0 -484
  36. package/dist/AssistsX.js +0 -828
  37. package/dist/AssistsXAsync.d.ts +0 -532
  38. package/dist/AssistsXAsync.js +0 -874
  39. package/dist/Bounds.d.ts +0 -48
  40. package/dist/Bounds.js +0 -68
  41. package/dist/CallMethod.d.ts +0 -69
  42. package/dist/CallMethod.js +0 -71
  43. package/dist/CallResponse.d.ts +0 -10
  44. package/dist/CallResponse.js +0 -28
  45. package/dist/DeviceInfo.d.ts +0 -69
  46. package/dist/DeviceInfo.js +0 -50
  47. package/dist/Node.d.ts +0 -334
  48. package/dist/Node.js +0 -369
  49. package/dist/NodeAsync.d.ts +0 -213
  50. package/dist/NodeAsync.js +0 -313
  51. package/dist/NodeClassValue.d.ts +0 -15
  52. package/dist/NodeClassValue.js +0 -15
  53. package/dist/Step.d.ts +0 -355
  54. package/dist/Step.js +0 -689
  55. package/dist/StepAsync.d.ts +0 -162
  56. package/dist/StepAsync.js +0 -264
  57. package/dist/StepError.d.ts +0 -35
  58. package/dist/StepError.js +0 -26
  59. package/dist/StepStateStore.d.ts +0 -14
  60. package/dist/StepStateStore.js +0 -37
  61. package/dist/Utils.d.ts +0 -3
  62. package/dist/Utils.js +0 -20
  63. package/dist/WindowFlags.d.ts +0 -75
  64. package/dist/WindowFlags.js +0 -97
  65. package/dist/barutils/BarUtilsCallMethod.d.ts +0 -24
  66. package/dist/barutils/BarUtilsCallMethod.js +0 -26
  67. package/dist/barutils/bar-utils.d.ts +0 -41
  68. package/dist/barutils/bar-utils.js +0 -205
  69. package/dist/filesystem/fileio/file-io.d.ts +0 -101
  70. package/dist/filesystem/fileio/file-io.js +0 -235
  71. package/dist/filesystem/fileutils/file-utils.d.ts +0 -242
  72. package/dist/filesystem/fileutils/file-utils.js +0 -493
  73. package/dist/filesystem/path.d.ts +0 -252
  74. package/dist/filesystem/path.js +0 -589
  75. package/dist/floatingwindow/FloatCallMethod.d.ts +0 -19
  76. package/dist/floatingwindow/FloatCallMethod.js +0 -18
  77. package/dist/floatingwindow/float.d.ts +0 -29
  78. package/dist/floatingwindow/float.js +0 -149
  79. package/dist/gallery/gallery.d.ts +0 -60
  80. package/dist/gallery/gallery.js +0 -142
  81. package/dist/imageutils/image-utils.d.ts +0 -442
  82. package/dist/imageutils/image-utils.js +0 -543
  83. package/dist/ime/ime.d.ts +0 -80
  84. package/dist/ime/ime.js +0 -141
  85. package/dist/mlkit/MlkitCallMethod.d.ts +0 -27
  86. package/dist/mlkit/MlkitCallMethod.js +0 -26
  87. package/dist/mlkit/mlkit.d.ts +0 -86
  88. package/dist/mlkit/mlkit.js +0 -169
  89. package/dist/network/http.d.ts +0 -127
  90. package/dist/network/http.js +0 -202
  91. /package/src/{AccessibilityEventFilter.ts → accessibility-event-filter.ts} +0 -0
  92. /package/src/{AppInfo.ts → app-info.ts} +0 -0
  93. /package/src/barutils/{BarUtilsCallMethod.ts → bar-utils-call-method.ts} +0 -0
  94. /package/src/{Bounds.ts → bounds.ts} +0 -0
  95. /package/src/{CallMethod.ts → call-method.ts} +0 -0
  96. /package/src/{CallResponse.ts → call-response.ts} +0 -0
  97. /package/src/{DeviceInfo.ts → device-info.ts} +0 -0
  98. /package/src/floatingwindow/{FloatCallMethod.ts → float-call-method.ts} +0 -0
  99. /package/src/mlkit/{MlkitCallMethod.ts → mlkit-call-method.ts} +0 -0
  100. /package/src/{NodeClassValue.ts → node-class-value.ts} +0 -0
  101. /package/src/{StepError.ts → step-error.ts} +0 -0
  102. /package/src/{StepStateStore.ts → step-state-store.ts} +0 -0
  103. /package/src/{Utils.ts → utils.ts} +0 -0
  104. /package/src/{WindowFlags.ts → window-flags.ts} +0 -0
@@ -1,493 +0,0 @@
1
- /**
2
- * 文件工具相关功能
3
- * 提供文件操作相关的功能
4
- */
5
- import { CallResponse } from "../../CallResponse";
6
- import { decodeBase64UTF8, generateUUID } from "../../Utils";
7
- // 回调函数存储对象
8
- const callbacks = new Map();
9
- // 初始化全局回调函数
10
- if (typeof window !== "undefined" && !window.assistsxFileUtilsCallback) {
11
- window.assistsxFileUtilsCallback = (data) => {
12
- let callbackId;
13
- try {
14
- const json = decodeBase64UTF8(data);
15
- const response = JSON.parse(json);
16
- callbackId = response.callbackId;
17
- if (callbackId) {
18
- const callback = callbacks.get(callbackId);
19
- if (callback) {
20
- callback(json);
21
- }
22
- }
23
- }
24
- catch (e) {
25
- console.error("FileUtils callback error:", e);
26
- }
27
- finally {
28
- if (callbackId) {
29
- callbacks.delete(callbackId);
30
- }
31
- }
32
- };
33
- }
34
- export class FileUtils {
35
- /**
36
- * 执行异步调用
37
- * @param method 方法名
38
- * @param args 参数对象
39
- * @param timeout 超时时间(秒),默认30秒
40
- * @returns Promise<调用响应>
41
- */
42
- async asyncCall(method, args, timeout = 30) {
43
- const uuid = generateUUID();
44
- const params = {
45
- method,
46
- arguments: args ? args : undefined,
47
- callbackId: uuid,
48
- };
49
- const promise = new Promise((resolve) => {
50
- callbacks.set(uuid, (data) => {
51
- resolve(data);
52
- });
53
- setTimeout(() => {
54
- callbacks.delete(uuid);
55
- resolve(JSON.stringify(new CallResponse(0, null, uuid)));
56
- }, timeout * 1000);
57
- });
58
- const result = window.assistsxFileUtils.call(JSON.stringify(params));
59
- const promiseResult = await promise;
60
- if (typeof promiseResult === "string") {
61
- const responseData = JSON.parse(promiseResult);
62
- return new CallResponse(responseData.code, responseData.data, responseData.callbackId);
63
- }
64
- throw new Error("Call failed");
65
- }
66
- /**
67
- * 根据路径获取文件
68
- * @param filePath 文件路径
69
- * @param timeout 超时时间(秒),默认30秒
70
- * @returns Promise<文件信息>
71
- */
72
- async getFileByPath(filePath, timeout) {
73
- var _a;
74
- const response = await this.asyncCall("getFileByPath", { filePath }, timeout);
75
- if (!response.isSuccess()) {
76
- throw new Error(((_a = response.data) === null || _a === void 0 ? void 0 : _a.message) || "Get file by path failed");
77
- }
78
- return response.data;
79
- }
80
- /**
81
- * 检查文件是否存在
82
- * @param filePath 文件路径
83
- * @param timeout 超时时间(秒),默认30秒
84
- * @returns Promise<是否存在>
85
- */
86
- async isFileExists(filePath, timeout) {
87
- var _a;
88
- const response = await this.asyncCall("isFileExists", { filePath }, timeout);
89
- if (!response.isSuccess()) {
90
- throw new Error(((_a = response.data) === null || _a === void 0 ? void 0 : _a.message) || "Check file exists failed");
91
- }
92
- return response.data;
93
- }
94
- /**
95
- * 重命名文件
96
- * @param filePath 文件路径
97
- * @param newName 新名称
98
- * @param timeout 超时时间(秒),默认30秒
99
- * @returns Promise<是否成功>
100
- */
101
- async rename(filePath, newName, timeout) {
102
- var _a;
103
- const response = await this.asyncCall("rename", { filePath, newName }, timeout);
104
- if (!response.isSuccess()) {
105
- throw new Error(((_a = response.data) === null || _a === void 0 ? void 0 : _a.message) || "Rename file failed");
106
- }
107
- return response.data;
108
- }
109
- /**
110
- * 检查是否为目录
111
- * @param filePath 文件路径
112
- * @param timeout 超时时间(秒),默认30秒
113
- * @returns Promise<是否为目录>
114
- */
115
- async isDir(filePath, timeout) {
116
- var _a;
117
- const response = await this.asyncCall("isDir", { filePath }, timeout);
118
- if (!response.isSuccess()) {
119
- throw new Error(((_a = response.data) === null || _a === void 0 ? void 0 : _a.message) || "Check is directory failed");
120
- }
121
- return response.data;
122
- }
123
- /**
124
- * 检查是否为文件
125
- * @param filePath 文件路径
126
- * @param timeout 超时时间(秒),默认30秒
127
- * @returns Promise<是否为文件>
128
- */
129
- async isFile(filePath, timeout) {
130
- var _a;
131
- const response = await this.asyncCall("isFile", { filePath }, timeout);
132
- if (!response.isSuccess()) {
133
- throw new Error(((_a = response.data) === null || _a === void 0 ? void 0 : _a.message) || "Check is file failed");
134
- }
135
- return response.data;
136
- }
137
- /**
138
- * 创建或存在目录
139
- * @param dirPath 目录路径
140
- * @param timeout 超时时间(秒),默认30秒
141
- * @returns Promise<是否成功>
142
- */
143
- async createOrExistsDir(dirPath, timeout) {
144
- var _a;
145
- const response = await this.asyncCall("createOrExistsDir", { dirPath }, timeout);
146
- if (!response.isSuccess()) {
147
- throw new Error(((_a = response.data) === null || _a === void 0 ? void 0 : _a.message) || "Create or exists dir failed");
148
- }
149
- return response.data;
150
- }
151
- /**
152
- * 创建或存在文件
153
- * @param filePath 文件路径
154
- * @param timeout 超时时间(秒),默认30秒
155
- * @returns Promise<是否成功>
156
- */
157
- async createOrExistsFile(filePath, timeout) {
158
- var _a;
159
- const response = await this.asyncCall("createOrExistsFile", { filePath }, timeout);
160
- if (!response.isSuccess()) {
161
- throw new Error(((_a = response.data) === null || _a === void 0 ? void 0 : _a.message) || "Create or exists file failed");
162
- }
163
- return response.data;
164
- }
165
- /**
166
- * 创建文件(如果存在则删除旧文件)
167
- * @param filePath 文件路径
168
- * @param timeout 超时时间(秒),默认30秒
169
- * @returns Promise<是否成功>
170
- */
171
- async createFileByDeleteOldFile(filePath, timeout) {
172
- var _a;
173
- const response = await this.asyncCall("createFileByDeleteOldFile", { filePath }, timeout);
174
- if (!response.isSuccess()) {
175
- throw new Error(((_a = response.data) === null || _a === void 0 ? void 0 : _a.message) || "Create file by delete old file failed");
176
- }
177
- return response.data;
178
- }
179
- /**
180
- * 复制文件
181
- * @param srcFilePath 源文件路径
182
- * @param destFilePath 目标文件路径
183
- * @param timeout 超时时间(秒),默认30秒
184
- * @returns Promise<是否成功>
185
- */
186
- async copy(srcFilePath, destFilePath, timeout) {
187
- var _a;
188
- const response = await this.asyncCall("copy", { srcFilePath, destFilePath }, timeout);
189
- if (!response.isSuccess()) {
190
- throw new Error(((_a = response.data) === null || _a === void 0 ? void 0 : _a.message) || "Copy file failed");
191
- }
192
- return response.data;
193
- }
194
- /**
195
- * 移动文件
196
- * @param srcFilePath 源文件路径
197
- * @param destFilePath 目标文件路径
198
- * @param timeout 超时时间(秒),默认30秒
199
- * @returns Promise<是否成功>
200
- */
201
- async move(srcFilePath, destFilePath, timeout) {
202
- var _a;
203
- const response = await this.asyncCall("move", { srcFilePath, destFilePath }, timeout);
204
- if (!response.isSuccess()) {
205
- throw new Error(((_a = response.data) === null || _a === void 0 ? void 0 : _a.message) || "Move file failed");
206
- }
207
- return response.data;
208
- }
209
- /**
210
- * 删除文件或目录
211
- * @param filePath 文件路径
212
- * @param timeout 超时时间(秒),默认30秒
213
- * @returns Promise<是否成功>
214
- */
215
- async delete(filePath, timeout) {
216
- var _a;
217
- const response = await this.asyncCall("delete", { filePath }, timeout);
218
- if (!response.isSuccess()) {
219
- throw new Error(((_a = response.data) === null || _a === void 0 ? void 0 : _a.message) || "Delete file failed");
220
- }
221
- return response.data;
222
- }
223
- /**
224
- * 删除目录中的所有内容
225
- * @param dirPath 目录路径
226
- * @param timeout 超时时间(秒),默认30秒
227
- * @returns Promise<是否成功>
228
- */
229
- async deleteAllInDir(dirPath, timeout) {
230
- var _a;
231
- const response = await this.asyncCall("deleteAllInDir", { dirPath }, timeout);
232
- if (!response.isSuccess()) {
233
- throw new Error(((_a = response.data) === null || _a === void 0 ? void 0 : _a.message) || "Delete all in dir failed");
234
- }
235
- return response.data;
236
- }
237
- /**
238
- * 删除目录中的所有文件
239
- * @param dirPath 目录路径
240
- * @param timeout 超时时间(秒),默认30秒
241
- * @returns Promise<是否成功>
242
- */
243
- async deleteFilesInDir(dirPath, timeout) {
244
- var _a;
245
- const response = await this.asyncCall("deleteFilesInDir", { dirPath }, timeout);
246
- if (!response.isSuccess()) {
247
- throw new Error(((_a = response.data) === null || _a === void 0 ? void 0 : _a.message) || "Delete files in dir failed");
248
- }
249
- return response.data;
250
- }
251
- /**
252
- * 删除目录中匹配过滤器的文件
253
- * @param dirPath 目录路径
254
- * @param filterPattern 过滤模式(正则表达式)
255
- * @param timeout 超时时间(秒),默认30秒
256
- * @returns Promise<是否成功>
257
- */
258
- async deleteFilesInDirWithFilter(dirPath, filterPattern, timeout) {
259
- var _a;
260
- const response = await this.asyncCall("deleteFilesInDirWithFilter", { dirPath, filterPattern }, timeout);
261
- if (!response.isSuccess()) {
262
- throw new Error(((_a = response.data) === null || _a === void 0 ? void 0 : _a.message) || "Delete files in dir with filter failed");
263
- }
264
- return response.data;
265
- }
266
- /**
267
- * 列出目录中的文件
268
- * @param dirPath 目录路径
269
- * @param timeout 超时时间(秒),默认30秒
270
- * @returns Promise<文件列表>
271
- */
272
- async listFilesInDir(dirPath, timeout) {
273
- var _a;
274
- const response = await this.asyncCall("listFilesInDir", { dirPath }, timeout);
275
- if (!response.isSuccess()) {
276
- throw new Error(((_a = response.data) === null || _a === void 0 ? void 0 : _a.message) || "List files in dir failed");
277
- }
278
- return response.data;
279
- }
280
- /**
281
- * 列出目录中匹配过滤器的文件
282
- * @param dirPath 目录路径
283
- * @param filterPattern 过滤模式(正则表达式)
284
- * @param timeout 超时时间(秒),默认30秒
285
- * @returns Promise<文件列表>
286
- */
287
- async listFilesInDirWithFilter(dirPath, filterPattern, timeout) {
288
- var _a;
289
- const response = await this.asyncCall("listFilesInDirWithFilter", { dirPath, filterPattern }, timeout);
290
- if (!response.isSuccess()) {
291
- throw new Error(((_a = response.data) === null || _a === void 0 ? void 0 : _a.message) || "List files in dir with filter failed");
292
- }
293
- return response.data;
294
- }
295
- /**
296
- * 获取文件最后修改时间
297
- * @param filePath 文件路径
298
- * @param timeout 超时时间(秒),默认30秒
299
- * @returns Promise<时间戳(毫秒)>
300
- */
301
- async getFileLastModified(filePath, timeout) {
302
- var _a;
303
- const response = await this.asyncCall("getFileLastModified", { filePath }, timeout);
304
- if (!response.isSuccess()) {
305
- throw new Error(((_a = response.data) === null || _a === void 0 ? void 0 : _a.message) || "Get file last modified failed");
306
- }
307
- return response.data;
308
- }
309
- /**
310
- * 获取文件字符集(简单检测)
311
- * @param filePath 文件路径
312
- * @param timeout 超时时间(秒),默认30秒
313
- * @returns Promise<字符集名称>
314
- */
315
- async getFileCharsetSimple(filePath, timeout) {
316
- var _a;
317
- const response = await this.asyncCall("getFileCharsetSimple", { filePath }, timeout);
318
- if (!response.isSuccess()) {
319
- throw new Error(((_a = response.data) === null || _a === void 0 ? void 0 : _a.message) || "Get file charset simple failed");
320
- }
321
- return response.data;
322
- }
323
- /**
324
- * 获取文件行数
325
- * @param filePath 文件路径
326
- * @param timeout 超时时间(秒),默认30秒
327
- * @returns Promise<行数>
328
- */
329
- async getFileLines(filePath, timeout) {
330
- var _a;
331
- const response = await this.asyncCall("getFileLines", { filePath }, timeout);
332
- if (!response.isSuccess()) {
333
- throw new Error(((_a = response.data) === null || _a === void 0 ? void 0 : _a.message) || "Get file lines failed");
334
- }
335
- return response.data;
336
- }
337
- /**
338
- * 获取文件或目录大小
339
- * @param filePath 文件路径
340
- * @param timeout 超时时间(秒),默认30秒
341
- * @returns Promise<大小(字节)>
342
- */
343
- async getSize(filePath, timeout) {
344
- var _a;
345
- const response = await this.asyncCall("getSize", { filePath }, timeout);
346
- if (!response.isSuccess()) {
347
- throw new Error(((_a = response.data) === null || _a === void 0 ? void 0 : _a.message) || "Get size failed");
348
- }
349
- return response.data;
350
- }
351
- /**
352
- * 获取文件长度
353
- * @param filePath 文件路径
354
- * @param timeout 超时时间(秒),默认30秒
355
- * @returns Promise<长度(字节)>
356
- */
357
- async getLength(filePath, timeout) {
358
- var _a;
359
- const response = await this.asyncCall("getLength", { filePath }, timeout);
360
- if (!response.isSuccess()) {
361
- throw new Error(((_a = response.data) === null || _a === void 0 ? void 0 : _a.message) || "Get length failed");
362
- }
363
- return response.data;
364
- }
365
- /**
366
- * 获取文件 MD5(Base64 编码)
367
- * @param filePath 文件路径
368
- * @param timeout 超时时间(秒),默认30秒
369
- * @returns Promise<Base64 编码的 MD5>
370
- */
371
- async getFileMD5(filePath, timeout) {
372
- var _a;
373
- const response = await this.asyncCall("getFileMD5", { filePath }, timeout);
374
- if (!response.isSuccess()) {
375
- throw new Error(((_a = response.data) === null || _a === void 0 ? void 0 : _a.message) || "Get file MD5 failed");
376
- }
377
- return response.data;
378
- }
379
- /**
380
- * 获取文件 MD5(字符串)
381
- * @param filePath 文件路径
382
- * @param timeout 超时时间(秒),默认30秒
383
- * @returns Promise<MD5 字符串>
384
- */
385
- async getFileMD5ToString(filePath, timeout) {
386
- var _a;
387
- const response = await this.asyncCall("getFileMD5ToString", { filePath }, timeout);
388
- if (!response.isSuccess()) {
389
- throw new Error(((_a = response.data) === null || _a === void 0 ? void 0 : _a.message) || "Get file MD5 to string failed");
390
- }
391
- return response.data;
392
- }
393
- /**
394
- * 获取目录名
395
- * @param filePath 文件路径
396
- * @param timeout 超时时间(秒),默认30秒
397
- * @returns Promise<目录名>
398
- */
399
- async getDirName(filePath, timeout) {
400
- var _a;
401
- const response = await this.asyncCall("getDirName", { filePath }, timeout);
402
- if (!response.isSuccess()) {
403
- throw new Error(((_a = response.data) === null || _a === void 0 ? void 0 : _a.message) || "Get dir name failed");
404
- }
405
- return response.data;
406
- }
407
- /**
408
- * 获取文件名
409
- * @param filePath 文件路径
410
- * @param timeout 超时时间(秒),默认30秒
411
- * @returns Promise<文件名>
412
- */
413
- async getFileName(filePath, timeout) {
414
- var _a;
415
- const response = await this.asyncCall("getFileName", { filePath }, timeout);
416
- if (!response.isSuccess()) {
417
- throw new Error(((_a = response.data) === null || _a === void 0 ? void 0 : _a.message) || "Get file name failed");
418
- }
419
- return response.data;
420
- }
421
- /**
422
- * 获取文件名(不含扩展名)
423
- * @param filePath 文件路径
424
- * @param timeout 超时时间(秒),默认30秒
425
- * @returns Promise<文件名(不含扩展名)>
426
- */
427
- async getFileNameNoExtension(filePath, timeout) {
428
- var _a;
429
- const response = await this.asyncCall("getFileNameNoExtension", { filePath }, timeout);
430
- if (!response.isSuccess()) {
431
- throw new Error(((_a = response.data) === null || _a === void 0 ? void 0 : _a.message) || "Get file name no extension failed");
432
- }
433
- return response.data;
434
- }
435
- /**
436
- * 获取文件扩展名
437
- * @param filePath 文件路径
438
- * @param timeout 超时时间(秒),默认30秒
439
- * @returns Promise<扩展名>
440
- */
441
- async getFileExtension(filePath, timeout) {
442
- var _a;
443
- const response = await this.asyncCall("getFileExtension", { filePath }, timeout);
444
- if (!response.isSuccess()) {
445
- throw new Error(((_a = response.data) === null || _a === void 0 ? void 0 : _a.message) || "Get file extension failed");
446
- }
447
- return response.data;
448
- }
449
- /**
450
- * 通知系统扫描文件
451
- * @param filePath 文件路径
452
- * @param timeout 超时时间(秒),默认30秒
453
- * @returns Promise<是否成功>
454
- */
455
- async notifySystemToScan(filePath, timeout) {
456
- var _a;
457
- const response = await this.asyncCall("notifySystemToScan", { filePath }, timeout);
458
- if (!response.isSuccess()) {
459
- throw new Error(((_a = response.data) === null || _a === void 0 ? void 0 : _a.message) || "Notify system to scan failed");
460
- }
461
- return response.data;
462
- }
463
- /**
464
- * 获取文件系统总大小
465
- * @param filePath 文件路径
466
- * @param timeout 超时时间(秒),默认30秒
467
- * @returns Promise<总大小(字节)>
468
- */
469
- async getFsTotalSize(filePath, timeout) {
470
- var _a;
471
- const response = await this.asyncCall("getFsTotalSize", { filePath }, timeout);
472
- if (!response.isSuccess()) {
473
- throw new Error(((_a = response.data) === null || _a === void 0 ? void 0 : _a.message) || "Get file system total size failed");
474
- }
475
- return response.data;
476
- }
477
- /**
478
- * 获取文件系统可用大小
479
- * @param filePath 文件路径
480
- * @param timeout 超时时间(秒),默认30秒
481
- * @returns Promise<可用大小(字节)>
482
- */
483
- async getFsAvailableSize(filePath, timeout) {
484
- var _a;
485
- const response = await this.asyncCall("getFsAvailableSize", { filePath }, timeout);
486
- if (!response.isSuccess()) {
487
- throw new Error(((_a = response.data) === null || _a === void 0 ? void 0 : _a.message) || "Get file system available size failed");
488
- }
489
- return response.data;
490
- }
491
- }
492
- // 导出常量实例
493
- export const fileUtils = new FileUtils();