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.
- package/README.md +32 -0
- package/dist/index.cjs +7957 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.mts +4231 -0
- package/dist/index.d.ts +4231 -30
- package/dist/index.global.js +46 -0
- package/dist/index.global.js.map +1 -0
- package/dist/index.js +7879 -30
- package/dist/index.js.map +1 -0
- package/package.json +11 -5
- package/src/{AssistsXAsync.ts → assistsx-async.ts} +8 -8
- package/src/{AssistsX.ts → assistsx.ts} +8 -8
- package/src/barutils/bar-utils.ts +3 -3
- package/src/filesystem/fileio/file-io.ts +2 -2
- package/src/filesystem/fileutils/file-utils.ts +2 -2
- package/src/filesystem/path.ts +2 -2
- package/src/floatingwindow/float.ts +4 -4
- package/src/gallery/gallery.ts +2 -2
- package/src/global.d.ts +6 -1
- package/src/imageutils/image-utils.ts +2 -2
- package/src/ime/ime.ts +2 -2
- package/src/index.ts +21 -20
- package/src/log/log-call-method.ts +28 -0
- package/src/log/log.ts +445 -0
- package/src/mlkit/mlkit.ts +3 -3
- package/src/network/http.ts +2 -2
- package/src/{NodeAsync.ts → node-async.ts} +5 -5
- package/src/{Node.ts → node.ts} +5 -5
- package/src/{StepAsync.ts → step-async.ts} +8 -8
- package/src/{Step.ts → step.ts} +7 -7
- package/dist/AccessibilityEventFilter.d.ts +0 -105
- package/dist/AccessibilityEventFilter.js +0 -89
- package/dist/AppInfo.d.ts +0 -45
- package/dist/AppInfo.js +0 -38
- package/dist/AssistsX.d.ts +0 -484
- package/dist/AssistsX.js +0 -828
- package/dist/AssistsXAsync.d.ts +0 -532
- package/dist/AssistsXAsync.js +0 -874
- package/dist/Bounds.d.ts +0 -48
- package/dist/Bounds.js +0 -68
- package/dist/CallMethod.d.ts +0 -69
- package/dist/CallMethod.js +0 -71
- package/dist/CallResponse.d.ts +0 -10
- package/dist/CallResponse.js +0 -28
- package/dist/DeviceInfo.d.ts +0 -69
- package/dist/DeviceInfo.js +0 -50
- package/dist/Node.d.ts +0 -334
- package/dist/Node.js +0 -369
- package/dist/NodeAsync.d.ts +0 -213
- package/dist/NodeAsync.js +0 -313
- package/dist/NodeClassValue.d.ts +0 -15
- package/dist/NodeClassValue.js +0 -15
- package/dist/Step.d.ts +0 -355
- package/dist/Step.js +0 -689
- package/dist/StepAsync.d.ts +0 -162
- package/dist/StepAsync.js +0 -264
- package/dist/StepError.d.ts +0 -35
- package/dist/StepError.js +0 -26
- package/dist/StepStateStore.d.ts +0 -14
- package/dist/StepStateStore.js +0 -37
- package/dist/Utils.d.ts +0 -3
- package/dist/Utils.js +0 -20
- package/dist/WindowFlags.d.ts +0 -75
- package/dist/WindowFlags.js +0 -97
- package/dist/barutils/BarUtilsCallMethod.d.ts +0 -24
- package/dist/barutils/BarUtilsCallMethod.js +0 -26
- package/dist/barutils/bar-utils.d.ts +0 -41
- package/dist/barutils/bar-utils.js +0 -205
- package/dist/filesystem/fileio/file-io.d.ts +0 -101
- package/dist/filesystem/fileio/file-io.js +0 -235
- package/dist/filesystem/fileutils/file-utils.d.ts +0 -242
- package/dist/filesystem/fileutils/file-utils.js +0 -493
- package/dist/filesystem/path.d.ts +0 -252
- package/dist/filesystem/path.js +0 -589
- package/dist/floatingwindow/FloatCallMethod.d.ts +0 -19
- package/dist/floatingwindow/FloatCallMethod.js +0 -18
- package/dist/floatingwindow/float.d.ts +0 -29
- package/dist/floatingwindow/float.js +0 -149
- package/dist/gallery/gallery.d.ts +0 -60
- package/dist/gallery/gallery.js +0 -142
- package/dist/imageutils/image-utils.d.ts +0 -442
- package/dist/imageutils/image-utils.js +0 -543
- package/dist/ime/ime.d.ts +0 -80
- package/dist/ime/ime.js +0 -141
- package/dist/mlkit/MlkitCallMethod.d.ts +0 -27
- package/dist/mlkit/MlkitCallMethod.js +0 -26
- package/dist/mlkit/mlkit.d.ts +0 -86
- package/dist/mlkit/mlkit.js +0 -169
- package/dist/network/http.d.ts +0 -127
- package/dist/network/http.js +0 -202
- /package/src/{AccessibilityEventFilter.ts → accessibility-event-filter.ts} +0 -0
- /package/src/{AppInfo.ts → app-info.ts} +0 -0
- /package/src/barutils/{BarUtilsCallMethod.ts → bar-utils-call-method.ts} +0 -0
- /package/src/{Bounds.ts → bounds.ts} +0 -0
- /package/src/{CallMethod.ts → call-method.ts} +0 -0
- /package/src/{CallResponse.ts → call-response.ts} +0 -0
- /package/src/{DeviceInfo.ts → device-info.ts} +0 -0
- /package/src/floatingwindow/{FloatCallMethod.ts → float-call-method.ts} +0 -0
- /package/src/mlkit/{MlkitCallMethod.ts → mlkit-call-method.ts} +0 -0
- /package/src/{NodeClassValue.ts → node-class-value.ts} +0 -0
- /package/src/{StepError.ts → step-error.ts} +0 -0
- /package/src/{StepStateStore.ts → step-state-store.ts} +0 -0
- /package/src/{Utils.ts → utils.ts} +0 -0
- /package/src/{WindowFlags.ts → window-flags.ts} +0 -0
|
@@ -1,235 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 文件IO相关功能
|
|
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.assistsxFileIOCallback) {
|
|
11
|
-
window.assistsxFileIOCallback = (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("FileIO callback error:", e);
|
|
26
|
-
}
|
|
27
|
-
finally {
|
|
28
|
-
if (callbackId) {
|
|
29
|
-
callbacks.delete(callbackId);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
export class FileIO {
|
|
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.assistsxFileIO.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 inputStreamBase64 Base64 编码的输入流数据
|
|
70
|
-
* @param append 是否追加,默认为 false
|
|
71
|
-
* @param timeout 超时时间(秒),默认30秒
|
|
72
|
-
* @returns Promise<是否成功>
|
|
73
|
-
*/
|
|
74
|
-
async writeFileFromIS(filePath, inputStreamBase64, append = false, timeout) {
|
|
75
|
-
var _a;
|
|
76
|
-
const response = await this.asyncCall("writeFileFromIS", { filePath, inputStreamBase64, append }, timeout);
|
|
77
|
-
if (!response.isSuccess()) {
|
|
78
|
-
throw new Error(((_a = response.data) === null || _a === void 0 ? void 0 : _a.message) || "Write file from input stream failed");
|
|
79
|
-
}
|
|
80
|
-
return response.data;
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* 从字节数组写入文件(使用流)
|
|
84
|
-
* @param filePath 文件路径
|
|
85
|
-
* @param bytesBase64 Base64 编码的字节数组
|
|
86
|
-
* @param append 是否追加,默认为 false
|
|
87
|
-
* @param timeout 超时时间(秒),默认30秒
|
|
88
|
-
* @returns Promise<是否成功>
|
|
89
|
-
*/
|
|
90
|
-
async writeFileFromBytesByStream(filePath, bytesBase64, append = false, timeout) {
|
|
91
|
-
var _a;
|
|
92
|
-
const response = await this.asyncCall("writeFileFromBytesByStream", { filePath, bytesBase64, append }, timeout);
|
|
93
|
-
if (!response.isSuccess()) {
|
|
94
|
-
throw new Error(((_a = response.data) === null || _a === void 0 ? void 0 : _a.message) || "Write file from bytes by stream failed");
|
|
95
|
-
}
|
|
96
|
-
return response.data;
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* 从字节数组写入文件(使用通道)
|
|
100
|
-
* @param filePath 文件路径
|
|
101
|
-
* @param bytesBase64 Base64 编码的字节数组
|
|
102
|
-
* @param append 是否追加,默认为 false
|
|
103
|
-
* @param timeout 超时时间(秒),默认30秒
|
|
104
|
-
* @returns Promise<是否成功>
|
|
105
|
-
*/
|
|
106
|
-
async writeFileFromBytesByChannel(filePath, bytesBase64, append = false, timeout) {
|
|
107
|
-
var _a;
|
|
108
|
-
const response = await this.asyncCall("writeFileFromBytesByChannel", { filePath, bytesBase64, append }, timeout);
|
|
109
|
-
if (!response.isSuccess()) {
|
|
110
|
-
throw new Error(((_a = response.data) === null || _a === void 0 ? void 0 : _a.message) || "Write file from bytes by channel failed");
|
|
111
|
-
}
|
|
112
|
-
return response.data;
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* 从字节数组写入文件(使用内存映射)
|
|
116
|
-
* @param filePath 文件路径
|
|
117
|
-
* @param bytesBase64 Base64 编码的字节数组
|
|
118
|
-
* @param append 是否追加,默认为 false
|
|
119
|
-
* @param timeout 超时时间(秒),默认30秒
|
|
120
|
-
* @returns Promise<是否成功>
|
|
121
|
-
*/
|
|
122
|
-
async writeFileFromBytesByMap(filePath, bytesBase64, append = false, timeout) {
|
|
123
|
-
var _a;
|
|
124
|
-
const response = await this.asyncCall("writeFileFromBytesByMap", { filePath, bytesBase64, append }, timeout);
|
|
125
|
-
if (!response.isSuccess()) {
|
|
126
|
-
throw new Error(((_a = response.data) === null || _a === void 0 ? void 0 : _a.message) || "Write file from bytes by map failed");
|
|
127
|
-
}
|
|
128
|
-
return response.data;
|
|
129
|
-
}
|
|
130
|
-
/**
|
|
131
|
-
* 从字符串写入文件
|
|
132
|
-
* @param filePath 文件路径
|
|
133
|
-
* @param content 文件内容
|
|
134
|
-
* @param append 是否追加,默认为 false
|
|
135
|
-
* @param threadSafe 是否线程安全写入,默认为 false
|
|
136
|
-
* @param timeout 超时时间(秒),默认30秒
|
|
137
|
-
* @returns Promise<是否成功>
|
|
138
|
-
*/
|
|
139
|
-
async writeFileFromString(filePath, content, append = false, threadSafe = false, timeout) {
|
|
140
|
-
var _a;
|
|
141
|
-
const response = await this.asyncCall("writeFileFromString", { filePath, content, append, threadSafe }, timeout);
|
|
142
|
-
if (!response.isSuccess()) {
|
|
143
|
-
throw new Error(((_a = response.data) === null || _a === void 0 ? void 0 : _a.message) || "Write file from string failed");
|
|
144
|
-
}
|
|
145
|
-
return response.data;
|
|
146
|
-
}
|
|
147
|
-
/**
|
|
148
|
-
* 读取文件为字符串列表
|
|
149
|
-
* @param filePath 文件路径
|
|
150
|
-
* @param charsetName 字符集名称,默认为 "UTF-8"
|
|
151
|
-
* @param timeout 超时时间(秒),默认30秒
|
|
152
|
-
* @returns Promise<字符串数组>
|
|
153
|
-
*/
|
|
154
|
-
async readFile2List(filePath, charsetName = "UTF-8", timeout) {
|
|
155
|
-
var _a;
|
|
156
|
-
const response = await this.asyncCall("readFile2List", { filePath, charsetName }, timeout);
|
|
157
|
-
if (!response.isSuccess()) {
|
|
158
|
-
throw new Error(((_a = response.data) === null || _a === void 0 ? void 0 : _a.message) || "Read file to list failed");
|
|
159
|
-
}
|
|
160
|
-
return response.data;
|
|
161
|
-
}
|
|
162
|
-
/**
|
|
163
|
-
* 读取文件为字符串
|
|
164
|
-
* @param filePath 文件路径
|
|
165
|
-
* @param charsetName 字符集名称,默认为 "UTF-8"
|
|
166
|
-
* @param timeout 超时时间(秒),默认30秒
|
|
167
|
-
* @returns Promise<文件内容字符串>
|
|
168
|
-
*/
|
|
169
|
-
async readFile2String(filePath, charsetName = "UTF-8", timeout) {
|
|
170
|
-
var _a;
|
|
171
|
-
const response = await this.asyncCall("readFile2String", { filePath, charsetName }, timeout);
|
|
172
|
-
if (!response.isSuccess()) {
|
|
173
|
-
throw new Error(((_a = response.data) === null || _a === void 0 ? void 0 : _a.message) || "Read file to string failed");
|
|
174
|
-
}
|
|
175
|
-
return response.data;
|
|
176
|
-
}
|
|
177
|
-
/**
|
|
178
|
-
* 读取文件为字节数组(使用流)
|
|
179
|
-
* @param filePath 文件路径
|
|
180
|
-
* @param timeout 超时时间(秒),默认30秒
|
|
181
|
-
* @returns Promise<Base64 编码的字节数组>
|
|
182
|
-
*/
|
|
183
|
-
async readFile2BytesByStream(filePath, timeout) {
|
|
184
|
-
var _a;
|
|
185
|
-
const response = await this.asyncCall("readFile2BytesByStream", { filePath }, timeout);
|
|
186
|
-
if (!response.isSuccess()) {
|
|
187
|
-
throw new Error(((_a = response.data) === null || _a === void 0 ? void 0 : _a.message) || "Read file to bytes by stream failed");
|
|
188
|
-
}
|
|
189
|
-
return response.data;
|
|
190
|
-
}
|
|
191
|
-
/**
|
|
192
|
-
* 读取文件为字节数组(使用通道)
|
|
193
|
-
* @param filePath 文件路径
|
|
194
|
-
* @param timeout 超时时间(秒),默认30秒
|
|
195
|
-
* @returns Promise<Base64 编码的字节数组>
|
|
196
|
-
*/
|
|
197
|
-
async readFile2BytesByChannel(filePath, timeout) {
|
|
198
|
-
var _a;
|
|
199
|
-
const response = await this.asyncCall("readFile2BytesByChannel", { filePath }, timeout);
|
|
200
|
-
if (!response.isSuccess()) {
|
|
201
|
-
throw new Error(((_a = response.data) === null || _a === void 0 ? void 0 : _a.message) || "Read file to bytes by channel failed");
|
|
202
|
-
}
|
|
203
|
-
return response.data;
|
|
204
|
-
}
|
|
205
|
-
/**
|
|
206
|
-
* 读取文件为字节数组(使用内存映射)
|
|
207
|
-
* @param filePath 文件路径
|
|
208
|
-
* @param timeout 超时时间(秒),默认30秒
|
|
209
|
-
* @returns Promise<Base64 编码的字节数组>
|
|
210
|
-
*/
|
|
211
|
-
async readFile2BytesByMap(filePath, timeout) {
|
|
212
|
-
var _a;
|
|
213
|
-
const response = await this.asyncCall("readFile2BytesByMap", { filePath }, timeout);
|
|
214
|
-
if (!response.isSuccess()) {
|
|
215
|
-
throw new Error(((_a = response.data) === null || _a === void 0 ? void 0 : _a.message) || "Read file to bytes by map failed");
|
|
216
|
-
}
|
|
217
|
-
return response.data;
|
|
218
|
-
}
|
|
219
|
-
/**
|
|
220
|
-
* 设置缓冲区大小
|
|
221
|
-
* @param bufferSize 缓冲区大小(字节)
|
|
222
|
-
* @param timeout 超时时间(秒),默认30秒
|
|
223
|
-
* @returns Promise<是否成功>
|
|
224
|
-
*/
|
|
225
|
-
async setBufferSize(bufferSize, timeout) {
|
|
226
|
-
var _a;
|
|
227
|
-
const response = await this.asyncCall("setBufferSize", { bufferSize }, timeout);
|
|
228
|
-
if (!response.isSuccess()) {
|
|
229
|
-
throw new Error(((_a = response.data) === null || _a === void 0 ? void 0 : _a.message) || "Set buffer size failed");
|
|
230
|
-
}
|
|
231
|
-
return response.data;
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
// 导出常量实例
|
|
235
|
-
export const fileIO = new FileIO();
|
|
@@ -1,242 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 文件信息接口定义
|
|
3
|
-
*/
|
|
4
|
-
export interface FileInfo {
|
|
5
|
-
path: string;
|
|
6
|
-
exists: boolean;
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* 文件列表项接口定义
|
|
10
|
-
*/
|
|
11
|
-
export interface FileListItem {
|
|
12
|
-
path: string;
|
|
13
|
-
name: string;
|
|
14
|
-
isDirectory: boolean;
|
|
15
|
-
length: number;
|
|
16
|
-
}
|
|
17
|
-
export declare class FileUtils {
|
|
18
|
-
/**
|
|
19
|
-
* 执行异步调用
|
|
20
|
-
* @param method 方法名
|
|
21
|
-
* @param args 参数对象
|
|
22
|
-
* @param timeout 超时时间(秒),默认30秒
|
|
23
|
-
* @returns Promise<调用响应>
|
|
24
|
-
*/
|
|
25
|
-
private asyncCall;
|
|
26
|
-
/**
|
|
27
|
-
* 根据路径获取文件
|
|
28
|
-
* @param filePath 文件路径
|
|
29
|
-
* @param timeout 超时时间(秒),默认30秒
|
|
30
|
-
* @returns Promise<文件信息>
|
|
31
|
-
*/
|
|
32
|
-
getFileByPath(filePath: string, timeout?: number): Promise<FileInfo>;
|
|
33
|
-
/**
|
|
34
|
-
* 检查文件是否存在
|
|
35
|
-
* @param filePath 文件路径
|
|
36
|
-
* @param timeout 超时时间(秒),默认30秒
|
|
37
|
-
* @returns Promise<是否存在>
|
|
38
|
-
*/
|
|
39
|
-
isFileExists(filePath: string, timeout?: number): Promise<boolean>;
|
|
40
|
-
/**
|
|
41
|
-
* 重命名文件
|
|
42
|
-
* @param filePath 文件路径
|
|
43
|
-
* @param newName 新名称
|
|
44
|
-
* @param timeout 超时时间(秒),默认30秒
|
|
45
|
-
* @returns Promise<是否成功>
|
|
46
|
-
*/
|
|
47
|
-
rename(filePath: string, newName: string, timeout?: number): Promise<boolean>;
|
|
48
|
-
/**
|
|
49
|
-
* 检查是否为目录
|
|
50
|
-
* @param filePath 文件路径
|
|
51
|
-
* @param timeout 超时时间(秒),默认30秒
|
|
52
|
-
* @returns Promise<是否为目录>
|
|
53
|
-
*/
|
|
54
|
-
isDir(filePath: string, timeout?: number): Promise<boolean>;
|
|
55
|
-
/**
|
|
56
|
-
* 检查是否为文件
|
|
57
|
-
* @param filePath 文件路径
|
|
58
|
-
* @param timeout 超时时间(秒),默认30秒
|
|
59
|
-
* @returns Promise<是否为文件>
|
|
60
|
-
*/
|
|
61
|
-
isFile(filePath: string, timeout?: number): Promise<boolean>;
|
|
62
|
-
/**
|
|
63
|
-
* 创建或存在目录
|
|
64
|
-
* @param dirPath 目录路径
|
|
65
|
-
* @param timeout 超时时间(秒),默认30秒
|
|
66
|
-
* @returns Promise<是否成功>
|
|
67
|
-
*/
|
|
68
|
-
createOrExistsDir(dirPath: string, timeout?: number): Promise<boolean>;
|
|
69
|
-
/**
|
|
70
|
-
* 创建或存在文件
|
|
71
|
-
* @param filePath 文件路径
|
|
72
|
-
* @param timeout 超时时间(秒),默认30秒
|
|
73
|
-
* @returns Promise<是否成功>
|
|
74
|
-
*/
|
|
75
|
-
createOrExistsFile(filePath: string, timeout?: number): Promise<boolean>;
|
|
76
|
-
/**
|
|
77
|
-
* 创建文件(如果存在则删除旧文件)
|
|
78
|
-
* @param filePath 文件路径
|
|
79
|
-
* @param timeout 超时时间(秒),默认30秒
|
|
80
|
-
* @returns Promise<是否成功>
|
|
81
|
-
*/
|
|
82
|
-
createFileByDeleteOldFile(filePath: string, timeout?: number): Promise<boolean>;
|
|
83
|
-
/**
|
|
84
|
-
* 复制文件
|
|
85
|
-
* @param srcFilePath 源文件路径
|
|
86
|
-
* @param destFilePath 目标文件路径
|
|
87
|
-
* @param timeout 超时时间(秒),默认30秒
|
|
88
|
-
* @returns Promise<是否成功>
|
|
89
|
-
*/
|
|
90
|
-
copy(srcFilePath: string, destFilePath: string, timeout?: number): Promise<boolean>;
|
|
91
|
-
/**
|
|
92
|
-
* 移动文件
|
|
93
|
-
* @param srcFilePath 源文件路径
|
|
94
|
-
* @param destFilePath 目标文件路径
|
|
95
|
-
* @param timeout 超时时间(秒),默认30秒
|
|
96
|
-
* @returns Promise<是否成功>
|
|
97
|
-
*/
|
|
98
|
-
move(srcFilePath: string, destFilePath: string, timeout?: number): Promise<boolean>;
|
|
99
|
-
/**
|
|
100
|
-
* 删除文件或目录
|
|
101
|
-
* @param filePath 文件路径
|
|
102
|
-
* @param timeout 超时时间(秒),默认30秒
|
|
103
|
-
* @returns Promise<是否成功>
|
|
104
|
-
*/
|
|
105
|
-
delete(filePath: string, timeout?: number): Promise<boolean>;
|
|
106
|
-
/**
|
|
107
|
-
* 删除目录中的所有内容
|
|
108
|
-
* @param dirPath 目录路径
|
|
109
|
-
* @param timeout 超时时间(秒),默认30秒
|
|
110
|
-
* @returns Promise<是否成功>
|
|
111
|
-
*/
|
|
112
|
-
deleteAllInDir(dirPath: string, timeout?: number): Promise<boolean>;
|
|
113
|
-
/**
|
|
114
|
-
* 删除目录中的所有文件
|
|
115
|
-
* @param dirPath 目录路径
|
|
116
|
-
* @param timeout 超时时间(秒),默认30秒
|
|
117
|
-
* @returns Promise<是否成功>
|
|
118
|
-
*/
|
|
119
|
-
deleteFilesInDir(dirPath: string, timeout?: number): Promise<boolean>;
|
|
120
|
-
/**
|
|
121
|
-
* 删除目录中匹配过滤器的文件
|
|
122
|
-
* @param dirPath 目录路径
|
|
123
|
-
* @param filterPattern 过滤模式(正则表达式)
|
|
124
|
-
* @param timeout 超时时间(秒),默认30秒
|
|
125
|
-
* @returns Promise<是否成功>
|
|
126
|
-
*/
|
|
127
|
-
deleteFilesInDirWithFilter(dirPath: string, filterPattern?: string, timeout?: number): Promise<boolean>;
|
|
128
|
-
/**
|
|
129
|
-
* 列出目录中的文件
|
|
130
|
-
* @param dirPath 目录路径
|
|
131
|
-
* @param timeout 超时时间(秒),默认30秒
|
|
132
|
-
* @returns Promise<文件列表>
|
|
133
|
-
*/
|
|
134
|
-
listFilesInDir(dirPath: string, timeout?: number): Promise<FileListItem[]>;
|
|
135
|
-
/**
|
|
136
|
-
* 列出目录中匹配过滤器的文件
|
|
137
|
-
* @param dirPath 目录路径
|
|
138
|
-
* @param filterPattern 过滤模式(正则表达式)
|
|
139
|
-
* @param timeout 超时时间(秒),默认30秒
|
|
140
|
-
* @returns Promise<文件列表>
|
|
141
|
-
*/
|
|
142
|
-
listFilesInDirWithFilter(dirPath: string, filterPattern?: string, timeout?: number): Promise<FileListItem[]>;
|
|
143
|
-
/**
|
|
144
|
-
* 获取文件最后修改时间
|
|
145
|
-
* @param filePath 文件路径
|
|
146
|
-
* @param timeout 超时时间(秒),默认30秒
|
|
147
|
-
* @returns Promise<时间戳(毫秒)>
|
|
148
|
-
*/
|
|
149
|
-
getFileLastModified(filePath: string, timeout?: number): Promise<number>;
|
|
150
|
-
/**
|
|
151
|
-
* 获取文件字符集(简单检测)
|
|
152
|
-
* @param filePath 文件路径
|
|
153
|
-
* @param timeout 超时时间(秒),默认30秒
|
|
154
|
-
* @returns Promise<字符集名称>
|
|
155
|
-
*/
|
|
156
|
-
getFileCharsetSimple(filePath: string, timeout?: number): Promise<string>;
|
|
157
|
-
/**
|
|
158
|
-
* 获取文件行数
|
|
159
|
-
* @param filePath 文件路径
|
|
160
|
-
* @param timeout 超时时间(秒),默认30秒
|
|
161
|
-
* @returns Promise<行数>
|
|
162
|
-
*/
|
|
163
|
-
getFileLines(filePath: string, timeout?: number): Promise<number>;
|
|
164
|
-
/**
|
|
165
|
-
* 获取文件或目录大小
|
|
166
|
-
* @param filePath 文件路径
|
|
167
|
-
* @param timeout 超时时间(秒),默认30秒
|
|
168
|
-
* @returns Promise<大小(字节)>
|
|
169
|
-
*/
|
|
170
|
-
getSize(filePath: string, timeout?: number): Promise<number>;
|
|
171
|
-
/**
|
|
172
|
-
* 获取文件长度
|
|
173
|
-
* @param filePath 文件路径
|
|
174
|
-
* @param timeout 超时时间(秒),默认30秒
|
|
175
|
-
* @returns Promise<长度(字节)>
|
|
176
|
-
*/
|
|
177
|
-
getLength(filePath: string, timeout?: number): Promise<number>;
|
|
178
|
-
/**
|
|
179
|
-
* 获取文件 MD5(Base64 编码)
|
|
180
|
-
* @param filePath 文件路径
|
|
181
|
-
* @param timeout 超时时间(秒),默认30秒
|
|
182
|
-
* @returns Promise<Base64 编码的 MD5>
|
|
183
|
-
*/
|
|
184
|
-
getFileMD5(filePath: string, timeout?: number): Promise<string>;
|
|
185
|
-
/**
|
|
186
|
-
* 获取文件 MD5(字符串)
|
|
187
|
-
* @param filePath 文件路径
|
|
188
|
-
* @param timeout 超时时间(秒),默认30秒
|
|
189
|
-
* @returns Promise<MD5 字符串>
|
|
190
|
-
*/
|
|
191
|
-
getFileMD5ToString(filePath: string, timeout?: number): Promise<string>;
|
|
192
|
-
/**
|
|
193
|
-
* 获取目录名
|
|
194
|
-
* @param filePath 文件路径
|
|
195
|
-
* @param timeout 超时时间(秒),默认30秒
|
|
196
|
-
* @returns Promise<目录名>
|
|
197
|
-
*/
|
|
198
|
-
getDirName(filePath: string, timeout?: number): Promise<string>;
|
|
199
|
-
/**
|
|
200
|
-
* 获取文件名
|
|
201
|
-
* @param filePath 文件路径
|
|
202
|
-
* @param timeout 超时时间(秒),默认30秒
|
|
203
|
-
* @returns Promise<文件名>
|
|
204
|
-
*/
|
|
205
|
-
getFileName(filePath: string, timeout?: number): Promise<string>;
|
|
206
|
-
/**
|
|
207
|
-
* 获取文件名(不含扩展名)
|
|
208
|
-
* @param filePath 文件路径
|
|
209
|
-
* @param timeout 超时时间(秒),默认30秒
|
|
210
|
-
* @returns Promise<文件名(不含扩展名)>
|
|
211
|
-
*/
|
|
212
|
-
getFileNameNoExtension(filePath: string, timeout?: number): Promise<string>;
|
|
213
|
-
/**
|
|
214
|
-
* 获取文件扩展名
|
|
215
|
-
* @param filePath 文件路径
|
|
216
|
-
* @param timeout 超时时间(秒),默认30秒
|
|
217
|
-
* @returns Promise<扩展名>
|
|
218
|
-
*/
|
|
219
|
-
getFileExtension(filePath: string, timeout?: number): Promise<string>;
|
|
220
|
-
/**
|
|
221
|
-
* 通知系统扫描文件
|
|
222
|
-
* @param filePath 文件路径
|
|
223
|
-
* @param timeout 超时时间(秒),默认30秒
|
|
224
|
-
* @returns Promise<是否成功>
|
|
225
|
-
*/
|
|
226
|
-
notifySystemToScan(filePath: string, timeout?: number): Promise<boolean>;
|
|
227
|
-
/**
|
|
228
|
-
* 获取文件系统总大小
|
|
229
|
-
* @param filePath 文件路径
|
|
230
|
-
* @param timeout 超时时间(秒),默认30秒
|
|
231
|
-
* @returns Promise<总大小(字节)>
|
|
232
|
-
*/
|
|
233
|
-
getFsTotalSize(filePath: string, timeout?: number): Promise<number>;
|
|
234
|
-
/**
|
|
235
|
-
* 获取文件系统可用大小
|
|
236
|
-
* @param filePath 文件路径
|
|
237
|
-
* @param timeout 超时时间(秒),默认30秒
|
|
238
|
-
* @returns Promise<可用大小(字节)>
|
|
239
|
-
*/
|
|
240
|
-
getFsAvailableSize(filePath: string, timeout?: number): Promise<number>;
|
|
241
|
-
}
|
|
242
|
-
export declare const fileUtils: FileUtils;
|