@tarojs/taro 3.3.13 → 3.3.14
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/package.json +5 -5
- package/types/api/ad/index.d.ts +34 -28
- package/types/api/alipay/index.d.ts +11 -7
- package/types/api/base/debug.d.ts +60 -54
- package/types/api/base/env.d.ts +12 -8
- package/types/api/base/index.d.ts +87 -83
- package/types/api/base/system.d.ts +59 -54
- package/types/api/base/update.d.ts +37 -33
- package/types/api/base/weapp/app-event.d.ts +147 -131
- package/types/api/base/weapp/life-cycle.d.ts +14 -10
- package/types/api/canvas/index.d.ts +115 -110
- package/types/api/cloud/index.d.ts +99 -94
- package/types/api/data-analysis/index.d.ts +68 -64
- package/types/api/device/accelerometer.d.ts +57 -50
- package/types/api/device/battery.d.ts +19 -15
- package/types/api/device/ble.d.ts +241 -228
- package/types/api/device/bluetooth.d.ts +207 -194
- package/types/api/device/clipboard.d.ts +48 -43
- package/types/api/device/compass.d.ts +55 -48
- package/types/api/device/contact.d.ts +13 -9
- package/types/api/device/gyroscope.d.ts +41 -35
- package/types/api/device/iBeacon.d.ts +79 -73
- package/types/api/device/motion.d.ts +42 -37
- package/types/api/device/network.d.ts +48 -42
- package/types/api/device/nfc.d.ts +105 -96
- package/types/api/device/performance.d.ts +22 -18
- package/types/api/device/phone.d.ts +20 -15
- package/types/api/device/scan.d.ts +31 -26
- package/types/api/device/screen.d.ts +74 -67
- package/types/api/device/vibrate.d.ts +31 -25
- package/types/api/device/wifi.d.ts +151 -140
- package/types/api/ext/index.d.ts +44 -39
- package/types/api/files/index.d.ts +219 -209
- package/types/api/framework/index.d.ts +25 -20
- package/types/api/location/index.d.ts +140 -136
- package/types/api/media/audio.d.ts +135 -127
- package/types/api/media/background-audio.d.ts +135 -126
- package/types/api/media/camera.d.ts +30 -26
- package/types/api/media/editor.d.ts +35 -33
- package/types/api/media/image.d.ts +161 -150
- package/types/api/media/live.d.ts +88 -82
- package/types/api/media/map.d.ts +47 -43
- package/types/api/media/recorder.d.ts +90 -84
- package/types/api/media/video-processing.d.ts +10 -6
- package/types/api/media/video.d.ts +63 -58
- package/types/api/network/download.d.ts +34 -30
- package/types/api/network/mdns.d.ts +104 -91
- package/types/api/network/request.d.ts +83 -79
- package/types/api/network/udp.d.ts +20 -16
- package/types/api/network/upload.d.ts +60 -56
- package/types/api/network/websocket.d.ts +201 -194
- package/types/api/open-api/account.d.ts +18 -14
- package/types/api/open-api/address.d.ts +27 -23
- package/types/api/open-api/authorize.d.ts +30 -26
- package/types/api/open-api/card.d.ts +55 -51
- package/types/api/open-api/customer-service.d.ts +21 -17
- package/types/api/open-api/facial.d.ts +28 -24
- package/types/api/open-api/invoice.d.ts +38 -34
- package/types/api/open-api/login.d.ts +56 -52
- package/types/api/open-api/navigate.d.ts +79 -75
- package/types/api/open-api/payment.d.ts +34 -30
- package/types/api/open-api/settings.d.ts +49 -45
- package/types/api/open-api/soter.d.ts +92 -86
- package/types/api/open-api/subscribe-message.d.ts +24 -20
- package/types/api/open-api/user-info.d.ts +60 -57
- package/types/api/open-api/werun.d.ts +50 -46
- package/types/api/route/index.d.ts +122 -118
- package/types/api/share/index.d.ts +68 -64
- package/types/api/storage/background-fetch.d.ts +40 -35
- package/types/api/storage/index.d.ts +267 -262
- package/types/api/swan/index.d.ts +47 -42
- package/types/api/ui/animation.d.ts +21 -17
- package/types/api/ui/background.d.ts +38 -34
- package/types/api/ui/custom-component.d.ts +22 -18
- package/types/api/ui/fonts.d.ts +26 -21
- package/types/api/ui/interaction.d.ts +153 -149
- package/types/api/ui/keyboard.d.ts +59 -55
- package/types/api/ui/menu.d.ts +10 -6
- package/types/api/ui/navigation-bar.d.ts +67 -63
- package/types/api/ui/pull-down-refresh.d.ts +33 -29
- package/types/api/ui/scroll.d.ts +30 -26
- package/types/api/ui/sticky.d.ts +22 -19
- package/types/api/ui/tab-bar.d.ts +101 -97
- package/types/api/ui/window.d.ts +24 -18
- package/types/api/worker/index.d.ts +28 -24
- package/types/api/wxml/index.d.ts +42 -38
- package/types/global.d.ts +350 -0
- package/types/index.d.ts +12 -98
- package/types/taro.api.d.ts +94 -0
- package/types/taro.component.d.ts +10 -57
- package/types/taro.config.d.ts +24 -6
- package/types/taro.extend.d.ts +70 -67
- package/types/taro.hooks.d.ts +68 -67
- package/types/taro.lifecycle.d.ts +47 -28
- package/types/api/ad/index.ts +0 -6
- package/types/api/alipay/index.ts +0 -7
- package/types/api/index.d.ts +0 -352
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
import Taro from '../../index'
|
|
2
|
+
|
|
3
|
+
declare module '../../index' {
|
|
2
4
|
namespace saveFile {
|
|
3
5
|
interface Option {
|
|
4
6
|
/** 临时存储文件路径 */
|
|
5
7
|
tempFilePath: string
|
|
6
8
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
7
|
-
complete?: (res:
|
|
9
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
8
10
|
/** 接口调用失败的回调函数 */
|
|
9
11
|
fail?: (result: FailCallbackResult) => void
|
|
10
12
|
/** 要存储的文件路径 */
|
|
@@ -12,7 +14,7 @@ declare namespace Taro {
|
|
|
12
14
|
/** 接口调用成功的回调函数 */
|
|
13
15
|
success?: (result: SuccessCallbackResult) => void
|
|
14
16
|
}
|
|
15
|
-
interface FailCallbackResult extends
|
|
17
|
+
interface FailCallbackResult extends TaroGeneral.CallbackResult {
|
|
16
18
|
/** 错误信息
|
|
17
19
|
*
|
|
18
20
|
* 可选值:
|
|
@@ -22,45 +24,26 @@ declare namespace Taro {
|
|
|
22
24
|
* - 'fail the maximum size of the file storage limit is exceeded': 存储空间不足; */
|
|
23
25
|
errMsg: string
|
|
24
26
|
}
|
|
25
|
-
interface SuccessCallbackResult extends
|
|
27
|
+
interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
|
|
26
28
|
/** 存储后的文件路径 */
|
|
27
29
|
savedFilePath: string
|
|
28
30
|
/** 调用结果 */
|
|
29
31
|
errMsg: string
|
|
30
32
|
}
|
|
31
33
|
}
|
|
32
|
-
/** 保存文件到本地。**注意:saveFile 会把临时文件移动,因此调用成功后传入的 tempFilePath 将不可用**
|
|
33
|
-
* @supported weapp
|
|
34
|
-
* @example
|
|
35
|
-
* ```tsx
|
|
36
|
-
* Taro.chooseImage({
|
|
37
|
-
* success: function (res) {
|
|
38
|
-
* var tempFilePaths = res.tempFilePaths
|
|
39
|
-
* Taro.saveFile({
|
|
40
|
-
* tempFilePath: tempFilePaths[0],
|
|
41
|
-
* success: function (res) {
|
|
42
|
-
* var savedFilePath = res.savedFilePath
|
|
43
|
-
* }
|
|
44
|
-
* })
|
|
45
|
-
* }
|
|
46
|
-
* })
|
|
47
|
-
* ```
|
|
48
|
-
* @see https://developers.weixin.qq.com/miniprogram/dev/api/file/wx.saveFile.html
|
|
49
|
-
*/
|
|
50
|
-
function saveFile(option: saveFile.Option): Promise<saveFile.SuccessCallbackResult | saveFile.FailCallbackResult>
|
|
51
34
|
|
|
52
35
|
namespace removeSavedFile {
|
|
53
36
|
interface Option {
|
|
54
37
|
/** 需要删除的文件路径 */
|
|
55
38
|
filePath: string
|
|
56
39
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
57
|
-
complete?: (res:
|
|
40
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
58
41
|
/** 接口调用失败的回调函数 */
|
|
59
|
-
fail?: (res:
|
|
42
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
60
43
|
/** 接口调用成功的回调函数 */
|
|
61
|
-
success?: (res:
|
|
44
|
+
success?: (res: TaroGeneral.CallbackResult) => void
|
|
62
45
|
}
|
|
63
|
-
interface RemoveSavedFileFailCallbackResult extends
|
|
46
|
+
interface RemoveSavedFileFailCallbackResult extends TaroGeneral.CallbackResult {
|
|
64
47
|
/** 错误信息
|
|
65
48
|
*
|
|
66
49
|
* 可选值:
|
|
@@ -68,26 +51,6 @@ declare namespace Taro {
|
|
|
68
51
|
errMsg: string
|
|
69
52
|
}
|
|
70
53
|
}
|
|
71
|
-
/** 删除该小程序下已保存的本地缓存文件
|
|
72
|
-
* @supported weapp
|
|
73
|
-
* @example
|
|
74
|
-
* ```tsx
|
|
75
|
-
* Taro.getSavedFileList({
|
|
76
|
-
* success: function (res) {
|
|
77
|
-
* if (res.fileList.length > 0){
|
|
78
|
-
* Taro.removeSavedFile({
|
|
79
|
-
* filePath: res.fileList[0].filePath,
|
|
80
|
-
* complete: function (res) {
|
|
81
|
-
* console.log(res)
|
|
82
|
-
* }
|
|
83
|
-
* })
|
|
84
|
-
* }
|
|
85
|
-
* }
|
|
86
|
-
* })
|
|
87
|
-
* ```
|
|
88
|
-
* @see https://developers.weixin.qq.com/miniprogram/dev/api/file/wx.removeSavedFile.html
|
|
89
|
-
*/
|
|
90
|
-
function removeSavedFile(option: removeSavedFile.Option): Promise<General.CallbackResult>
|
|
91
54
|
|
|
92
55
|
namespace openDocument {
|
|
93
56
|
interface Option {
|
|
@@ -96,13 +59,13 @@ declare namespace Taro {
|
|
|
96
59
|
/** 是否显示右上角菜单 */
|
|
97
60
|
showMenu?: boolean
|
|
98
61
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
99
|
-
complete?: (res:
|
|
62
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
100
63
|
/** 接口调用失败的回调函数 */
|
|
101
|
-
fail?: (res:
|
|
64
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
102
65
|
/** 文件类型,指定文件类型打开文件 */
|
|
103
66
|
fileType?: keyof fileType
|
|
104
67
|
/** 接口调用成功的回调函数 */
|
|
105
|
-
success?: (res:
|
|
68
|
+
success?: (res: TaroGeneral.CallbackResult) => void
|
|
106
69
|
}
|
|
107
70
|
/** 文件类型 */
|
|
108
71
|
interface fileType {
|
|
@@ -122,37 +85,17 @@ declare namespace Taro {
|
|
|
122
85
|
pdf
|
|
123
86
|
}
|
|
124
87
|
}
|
|
125
|
-
/** 新开页面打开文档,支持格式
|
|
126
|
-
* @supported weapp
|
|
127
|
-
* @example
|
|
128
|
-
```tsx
|
|
129
|
-
* Taro.downloadFile({
|
|
130
|
-
* url: 'http://example.com/somefile.pdf',
|
|
131
|
-
* success: function (res) {
|
|
132
|
-
* var filePath = res.tempFilePath
|
|
133
|
-
* Taro.openDocument({
|
|
134
|
-
* filePath: filePath,
|
|
135
|
-
* success: function (res) {
|
|
136
|
-
* console.log('打开文档成功')
|
|
137
|
-
* }
|
|
138
|
-
* })
|
|
139
|
-
* }
|
|
140
|
-
* })
|
|
141
|
-
* ```
|
|
142
|
-
* @see https://developers.weixin.qq.com/miniprogram/dev/api/file/wx.openDocument.html
|
|
143
|
-
*/
|
|
144
|
-
function openDocument(option: openDocument.Option): Promise<General.CallbackResult>
|
|
145
88
|
|
|
146
89
|
namespace getSavedFileList {
|
|
147
90
|
interface Option {
|
|
148
91
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
149
|
-
complete?: (res:
|
|
92
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
150
93
|
/** 接口调用失败的回调函数 */
|
|
151
|
-
fail?: (res:
|
|
94
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
152
95
|
/** 接口调用成功的回调函数 */
|
|
153
96
|
success?: (result: SuccessCallbackResult) => void
|
|
154
97
|
}
|
|
155
|
-
interface SuccessCallbackResult extends
|
|
98
|
+
interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
|
|
156
99
|
/** 文件数组 */
|
|
157
100
|
fileList: FileItem[]
|
|
158
101
|
/** 调用结果 */
|
|
@@ -168,32 +111,19 @@ declare namespace Taro {
|
|
|
168
111
|
size: number
|
|
169
112
|
}
|
|
170
113
|
}
|
|
171
|
-
/** 获取本地已保存的文件列表
|
|
172
|
-
* @supported weapp
|
|
173
|
-
* @example
|
|
174
|
-
* ```tsx
|
|
175
|
-
* Taro.getSavedFileList({
|
|
176
|
-
* success: function (res) {
|
|
177
|
-
* console.log(res.fileList)
|
|
178
|
-
* }
|
|
179
|
-
* })
|
|
180
|
-
* ```
|
|
181
|
-
* @see https://developers.weixin.qq.com/miniprogram/dev/api/file/wx.getSavedFileList.html
|
|
182
|
-
*/
|
|
183
|
-
function getSavedFileList(option?: getSavedFileList.Option): Promise<getSavedFileList.SuccessCallbackResult>
|
|
184
114
|
|
|
185
115
|
namespace getSavedFileInfo {
|
|
186
116
|
interface Option {
|
|
187
117
|
/** 文件路径 */
|
|
188
118
|
filePath: string
|
|
189
119
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
190
|
-
complete?: (res:
|
|
120
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
191
121
|
/** 接口调用失败的回调函数 */
|
|
192
|
-
fail?: (res:
|
|
122
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
193
123
|
/** 接口调用成功的回调函数 */
|
|
194
124
|
success?: (result: SuccessCallbackResult) => void
|
|
195
125
|
}
|
|
196
|
-
interface SuccessCallbackResult extends
|
|
126
|
+
interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
|
|
197
127
|
/** 文件保存时的时间戳,从1970/01/01 08:00:00 到该时刻的秒数 */
|
|
198
128
|
createTime: number
|
|
199
129
|
/** 文件大小,单位 B */
|
|
@@ -202,21 +132,6 @@ declare namespace Taro {
|
|
|
202
132
|
errMsg: string
|
|
203
133
|
}
|
|
204
134
|
}
|
|
205
|
-
/** 获取本地文件的文件信息。此接口只能用于获取已保存到本地的文件,若需要获取临时文件信息,请使用 [Taro.getFileInfo](https://developers.weixin.qq.com/miniprogram/dev/api/file/wx.getFileInfo.html) 接口。
|
|
206
|
-
* @supported weapp
|
|
207
|
-
* @example
|
|
208
|
-
* ```tsx
|
|
209
|
-
* Taro.getSavedFileInfo({
|
|
210
|
-
* filePath: 'wxfile://somefile', //仅做示例用,非真正的文件路径
|
|
211
|
-
* success: function (res) {
|
|
212
|
-
* console.log(res.size)
|
|
213
|
-
* console.log(res.createTime)
|
|
214
|
-
* }
|
|
215
|
-
* })
|
|
216
|
-
* ```
|
|
217
|
-
* @see https://developers.weixin.qq.com/miniprogram/dev/api/file/wx.getSavedFileInfo.html
|
|
218
|
-
*/
|
|
219
|
-
function getSavedFileInfo(option: getSavedFileInfo.Option): Promise<getSavedFileInfo.SuccessCallbackResult>
|
|
220
135
|
|
|
221
136
|
namespace getFileInfo {
|
|
222
137
|
interface Option {
|
|
@@ -228,20 +143,20 @@ declare namespace Taro {
|
|
|
228
143
|
*/
|
|
229
144
|
digestAlgorithm?: 'md5' | 'sha1'
|
|
230
145
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
231
|
-
complete?: (res:
|
|
146
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
232
147
|
/** 接口调用失败的回调函数 */
|
|
233
148
|
fail?: (result: FailCallbackResult) => void
|
|
234
149
|
/** 接口调用成功的回调函数 */
|
|
235
150
|
success?: (result: SuccessCallbackResult) => void
|
|
236
151
|
}
|
|
237
|
-
interface FailCallbackResult extends
|
|
152
|
+
interface FailCallbackResult extends TaroGeneral.CallbackResult {
|
|
238
153
|
/** 错误信息
|
|
239
154
|
*
|
|
240
155
|
* 可选值:
|
|
241
156
|
* - 'fail file not exist': 指定的 filePath 找不到文件; */
|
|
242
157
|
errMsg: string
|
|
243
158
|
}
|
|
244
|
-
interface SuccessCallbackResult extends
|
|
159
|
+
interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
|
|
245
160
|
/** 文件大小,以字节为单位 */
|
|
246
161
|
size: number
|
|
247
162
|
/** 按照传入的 digestAlgorithm 计算得出的的文件摘要 */
|
|
@@ -250,27 +165,6 @@ declare namespace Taro {
|
|
|
250
165
|
errMsg: string
|
|
251
166
|
}
|
|
252
167
|
}
|
|
253
|
-
/**
|
|
254
|
-
* 获取该小程序下的 本地临时文件 或 本地缓存文件 信息
|
|
255
|
-
* @supported weapp
|
|
256
|
-
* @example
|
|
257
|
-
* ```tsx
|
|
258
|
-
* Taro.getFileInfo({
|
|
259
|
-
* success: function (res) {
|
|
260
|
-
* console.log(res.size)
|
|
261
|
-
* console.log(res.digest)
|
|
262
|
-
* }
|
|
263
|
-
* })
|
|
264
|
-
* ```
|
|
265
|
-
* @see https://developers.weixin.qq.com/miniprogram/dev/api/file/wx.getFileInfo.html
|
|
266
|
-
*/
|
|
267
|
-
function getFileInfo(option: getFileInfo.Option): Promise<getFileInfo.SuccessCallbackResult | getFileInfo.FailCallbackResult>
|
|
268
|
-
|
|
269
|
-
/** 获取全局唯一的文件管理器
|
|
270
|
-
* @supported weapp
|
|
271
|
-
* @see https://developers.weixin.qq.com/miniprogram/dev/api/file/wx.getFileSystemManager.html
|
|
272
|
-
*/
|
|
273
|
-
function getFileSystemManager(): FileSystemManager
|
|
274
168
|
|
|
275
169
|
/** 文件管理器 */
|
|
276
170
|
interface FileSystemManager {
|
|
@@ -451,7 +345,7 @@ declare namespace Taro {
|
|
|
451
345
|
path: string,
|
|
452
346
|
/** 是否递归获取目录下的每个文件的 Stats 信息 */
|
|
453
347
|
recursive?: boolean,
|
|
454
|
-
): Stats |
|
|
348
|
+
): Stats | TaroGeneral.IAnyObject
|
|
455
349
|
/** FileSystemManager.saveFile 的同步版本
|
|
456
350
|
* @supported weapp
|
|
457
351
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.saveFileSync.html
|
|
@@ -598,14 +492,14 @@ declare namespace Taro {
|
|
|
598
492
|
/** 要判断是否存在的文件/目录路径 */
|
|
599
493
|
path: string
|
|
600
494
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
601
|
-
complete?: (res:
|
|
495
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
602
496
|
/** 接口调用失败的回调函数 */
|
|
603
497
|
fail?: (result: AccessFailCallbackResult) => void
|
|
604
498
|
/** 接口调用成功的回调函数 */
|
|
605
|
-
success?: (res:
|
|
499
|
+
success?: (res: TaroGeneral.CallbackResult) => void
|
|
606
500
|
}
|
|
607
501
|
|
|
608
|
-
interface AccessFailCallbackResult extends
|
|
502
|
+
interface AccessFailCallbackResult extends TaroGeneral.CallbackResult {
|
|
609
503
|
/** 错误信息
|
|
610
504
|
*
|
|
611
505
|
* 可选值:
|
|
@@ -619,16 +513,16 @@ declare namespace Taro {
|
|
|
619
513
|
/** 要追加内容的文件路径 */
|
|
620
514
|
filePath: string
|
|
621
515
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
622
|
-
complete?: (res:
|
|
516
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
623
517
|
/** 指定写入文件的字符编码 */
|
|
624
518
|
encoding?: keyof FileSystemManager.encoding
|
|
625
519
|
/** 接口调用失败的回调函数 */
|
|
626
520
|
fail?: (result: AppendFileFailCallbackResult) => void
|
|
627
521
|
/** 接口调用成功的回调函数 */
|
|
628
|
-
success?: (res:
|
|
522
|
+
success?: (res: TaroGeneral.CallbackResult) => void
|
|
629
523
|
}
|
|
630
524
|
|
|
631
|
-
interface AppendFileFailCallbackResult extends
|
|
525
|
+
interface AppendFileFailCallbackResult extends TaroGeneral.CallbackResult {
|
|
632
526
|
/** 错误信息
|
|
633
527
|
*
|
|
634
528
|
* 可选值:
|
|
@@ -645,14 +539,14 @@ declare namespace Taro {
|
|
|
645
539
|
/** 源文件路径,只可以是普通文件 */
|
|
646
540
|
srcPath: string
|
|
647
541
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
648
|
-
complete?: (res:
|
|
542
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
649
543
|
/** 接口调用失败的回调函数 */
|
|
650
544
|
fail?: (result: CopyFileFailCallbackResult) => void
|
|
651
545
|
/** 接口调用成功的回调函数 */
|
|
652
|
-
success?: (res:
|
|
546
|
+
success?: (res: TaroGeneral.CallbackResult) => void
|
|
653
547
|
}
|
|
654
548
|
|
|
655
|
-
interface CopyFileFailCallbackResult extends
|
|
549
|
+
interface CopyFileFailCallbackResult extends TaroGeneral.CallbackResult {
|
|
656
550
|
/** 错误信息
|
|
657
551
|
*
|
|
658
552
|
* 可选值:
|
|
@@ -666,21 +560,21 @@ declare namespace Taro {
|
|
|
666
560
|
/** 要读取的文件路径 */
|
|
667
561
|
filePath: string
|
|
668
562
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
669
|
-
complete?: (res:
|
|
563
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
670
564
|
/** 接口调用失败的回调函数 */
|
|
671
565
|
fail?: (result: GetFileInfoFailCallbackResult) => void
|
|
672
566
|
/** 接口调用成功的回调函数 */
|
|
673
567
|
success?: (result: GetFileInfoSuccessCallbackResult) => void
|
|
674
568
|
}
|
|
675
569
|
|
|
676
|
-
interface GetFileInfoFailCallbackResult extends
|
|
570
|
+
interface GetFileInfoFailCallbackResult extends TaroGeneral.CallbackResult {
|
|
677
571
|
/** 错误信息
|
|
678
572
|
*
|
|
679
573
|
* 可选值:
|
|
680
574
|
* - 'fail file not exist': 指定的 filePath 找不到文件; */
|
|
681
575
|
errMsg: string
|
|
682
576
|
}
|
|
683
|
-
interface GetFileInfoSuccessCallbackResult extends
|
|
577
|
+
interface GetFileInfoSuccessCallbackResult extends TaroGeneral.CallbackResult {
|
|
684
578
|
/** 文件大小,以字节为单位 */
|
|
685
579
|
size: number
|
|
686
580
|
/** 调用结果 */
|
|
@@ -689,14 +583,14 @@ declare namespace Taro {
|
|
|
689
583
|
|
|
690
584
|
interface getSavedFileListOption {
|
|
691
585
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
692
|
-
complete?: (res:
|
|
586
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
693
587
|
/** 接口调用失败的回调函数 */
|
|
694
|
-
fail?: (res:
|
|
588
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
695
589
|
/** 接口调用成功的回调函数 */
|
|
696
590
|
success?: (result: GetSavedFileListSuccessCallbackResult) => void
|
|
697
591
|
}
|
|
698
592
|
|
|
699
|
-
interface GetSavedFileListSuccessCallbackResult extends
|
|
593
|
+
interface GetSavedFileListSuccessCallbackResult extends TaroGeneral.CallbackResult {
|
|
700
594
|
/** 文件数组 */
|
|
701
595
|
fileList: GetSavedFileListSuccessCallbackResultFileItem[]
|
|
702
596
|
/** 调用结果 */
|
|
@@ -716,16 +610,16 @@ declare namespace Taro {
|
|
|
716
610
|
/** 创建的目录路径 */
|
|
717
611
|
dirPath: string
|
|
718
612
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
719
|
-
complete?: (res:
|
|
613
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
720
614
|
/** 接口调用失败的回调函数 */
|
|
721
615
|
fail?: (result: MkdirFailCallbackResult) => void
|
|
722
616
|
/** 是否在递归创建该目录的上级目录后再创建该目录。如果对应的上级目录已经存在,则不创建该上级目录。如 dirPath 为 a/b/c/d 且 recursive 为 true,将创建 a 目录,再在 a 目录下创建 b 目录,以此类推直至创建 a/b/c 目录下的 d 目录。 */
|
|
723
617
|
recursive?: boolean
|
|
724
618
|
/** 接口调用成功的回调函数 */
|
|
725
|
-
success?: (res:
|
|
619
|
+
success?: (res: TaroGeneral.CallbackResult) => void
|
|
726
620
|
}
|
|
727
621
|
|
|
728
|
-
interface MkdirFailCallbackResult extends
|
|
622
|
+
interface MkdirFailCallbackResult extends TaroGeneral.CallbackResult {
|
|
729
623
|
/** 错误信息
|
|
730
624
|
*
|
|
731
625
|
* 可选值:
|
|
@@ -743,7 +637,7 @@ declare namespace Taro {
|
|
|
743
637
|
/**指定文件的长度,如果不指定,则读到文件末尾。有效范围:[1, fileLength]。单位:byte */
|
|
744
638
|
length?: number
|
|
745
639
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
746
|
-
complete?: (res:
|
|
640
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
747
641
|
/** 指定读取文件的字符编码,如果不传 encoding,则以 ArrayBuffer 格式读取文件的二进制内容 */
|
|
748
642
|
encoding?: keyof FileSystemManager.encoding
|
|
749
643
|
/** 接口调用失败的回调函数 */
|
|
@@ -751,13 +645,13 @@ declare namespace Taro {
|
|
|
751
645
|
/** 接口调用成功的回调函数 */
|
|
752
646
|
success?: (res: ReadFileSuccessCallbackResult) => void
|
|
753
647
|
}
|
|
754
|
-
interface ReadFileSuccessCallbackResult extends
|
|
648
|
+
interface ReadFileSuccessCallbackResult extends TaroGeneral.CallbackResult {
|
|
755
649
|
/** 文件内容 */
|
|
756
650
|
data: string | ArrayBuffer
|
|
757
651
|
/** 调用结果 */
|
|
758
652
|
errMsg: string
|
|
759
653
|
}
|
|
760
|
-
interface ReadFileFailCallbackResult extends
|
|
654
|
+
interface ReadFileFailCallbackResult extends TaroGeneral.CallbackResult {
|
|
761
655
|
/** 错误信息
|
|
762
656
|
*
|
|
763
657
|
* 可选值:
|
|
@@ -770,14 +664,14 @@ declare namespace Taro {
|
|
|
770
664
|
/** 要读取的目录路径 */
|
|
771
665
|
dirPath: string
|
|
772
666
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
773
|
-
complete?: (res:
|
|
667
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
774
668
|
/** 接口调用失败的回调函数 */
|
|
775
669
|
fail?: (result: ReaddirFailCallbackResult) => void
|
|
776
670
|
/** 接口调用成功的回调函数 */
|
|
777
671
|
success?: (result: ReaddirSuccessCallbackResult) => void
|
|
778
672
|
}
|
|
779
673
|
|
|
780
|
-
interface ReaddirFailCallbackResult extends
|
|
674
|
+
interface ReaddirFailCallbackResult extends TaroGeneral.CallbackResult {
|
|
781
675
|
/** 错误信息
|
|
782
676
|
*
|
|
783
677
|
* 可选值:
|
|
@@ -786,7 +680,7 @@ declare namespace Taro {
|
|
|
786
680
|
* - 'fail permission denied, open ${dirPath}': 指定的 filePath 路径没有读权限; */
|
|
787
681
|
errMsg: string
|
|
788
682
|
}
|
|
789
|
-
interface ReaddirSuccessCallbackResult extends
|
|
683
|
+
interface ReaddirSuccessCallbackResult extends TaroGeneral.CallbackResult {
|
|
790
684
|
/** 指定目录下的文件名数组。 */
|
|
791
685
|
files: string[]
|
|
792
686
|
/** 调用结果 */
|
|
@@ -797,13 +691,13 @@ declare namespace Taro {
|
|
|
797
691
|
/** 需要删除的文件路径 */
|
|
798
692
|
filePath: string
|
|
799
693
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
800
|
-
complete?: (res:
|
|
694
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
801
695
|
/** 接口调用失败的回调函数 */
|
|
802
696
|
fail?: (result: RemoveSavedFileFailCallbackResult) => void
|
|
803
697
|
/** 接口调用成功的回调函数 */
|
|
804
|
-
success?: (res:
|
|
698
|
+
success?: (res: TaroGeneral.CallbackResult) => void
|
|
805
699
|
}
|
|
806
|
-
interface RemoveSavedFileFailCallbackResult extends
|
|
700
|
+
interface RemoveSavedFileFailCallbackResult extends TaroGeneral.CallbackResult {
|
|
807
701
|
/** 错误信息
|
|
808
702
|
*
|
|
809
703
|
* 可选值:
|
|
@@ -817,13 +711,13 @@ declare namespace Taro {
|
|
|
817
711
|
/** 源文件路径,可以是普通文件或目录 */
|
|
818
712
|
oldPath: string
|
|
819
713
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
820
|
-
complete?: (res:
|
|
714
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
821
715
|
/** 接口调用失败的回调函数 */
|
|
822
716
|
fail?: (result: RenameFailCallbackResult) => void
|
|
823
717
|
/** 接口调用成功的回调函数 */
|
|
824
|
-
success?: (res:
|
|
718
|
+
success?: (res: TaroGeneral.CallbackResult) => void
|
|
825
719
|
}
|
|
826
|
-
interface RenameFailCallbackResult extends
|
|
720
|
+
interface RenameFailCallbackResult extends TaroGeneral.CallbackResult {
|
|
827
721
|
/** 错误信息
|
|
828
722
|
*
|
|
829
723
|
* 可选值:
|
|
@@ -836,15 +730,15 @@ declare namespace Taro {
|
|
|
836
730
|
/** 要删除的目录路径 */
|
|
837
731
|
dirPath: string
|
|
838
732
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
839
|
-
complete?: (res:
|
|
733
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
840
734
|
/** 接口调用失败的回调函数 */
|
|
841
735
|
fail?: (result: RmdirFailCallbackResult) => void
|
|
842
736
|
/** 是否递归删除目录。如果为 true,则删除该目录和该目录下的所有子目录以及文件。 */
|
|
843
737
|
recursive?: boolean
|
|
844
738
|
/** 接口调用成功的回调函数 */
|
|
845
|
-
success?: (res:
|
|
739
|
+
success?: (res: TaroGeneral.CallbackResult) => void
|
|
846
740
|
}
|
|
847
|
-
interface RmdirFailCallbackResult extends
|
|
741
|
+
interface RmdirFailCallbackResult extends TaroGeneral.CallbackResult {
|
|
848
742
|
/** 错误信息
|
|
849
743
|
*
|
|
850
744
|
* 可选值:
|
|
@@ -858,7 +752,7 @@ declare namespace Taro {
|
|
|
858
752
|
/** 临时存储文件路径 */
|
|
859
753
|
tempFilePath: string
|
|
860
754
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
861
|
-
complete?: (res:
|
|
755
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
862
756
|
/** 接口调用失败的回调函数 */
|
|
863
757
|
fail?: (result: SaveFileFailCallbackResult) => void
|
|
864
758
|
/** 要存储的文件路径 */
|
|
@@ -867,7 +761,7 @@ declare namespace Taro {
|
|
|
867
761
|
success?: (result: SaveFileSuccessCallbackResult) => void
|
|
868
762
|
}
|
|
869
763
|
|
|
870
|
-
interface SaveFileFailCallbackResult extends
|
|
764
|
+
interface SaveFileFailCallbackResult extends TaroGeneral.CallbackResult {
|
|
871
765
|
/** 错误信息
|
|
872
766
|
*
|
|
873
767
|
* 可选值:
|
|
@@ -877,7 +771,7 @@ declare namespace Taro {
|
|
|
877
771
|
* - 'fail the maximum size of the file storage limit is exceeded': 存储空间不足; */
|
|
878
772
|
errMsg: string
|
|
879
773
|
}
|
|
880
|
-
interface SaveFileSuccessCallbackResult extends
|
|
774
|
+
interface SaveFileSuccessCallbackResult extends TaroGeneral.CallbackResult {
|
|
881
775
|
/** 存储后的文件路径 */
|
|
882
776
|
savedFilePath: string
|
|
883
777
|
/** 调用结果 */
|
|
@@ -888,7 +782,7 @@ declare namespace Taro {
|
|
|
888
782
|
/** 文件/目录路径 */
|
|
889
783
|
path: string
|
|
890
784
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
891
|
-
complete?: (res:
|
|
785
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
892
786
|
/** 接口调用失败的回调函数 */
|
|
893
787
|
fail?: (result: StatFailCallbackResult) => void
|
|
894
788
|
/** 是否递归获取目录下的每个文件的 Stats 信息 */
|
|
@@ -896,7 +790,7 @@ declare namespace Taro {
|
|
|
896
790
|
/** 接口调用成功的回调函数 */
|
|
897
791
|
success?: (result: StatSuccessCallbackResult) => void
|
|
898
792
|
}
|
|
899
|
-
interface StatFailCallbackResult extends
|
|
793
|
+
interface StatFailCallbackResult extends TaroGeneral.CallbackResult {
|
|
900
794
|
/** 错误信息
|
|
901
795
|
*
|
|
902
796
|
* 可选值:
|
|
@@ -904,11 +798,11 @@ declare namespace Taro {
|
|
|
904
798
|
* - 'fail no such file or directory ${path}': 文件不存在; */
|
|
905
799
|
errMsg: string
|
|
906
800
|
}
|
|
907
|
-
interface StatSuccessCallbackResult extends
|
|
801
|
+
interface StatSuccessCallbackResult extends TaroGeneral.CallbackResult {
|
|
908
802
|
/** [Stats](https://developers.weixin.qq.com/miniprogram/dev/api/file/Stats.html)|Object
|
|
909
803
|
*
|
|
910
804
|
* 当 recursive 为 false 时,res.stats 是一个 Stats 对象。当 recursive 为 true 且 path 是一个目录的路径时,res.stats 是一个 Object,key 以 path 为根路径的相对路径,value 是该路径对应的 Stats 对象。 */
|
|
911
|
-
stats: Stats |
|
|
805
|
+
stats: Stats | TaroGeneral.IAnyObject
|
|
912
806
|
/** 调用结果 */
|
|
913
807
|
errMsg: string
|
|
914
808
|
}
|
|
@@ -917,13 +811,13 @@ declare namespace Taro {
|
|
|
917
811
|
/** 要删除的文件路径 */
|
|
918
812
|
filePath: string
|
|
919
813
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
920
|
-
complete?: (res:
|
|
814
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
921
815
|
/** 接口调用失败的回调函数 */
|
|
922
816
|
fail?: (result: UnlinkFailCallbackResult) => void
|
|
923
817
|
/** 接口调用成功的回调函数 */
|
|
924
|
-
success?: (res:
|
|
818
|
+
success?: (res: TaroGeneral.CallbackResult) => void
|
|
925
819
|
}
|
|
926
|
-
interface UnlinkFailCallbackResult extends
|
|
820
|
+
interface UnlinkFailCallbackResult extends TaroGeneral.CallbackResult {
|
|
927
821
|
/** 错误信息
|
|
928
822
|
*
|
|
929
823
|
* 可选值:
|
|
@@ -939,14 +833,14 @@ declare namespace Taro {
|
|
|
939
833
|
/** 源文件路径,只可以是 zip 压缩文件 */
|
|
940
834
|
zipFilePath: string
|
|
941
835
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
942
|
-
complete?: (res:
|
|
836
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
943
837
|
/** 接口调用失败的回调函数 */
|
|
944
838
|
fail?: (result: UnzipFailCallbackResult) => void
|
|
945
839
|
/** 接口调用成功的回调函数 */
|
|
946
|
-
success?: (res:
|
|
840
|
+
success?: (res: TaroGeneral.CallbackResult) => void
|
|
947
841
|
}
|
|
948
842
|
|
|
949
|
-
interface UnzipFailCallbackResult extends
|
|
843
|
+
interface UnzipFailCallbackResult extends TaroGeneral.CallbackResult {
|
|
950
844
|
/** 错误信息
|
|
951
845
|
*
|
|
952
846
|
* 可选值:
|
|
@@ -961,15 +855,15 @@ declare namespace Taro {
|
|
|
961
855
|
/** 要写入的文件路径 */
|
|
962
856
|
filePath: string
|
|
963
857
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
964
|
-
complete?: (res:
|
|
858
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
965
859
|
/** 指定写入文件的字符编码 */
|
|
966
860
|
encoding?: keyof FileSystemManager.encoding
|
|
967
861
|
/** 接口调用失败的回调函数 */
|
|
968
862
|
fail?: (result: WriteFileFailCallbackResult) => void
|
|
969
863
|
/** 接口调用成功的回调函数 */
|
|
970
|
-
success?: (res:
|
|
864
|
+
success?: (res: TaroGeneral.CallbackResult) => void
|
|
971
865
|
}
|
|
972
|
-
interface WriteFileFailCallbackResult extends
|
|
866
|
+
interface WriteFileFailCallbackResult extends TaroGeneral.CallbackResult {
|
|
973
867
|
/** 错误信息
|
|
974
868
|
*
|
|
975
869
|
* 可选值:
|
|
@@ -982,14 +876,14 @@ declare namespace Taro {
|
|
|
982
876
|
/** 文件描述符。fd 通过 FileSystemManager.open 或 FileSystemManager.openSync 接口获得 */
|
|
983
877
|
fd: string
|
|
984
878
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
985
|
-
complete?: (res:
|
|
879
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
986
880
|
/** 接口调用失败的回调函数 */
|
|
987
881
|
fail?: (result: FstatFailCallbackResult) => void
|
|
988
882
|
/** 接口调用成功的回调函数 */
|
|
989
883
|
success?: (res: FstatSuccessCallbackResult) => void
|
|
990
884
|
}
|
|
991
885
|
|
|
992
|
-
interface FstatFailCallbackResult extends
|
|
886
|
+
interface FstatFailCallbackResult extends TaroGeneral.CallbackResult {
|
|
993
887
|
/** 错误信息
|
|
994
888
|
*
|
|
995
889
|
* 可选值:
|
|
@@ -997,7 +891,7 @@ declare namespace Taro {
|
|
|
997
891
|
* - 'fail permission denied': 指定的 fd 路径没有读权限; */
|
|
998
892
|
errMsg: string
|
|
999
893
|
}
|
|
1000
|
-
interface FstatSuccessCallbackResult extends
|
|
894
|
+
interface FstatSuccessCallbackResult extends TaroGeneral.CallbackResult {
|
|
1001
895
|
/** Stats 对象,包含了文件的状态信息 */
|
|
1002
896
|
stats: Stats
|
|
1003
897
|
/** 调用结果 */
|
|
@@ -1011,13 +905,13 @@ declare namespace Taro {
|
|
|
1011
905
|
/** 需要被关闭的文件描述符。fd 通过 FileSystemManager.open 或 FileSystemManager.openSync 接口获得 */
|
|
1012
906
|
fd: string
|
|
1013
907
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
1014
|
-
complete?: (res:
|
|
908
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
1015
909
|
/** 接口调用失败的回调函数 */
|
|
1016
910
|
fail?: (result: CloseFailCallbackResult) => void
|
|
1017
911
|
/** 接口调用成功的回调函数 */
|
|
1018
|
-
success?: (res:
|
|
912
|
+
success?: (res: TaroGeneral.CallbackResult) => void
|
|
1019
913
|
}
|
|
1020
|
-
interface CloseFailCallbackResult extends
|
|
914
|
+
interface CloseFailCallbackResult extends TaroGeneral.CallbackResult {
|
|
1021
915
|
/** 错误信息
|
|
1022
916
|
*
|
|
1023
917
|
* 可选值:
|
|
@@ -1034,13 +928,13 @@ declare namespace Taro {
|
|
|
1034
928
|
/** 截断位置,默认0。如果 length 小于文件长度(单位:字节),则只有前面 length 个字节会保留在文件中,其余内容会被删除;如果 length 大于文件长度,则会对其进行扩展,并且扩展部分将填充空字节('\0') */
|
|
1035
929
|
length: number
|
|
1036
930
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
1037
|
-
complete?: (res:
|
|
931
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
1038
932
|
/** 接口调用失败的回调函数 */
|
|
1039
933
|
fail?: (result: FtruncateFailCallbackResult) => void
|
|
1040
934
|
/** 接口调用成功的回调函数 */
|
|
1041
|
-
success?: (res:
|
|
935
|
+
success?: (res: TaroGeneral.CallbackResult) => void
|
|
1042
936
|
}
|
|
1043
|
-
interface FtruncateFailCallbackResult extends
|
|
937
|
+
interface FtruncateFailCallbackResult extends TaroGeneral.CallbackResult {
|
|
1044
938
|
/** 错误信息
|
|
1045
939
|
*
|
|
1046
940
|
* 可选值:
|
|
@@ -1063,20 +957,20 @@ declare namespace Taro {
|
|
|
1063
957
|
/** 文件系统标志,默认值: 'r' */
|
|
1064
958
|
flag?: keyof FileSystemManager.flag
|
|
1065
959
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
1066
|
-
complete?: (res:
|
|
960
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
1067
961
|
/** 接口调用失败的回调函数 */
|
|
1068
962
|
fail?: (result: OpenFailCallbackResult) => void
|
|
1069
963
|
/** 接口调用成功的回调函数 */
|
|
1070
964
|
success?: (res: OpenSuccessCallbackResult) => void
|
|
1071
965
|
}
|
|
1072
|
-
interface OpenFailCallbackResult extends
|
|
966
|
+
interface OpenFailCallbackResult extends TaroGeneral.CallbackResult {
|
|
1073
967
|
/** 错误信息
|
|
1074
968
|
*
|
|
1075
969
|
* 可选值:
|
|
1076
970
|
* - 'fail no such file or directory "${filePath}"': 上级目录不存在 */
|
|
1077
971
|
errMsg: string
|
|
1078
972
|
}
|
|
1079
|
-
interface OpenSuccessCallbackResult extends
|
|
973
|
+
interface OpenSuccessCallbackResult extends TaroGeneral.CallbackResult {
|
|
1080
974
|
/** 文件描述符 */
|
|
1081
975
|
fd: string
|
|
1082
976
|
/** 调用结果 */
|
|
@@ -1100,26 +994,26 @@ declare namespace Taro {
|
|
|
1100
994
|
/** 文件读取的起始位置,如不传或传 null,则会从当前文件指针的位置读取。如果 position 是正整数,则文件指针位置会保持不变并从 position 读取文件。 */
|
|
1101
995
|
position?: number
|
|
1102
996
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
1103
|
-
complete?: (res:
|
|
997
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
1104
998
|
/** 接口调用失败的回调函数 */
|
|
1105
999
|
fail?: (result: ReadFailCallbackResult) => void
|
|
1106
1000
|
/** 接口调用成功的回调函数 */
|
|
1107
1001
|
success?: (res: ReadSuccessCallbackResult) => void
|
|
1108
1002
|
}
|
|
1109
|
-
interface ReadFailCallbackResult extends
|
|
1003
|
+
interface ReadFailCallbackResult extends TaroGeneral.CallbackResult {
|
|
1110
1004
|
/** 错误信息
|
|
1111
1005
|
*
|
|
1112
1006
|
* 可选值:
|
|
1113
|
-
* - 'bad file descriptor': 无效的文件描述符
|
|
1114
|
-
- 'fail permission denied': 指定的 fd 路径没有读权限
|
|
1115
|
-
- 'fail the value of "offset" is out of range': 传入的 offset 不合法
|
|
1116
|
-
- 'fail the value of "length" is out of range': 传入的 length 不合法
|
|
1117
|
-
- 'fail sdcard not mounted': android sdcard 挂载失败
|
|
1118
|
-
- 'bad file descriptor': 无效的文件描述符
|
|
1007
|
+
* - 'bad file descriptor': 无效的文件描述符
|
|
1008
|
+
- 'fail permission denied': 指定的 fd 路径没有读权限
|
|
1009
|
+
- 'fail the value of "offset" is out of range': 传入的 offset 不合法
|
|
1010
|
+
- 'fail the value of "length" is out of range': 传入的 length 不合法
|
|
1011
|
+
- 'fail sdcard not mounted': android sdcard 挂载失败
|
|
1012
|
+
- 'bad file descriptor': 无效的文件描述符
|
|
1119
1013
|
* */
|
|
1120
1014
|
errMsg: string
|
|
1121
1015
|
}
|
|
1122
|
-
interface ReadSuccessCallbackResult extends
|
|
1016
|
+
interface ReadSuccessCallbackResult extends TaroGeneral.CallbackResult {
|
|
1123
1017
|
/** 实际读取的字节数 */
|
|
1124
1018
|
bytesRead: string
|
|
1125
1019
|
/** 被写入的缓存区的对象,即接口入参的 arrayBuffer */
|
|
@@ -1145,21 +1039,21 @@ declare namespace Taro {
|
|
|
1145
1039
|
/** 截断位置,默认0。如果 length 小于文件长度(字节),则只有前面 length 个字节会保留在文件中,其余内容会被删除;如果 length 大于文件长度,则会对其进行扩展,并且扩展部分将填充空字节('\0') */
|
|
1146
1040
|
length?: number
|
|
1147
1041
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
1148
|
-
complete?: (res:
|
|
1042
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
1149
1043
|
/** 接口调用失败的回调函数 */
|
|
1150
1044
|
fail?: (result: TruncateFailCallbackResult) => void
|
|
1151
1045
|
/** 接口调用成功的回调函数 */
|
|
1152
|
-
success?: (res:
|
|
1046
|
+
success?: (res: TaroGeneral.CallbackResult) => void
|
|
1153
1047
|
}
|
|
1154
|
-
interface TruncateFailCallbackResult extends
|
|
1048
|
+
interface TruncateFailCallbackResult extends TaroGeneral.CallbackResult {
|
|
1155
1049
|
/** 错误信息
|
|
1156
1050
|
*
|
|
1157
1051
|
* 可选值:
|
|
1158
|
-
* - 'fail no such file or directory, open ${filePath}': 指定的 filePath 所在目录不存在
|
|
1052
|
+
* - 'fail no such file or directory, open ${filePath}': 指定的 filePath 所在目录不存在
|
|
1159
1053
|
- 'fail illegal operation on a directory, open "${filePath}"': 指定的 filePath 是一个已经存在的目录
|
|
1160
|
-
- 'fail permission denied, open ${dirPath}': 指定的 filePath 路径没有写权限
|
|
1161
|
-
- 'fail the maximum size of the file storage limit is exceeded': 存储空间不足
|
|
1162
|
-
- 'fail sdcard not mounted': android sdcard 挂载失败
|
|
1054
|
+
- 'fail permission denied, open ${dirPath}': 指定的 filePath 路径没有写权限
|
|
1055
|
+
- 'fail the maximum size of the file storage limit is exceeded': 存储空间不足
|
|
1056
|
+
- 'fail sdcard not mounted': android sdcard 挂载失败
|
|
1163
1057
|
* */
|
|
1164
1058
|
errMsg: string
|
|
1165
1059
|
}
|
|
@@ -1183,13 +1077,13 @@ declare namespace Taro {
|
|
|
1183
1077
|
/** 指定文件开头的偏移量,即数据要被写入的位置。当 position 不传或者传入非 Number 类型的值时,数据会被写入当前指针所在位置。 */
|
|
1184
1078
|
position?: number
|
|
1185
1079
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
1186
|
-
complete?: (res:
|
|
1080
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
1187
1081
|
/** 接口调用失败的回调函数 */
|
|
1188
1082
|
fail?: (result: WriteFailCallbackResult) => void
|
|
1189
1083
|
/** 接口调用成功的回调函数 */
|
|
1190
1084
|
success?: (res: WriteSuccessCallbackResult) => void
|
|
1191
1085
|
}
|
|
1192
|
-
interface WriteFailCallbackResult extends
|
|
1086
|
+
interface WriteFailCallbackResult extends TaroGeneral.CallbackResult {
|
|
1193
1087
|
/** 错误信息
|
|
1194
1088
|
*
|
|
1195
1089
|
* 可选值:
|
|
@@ -1199,7 +1093,7 @@ declare namespace Taro {
|
|
|
1199
1093
|
* */
|
|
1200
1094
|
errMsg: string
|
|
1201
1095
|
}
|
|
1202
|
-
interface WriteSuccessCallbackResult extends
|
|
1096
|
+
interface WriteSuccessCallbackResult extends TaroGeneral.CallbackResult {
|
|
1203
1097
|
/** 实际被写入到文件中的字节数(注意,被写入的字节数不一定与被写入的字符串字符数相同) */
|
|
1204
1098
|
bytesWritten: number
|
|
1205
1099
|
/** 调用结果 */
|
|
@@ -1242,4 +1136,120 @@ declare namespace Taro {
|
|
|
1242
1136
|
*/
|
|
1243
1137
|
isFile(): boolean
|
|
1244
1138
|
}
|
|
1139
|
+
|
|
1140
|
+
interface TaroStatic {
|
|
1141
|
+
/** 保存文件到本地。**注意:saveFile 会把临时文件移动,因此调用成功后传入的 tempFilePath 将不可用**
|
|
1142
|
+
* @supported weapp
|
|
1143
|
+
* @example
|
|
1144
|
+
* ```tsx
|
|
1145
|
+
* Taro.chooseImage({
|
|
1146
|
+
* success: function (res) {
|
|
1147
|
+
* var tempFilePaths = res.tempFilePaths
|
|
1148
|
+
* Taro.saveFile({
|
|
1149
|
+
* tempFilePath: tempFilePaths[0],
|
|
1150
|
+
* success: function (res) {
|
|
1151
|
+
* var savedFilePath = res.savedFilePath
|
|
1152
|
+
* }
|
|
1153
|
+
* })
|
|
1154
|
+
* }
|
|
1155
|
+
* })
|
|
1156
|
+
* ```
|
|
1157
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/file/wx.saveFile.html
|
|
1158
|
+
*/
|
|
1159
|
+
saveFile(option: saveFile.Option): Promise<saveFile.SuccessCallbackResult | saveFile.FailCallbackResult>
|
|
1160
|
+
|
|
1161
|
+
/** 删除该小程序下已保存的本地缓存文件
|
|
1162
|
+
* @supported weapp
|
|
1163
|
+
* @example
|
|
1164
|
+
* ```tsx
|
|
1165
|
+
* Taro.getSavedFileList({
|
|
1166
|
+
* success: function (res) {
|
|
1167
|
+
* if (res.fileList.length > 0){
|
|
1168
|
+
* Taro.removeSavedFile({
|
|
1169
|
+
* filePath: res.fileList[0].filePath,
|
|
1170
|
+
* complete: function (res) {
|
|
1171
|
+
* console.log(res)
|
|
1172
|
+
* }
|
|
1173
|
+
* })
|
|
1174
|
+
* }
|
|
1175
|
+
* }
|
|
1176
|
+
* })
|
|
1177
|
+
* ```
|
|
1178
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/file/wx.removeSavedFile.html
|
|
1179
|
+
*/
|
|
1180
|
+
removeSavedFile(option: removeSavedFile.Option): Promise<TaroGeneral.CallbackResult>
|
|
1181
|
+
|
|
1182
|
+
/** 新开页面打开文档,支持格式
|
|
1183
|
+
* @supported weapp
|
|
1184
|
+
* @example
|
|
1185
|
+
```tsx
|
|
1186
|
+
* Taro.downloadFile({
|
|
1187
|
+
* url: 'http://example.com/somefile.pdf',
|
|
1188
|
+
* success: function (res) {
|
|
1189
|
+
* var filePath = res.tempFilePath
|
|
1190
|
+
* Taro.openDocument({
|
|
1191
|
+
* filePath: filePath,
|
|
1192
|
+
* success: function (res) {
|
|
1193
|
+
* console.log('打开文档成功')
|
|
1194
|
+
* }
|
|
1195
|
+
* })
|
|
1196
|
+
* }
|
|
1197
|
+
* })
|
|
1198
|
+
* ```
|
|
1199
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/file/wx.openDocument.html
|
|
1200
|
+
*/
|
|
1201
|
+
openDocument(option: openDocument.Option): Promise<TaroGeneral.CallbackResult>
|
|
1202
|
+
|
|
1203
|
+
/** 获取本地已保存的文件列表
|
|
1204
|
+
* @supported weapp
|
|
1205
|
+
* @example
|
|
1206
|
+
* ```tsx
|
|
1207
|
+
* Taro.getSavedFileList({
|
|
1208
|
+
* success: function (res) {
|
|
1209
|
+
* console.log(res.fileList)
|
|
1210
|
+
* }
|
|
1211
|
+
* })
|
|
1212
|
+
* ```
|
|
1213
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/file/wx.getSavedFileList.html
|
|
1214
|
+
*/
|
|
1215
|
+
getSavedFileList(option?: getSavedFileList.Option): Promise<getSavedFileList.SuccessCallbackResult>
|
|
1216
|
+
|
|
1217
|
+
/** 获取本地文件的文件信息。此接口只能用于获取已保存到本地的文件,若需要获取临时文件信息,请使用 [Taro.getFileInfo](https://developers.weixin.qq.com/miniprogram/dev/api/file/wx.getFileInfo.html) 接口。
|
|
1218
|
+
* @supported weapp
|
|
1219
|
+
* @example
|
|
1220
|
+
* ```tsx
|
|
1221
|
+
* Taro.getSavedFileInfo({
|
|
1222
|
+
* filePath: 'wxfile://somefile', //仅做示例用,非真正的文件路径
|
|
1223
|
+
* success: function (res) {
|
|
1224
|
+
* console.log(res.size)
|
|
1225
|
+
* console.log(res.createTime)
|
|
1226
|
+
* }
|
|
1227
|
+
* })
|
|
1228
|
+
* ```
|
|
1229
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/file/wx.getSavedFileInfo.html
|
|
1230
|
+
*/
|
|
1231
|
+
getSavedFileInfo(option: getSavedFileInfo.Option): Promise<getSavedFileInfo.SuccessCallbackResult>
|
|
1232
|
+
|
|
1233
|
+
/**
|
|
1234
|
+
* 获取该小程序下的 本地临时文件 或 本地缓存文件 信息
|
|
1235
|
+
* @supported weapp
|
|
1236
|
+
* @example
|
|
1237
|
+
* ```tsx
|
|
1238
|
+
* Taro.getFileInfo({
|
|
1239
|
+
* success: function (res) {
|
|
1240
|
+
* console.log(res.size)
|
|
1241
|
+
* console.log(res.digest)
|
|
1242
|
+
* }
|
|
1243
|
+
* })
|
|
1244
|
+
* ```
|
|
1245
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/file/wx.getFileInfo.html
|
|
1246
|
+
*/
|
|
1247
|
+
getFileInfo(option: getFileInfo.Option): Promise<getFileInfo.SuccessCallbackResult | getFileInfo.FailCallbackResult>
|
|
1248
|
+
|
|
1249
|
+
/** 获取全局唯一的文件管理器
|
|
1250
|
+
* @supported weapp
|
|
1251
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/file/wx.getFileSystemManager.html
|
|
1252
|
+
*/
|
|
1253
|
+
getFileSystemManager(): FileSystemManager
|
|
1254
|
+
}
|
|
1245
1255
|
}
|