@dcloudio/uni-app-x 0.7.7 → 0.7.9
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 +1 -1
- package/index.d.ts +1 -1
- package/options.d.ts +9 -9
- package/package.json +27 -27
- package/types/app.d.ts +843 -843
- package/types/index.d.ts +7 -7
- package/types/native/AsyncApiResult.d.ts +7 -7
- package/types/native/CSSStyleDeclaration.d.ts +25 -25
- package/types/native/DOMRect.d.ts +56 -56
- package/types/native/DrawableContext.d.ts +162 -162
- package/types/native/INavigationBar.d.ts +22 -22
- package/types/native/IUniElement.d.ts +777 -755
- package/types/native/IUniError.d.ts +20 -20
- package/types/native/IUniForm.d.ts +9 -9
- package/types/native/NativeLoadFontFaceOptions.d.ts +11 -11
- package/types/native/NodeData.d.ts +22 -22
- package/types/native/PageNode.d.ts +6 -6
- package/types/native/SnapshotOptions.d.ts +63 -63
- package/types/native/SourceError.d.ts +46 -46
- package/types/native/UTSAndroidHookProxy.d.ts +14 -14
- package/types/native/UniAggregateError.d.ts +19 -19
- package/types/native/UniApp.d.ts +66 -66
- package/types/native/UniCallbackWrapper.d.ts +7 -7
- package/types/native/UniCustomEvent.d.ts +24 -24
- package/types/native/UniDocument.d.ts +35 -35
- package/types/native/UniElement.d.ts +74 -74
- package/types/native/UniError.d.ts +70 -70
- package/types/native/UniEvent.d.ts +62 -62
- package/types/native/UniFormControl.d.ts +8 -8
- package/types/native/UniFormControlElement.d.ts +14 -14
- package/types/native/UniImageErrorEvent.d.ts +33 -15
- package/types/native/UniImageLoadEvent.d.ts +37 -19
- package/types/native/UniInputBlurEvent.d.ts +37 -20
- package/types/native/UniInputConfirmEvent.d.ts +31 -16
- package/types/native/UniInputEvent.d.ts +38 -24
- package/types/native/UniInputFocusEvent.d.ts +48 -33
- package/types/native/UniInputKeyboardHeightChangeEvent.d.ts +26 -11
- package/types/native/{UniPage.d.ts → UniNativePage.d.ts} +153 -96
- package/types/native/UniPageEvent.d.ts +10 -10
- package/types/native/UniPageManager.d.ts +17 -17
- package/types/native/UniPageScrollEvent.d.ts +13 -13
- package/types/native/UniPointerEvent.d.ts +74 -73
- package/types/native/UniRefresherEvent.d.ts +18 -14
- package/types/native/UniResizeEvent.d.ts +34 -34
- package/types/native/UniRichTextItemClickEvent.d.ts +41 -23
- package/types/native/UniScrollEvent.d.ts +42 -36
- package/types/native/UniScrollToLowerEvent.d.ts +23 -16
- package/types/native/UniScrollToUpperEvent.d.ts +23 -16
- package/types/native/UniStartNestedScrollEvent.d.ts +33 -33
- package/types/native/UniStopNestedScrollEvent.d.ts +28 -28
- package/types/native/UniSwiperAnimationFinishEvent.d.ts +22 -20
- package/types/native/UniSwiperChangeEvent.d.ts +22 -20
- package/types/native/UniSwiperTransitionEvent.d.ts +24 -20
- package/types/native/UniTabTapEvent.d.ts +18 -18
- package/types/native/UniTabsElement.d.ts +29 -29
- package/types/native/UniTextElement.d.ts +17 -17
- package/types/native/UniTextareaBlurEvent.d.ts +26 -11
- package/types/native/UniTextareaFocusEvent.d.ts +49 -34
- package/types/native/UniTextareaLineChangeEvent.d.ts +30 -15
- package/types/native/UniTouchEvent.d.ts +64 -60
- package/types/native/UniVideoElement.d.ts +70 -70
- package/types/native/UniWebViewDownloadEvent.d.ts +52 -42
- package/types/native/UniWebViewElement.d.ts +10 -10
- package/types/native/UniWebViewErrorEvent.d.ts +47 -37
- package/types/native/UniWebViewLoadEvent.d.ts +36 -26
- package/types/native/UniWebViewLoadingEvent.d.ts +36 -27
- package/types/native/UniWebViewMessageEvent.d.ts +36 -26
- package/types/native/UniWebViewServiceMessageEvent.d.ts +8 -8
- package/types/native/ViewToTempFilePathOptions.d.ts +47 -47
- package/types/native/WebViewStyles.d.ts +20 -20
- package/types/native/global.d.ts +519 -429
- package/types/native/index.d.ts +65 -65
- package/types/native-global/index.d.ts +1 -1
- package/types/page.d.ts +1593 -1593
- package/types/process.d.ts +5 -5
- package/types/uni/base/index.d.ts +3 -3
- package/types/uni/core/global.d.ts +13 -13
- package/types/uni/core/index.d.ts +13 -13
- package/types/uni/core/lib/base/event/global.d.ts +16 -16
- package/types/uni/core/lib/base/event/index.d.ts +7 -7
- package/types/uni/core/lib/base/event/interface.d.ts +277 -277
- package/types/uni/core/lib/base/interceptor/global.d.ts +18 -18
- package/types/uni/core/lib/base/interceptor/index.d.ts +8 -8
- package/types/uni/core/lib/base/interceptor/interface.d.ts +150 -150
- package/types/uni/core/lib/interface.d.ts +28 -28
- package/types/uni/core/lib/lifecycle/global.d.ts +10 -10
- package/types/uni/core/lib/lifecycle/index.d.ts +4 -4
- package/types/uni/core/lib/lifecycle/interface.d.ts +37 -37
- package/types/uni/core/lib/performance/global.d.ts +22 -22
- package/types/uni/core/lib/performance/index.d.ts +10 -10
- package/types/uni/core/lib/performance/interface.d.ts +157 -157
- package/types/uni/core/lib/route/global.d.ts +68 -68
- package/types/uni/core/lib/route/index.d.ts +33 -33
- package/types/uni/core/lib/route/interface.d.ts +2031 -2031
- package/types/uni/core/lib/ui/create-selector-query/global.d.ts +20 -20
- package/types/uni/core/lib/ui/create-selector-query/index.d.ts +9 -9
- package/types/uni/core/lib/ui/create-selector-query/interface.d.ts +412 -412
- package/types/uni/core/lib/ui/get-element-by-id/global.d.ts +10 -10
- package/types/uni/core/lib/ui/get-element-by-id/index.d.ts +4 -4
- package/types/uni/core/lib/ui/get-element-by-id/interface.d.ts +73 -73
- package/types/uni/core/lib/ui/load-font-face/global.d.ts +26 -26
- package/types/uni/core/lib/ui/load-font-face/index.d.ts +12 -12
- package/types/uni/core/lib/ui/load-font-face/interface.d.ts +560 -560
- package/types/uni/core/lib/ui/page-scroll-to/global.d.ts +26 -26
- package/types/uni/core/lib/ui/page-scroll-to/index.d.ts +12 -12
- package/types/uni/core/lib/ui/page-scroll-to/interface.d.ts +145 -145
- package/types/uni/core/lib/ui/pull-down-refresh/global.d.ts +28 -28
- package/types/uni/core/lib/ui/pull-down-refresh/index.d.ts +13 -13
- package/types/uni/core/lib/ui/pull-down-refresh/interface.d.ts +176 -176
- package/types/uni/core/lib/ui/set-navigation-bar-color/global.d.ts +28 -28
- package/types/uni/core/lib/ui/set-navigation-bar-color/index.d.ts +13 -13
- package/types/uni/core/lib/ui/set-navigation-bar-color/interface.d.ts +431 -431
- package/types/uni/core/lib/ui/set-navigation-bar-title/global.d.ts +28 -28
- package/types/uni/core/lib/ui/set-navigation-bar-title/index.d.ts +13 -13
- package/types/uni/core/lib/ui/set-navigation-bar-title/interface.d.ts +368 -368
- package/types/uni/core/lib/ui/tab-bar/global.d.ts +130 -130
- package/types/uni/core/lib/ui/tab-bar/index.d.ts +64 -64
- package/types/uni/core/lib/ui/tab-bar/interface.d.ts +928 -928
- package/types/uni/env/index.d.ts +64 -64
- package/types/uni/global.d.ts +6 -6
- package/types/uni/index.d.ts +3 -3
- package/types/uni/uts-plugin-api/global.d.ts +23 -22
- package/types/uni/uts-plugin-api/index.d.ts +23 -22
- package/types/uni/uts-plugin-api/lib/uni-createRequestPermissionListener/utssdk/global.d.ts +18 -18
- package/types/uni/uts-plugin-api/lib/uni-createRequestPermissionListener/utssdk/index.d.ts +8 -8
- package/types/uni/uts-plugin-api/lib/uni-createRequestPermissionListener/utssdk/interface.d.ts +43 -43
- package/types/uni/uts-plugin-api/lib/uni-createWebviewContext/utssdk/global.d.ts +12 -12
- package/types/uni/uts-plugin-api/lib/uni-createWebviewContext/utssdk/index.d.ts +5 -5
- package/types/uni/uts-plugin-api/lib/uni-createWebviewContext/utssdk/interface.d.ts +99 -101
- package/types/uni/uts-plugin-api/lib/uni-exit/utssdk/global.d.ts +26 -26
- package/types/uni/uts-plugin-api/lib/uni-exit/utssdk/index.d.ts +12 -12
- package/types/uni/uts-plugin-api/lib/uni-exit/utssdk/interface.d.ts +82 -82
- package/types/uni/uts-plugin-api/lib/uni-fileSystemManager/utssdk/global.d.ts +66 -66
- package/types/uni/uts-plugin-api/lib/uni-fileSystemManager/utssdk/index.d.ts +32 -32
- package/types/uni/uts-plugin-api/lib/uni-fileSystemManager/utssdk/interface.d.ts +423 -423
- package/types/uni/uts-plugin-api/lib/uni-getAccessibilityInfo/utssdk/global.d.ts +10 -10
- package/types/uni/uts-plugin-api/lib/uni-getAccessibilityInfo/utssdk/index.d.ts +4 -4
- package/types/uni/uts-plugin-api/lib/uni-getAppAuthorizeSetting/utssdk/global.d.ts +12 -12
- package/types/uni/uts-plugin-api/lib/uni-getAppAuthorizeSetting/utssdk/index.d.ts +5 -5
- package/types/uni/uts-plugin-api/lib/uni-getAppBaseInfo/utssdk/global.d.ts +14 -14
- package/types/uni/uts-plugin-api/lib/uni-getAppBaseInfo/utssdk/index.d.ts +6 -6
- package/types/uni/uts-plugin-api/lib/uni-getAppBaseInfo/utssdk/interface.d.ts +350 -350
- package/types/uni/uts-plugin-api/lib/uni-getDeviceInfo/utssdk/global.d.ts +14 -14
- package/types/uni/uts-plugin-api/lib/uni-getDeviceInfo/utssdk/index.d.ts +6 -6
- package/types/uni/uts-plugin-api/lib/uni-getLocation-system/utssdk/global.d.ts +20 -20
- package/types/uni/uts-plugin-api/lib/uni-getLocation-system/utssdk/index.d.ts +9 -9
- package/types/uni/uts-plugin-api/lib/uni-getLocation-system/utssdk/interface.d.ts +151 -151
- package/types/uni/uts-plugin-api/lib/uni-getNetworkType/utssdk/global.d.ts +24 -24
- package/types/uni/uts-plugin-api/lib/uni-getNetworkType/utssdk/index.d.ts +11 -11
- package/types/uni/uts-plugin-api/lib/uni-getProvider/utssdk/global.d.ts +24 -0
- package/types/uni/uts-plugin-api/lib/uni-getProvider/utssdk/index.d.ts +11 -0
- package/types/uni/uts-plugin-api/lib/uni-getProvider/utssdk/interface.d.ts +88 -0
- package/types/uni/uts-plugin-api/lib/uni-getSystemInfo/utssdk/global.d.ts +30 -30
- package/types/uni/uts-plugin-api/lib/uni-getSystemInfo/utssdk/index.d.ts +14 -14
- package/types/uni/uts-plugin-api/lib/uni-getSystemSetting/utssdk/global.d.ts +12 -12
- package/types/uni/uts-plugin-api/lib/uni-getSystemSetting/utssdk/index.d.ts +5 -5
- package/types/uni/uts-plugin-api/lib/uni-installApk/utssdk/global.d.ts +24 -24
- package/types/uni/uts-plugin-api/lib/uni-installApk/utssdk/index.d.ts +11 -11
- package/types/uni/uts-plugin-api/lib/uni-media/utssdk/global.d.ts +158 -158
- package/types/uni/uts-plugin-api/lib/uni-media/utssdk/index.d.ts +78 -78
- package/types/uni/uts-plugin-api/lib/uni-media/utssdk/interface.d.ts +906 -906
- package/types/uni/uts-plugin-api/lib/uni-network/utssdk/app-ios/global.d.ts +68 -68
- package/types/uni/uts-plugin-api/lib/uni-network/utssdk/app-ios/index.d.ts +33 -33
- package/types/uni/uts-plugin-api/lib/uni-network/utssdk/global.d.ts +72 -72
- package/types/uni/uts-plugin-api/lib/uni-network/utssdk/index.d.ts +35 -35
- package/types/uni/uts-plugin-api/lib/uni-openAppAuthorizeSetting/utssdk/global.d.ts +24 -24
- package/types/uni/uts-plugin-api/lib/uni-openAppAuthorizeSetting/utssdk/index.d.ts +11 -11
- package/types/uni/uts-plugin-api/lib/{uni-requestPayment-alipay → uni-payment}/utssdk/global.d.ts +30 -28
- package/types/uni/uts-plugin-api/lib/{uni-requestPayment-alipay → uni-payment}/utssdk/index.d.ts +14 -13
- package/types/uni/uts-plugin-api/lib/{uni-requestPayment-alipay → uni-payment}/utssdk/interface.d.ts +6 -3
- package/types/uni/uts-plugin-api/lib/uni-prompt/utssdk/global.d.ts +74 -62
- package/types/uni/uts-plugin-api/lib/uni-prompt/utssdk/index.d.ts +36 -30
- package/types/uni/uts-plugin-api/lib/uni-prompt/utssdk/interface.d.ts +46 -14
- package/types/uni/uts-plugin-api/lib/uni-rpx2px/utssdk/global.d.ts +10 -10
- package/types/uni/uts-plugin-api/lib/uni-rpx2px/utssdk/index.d.ts +4 -4
- package/types/uni/uts-plugin-api/lib/uni-rpx2px/utssdk/interface.d.ts +33 -33
- package/types/uni/uts-plugin-api/lib/uni-storage/utssdk/global.d.ts +78 -78
- package/types/uni/uts-plugin-api/lib/uni-storage/utssdk/index.d.ts +38 -38
- package/types/uni/uts-plugin-api/lib/uni-storage/utssdk/interface.d.ts +531 -531
- package/types/uni/uts-plugin-api/lib/uni-websocket/utssdk/global.d.ts +58 -58
- package/types/uni/uts-plugin-api/lib/uni-websocket/utssdk/index.d.ts +28 -28
- package/types/uni/uts-plugin-biz/global.d.ts +4 -4
- package/types/uni/uts-plugin-biz/index.d.ts +4 -4
- package/types/uni/uts-plugin-biz/lib/uni-ad/utssdk/global.d.ts +36 -36
- package/types/uni/uts-plugin-biz/lib/uni-ad/utssdk/index.d.ts +17 -17
- package/types/uni/uts-plugin-biz/lib/uni-ad/utssdk/interface.d.ts +132 -132
- package/types/uni/uts-plugin-biz/lib/uni-facialRecognitionVerify/utssdk/global.d.ts +28 -28
- package/types/uni/uts-plugin-biz/lib/uni-facialRecognitionVerify/utssdk/index.d.ts +13 -13
- package/types/uni/uts-plugin-biz/lib/uni-facialRecognitionVerify/utssdk/interface.d.ts +141 -141
- package/types/uni/uts-plugin-biz/lib/uni-push/utssdk/global.d.ts +56 -56
- package/types/uni/uts-plugin-biz/lib/uni-push/utssdk/index.d.ts +27 -27
- package/types/uni/uts-plugin-biz/lib/uni-verify/utssdk/global.d.ts +46 -46
- package/types/uni/uts-plugin-biz/lib/uni-verify/utssdk/index.d.ts +22 -22
- package/types/uni/uts-plugin-biz/lib/uni-verify/utssdk/interface.d.ts +203 -203
- package/types/uni/uts-plugin-component/global.d.ts +1 -1
- package/types/uni/uts-plugin-component/index.d.ts +1 -1
- package/types/uni/uts-plugin-component/lib/uni-video/utssdk/global.d.ts +64 -64
- package/types/uni/uts-plugin-component/lib/uni-video/utssdk/index.d.ts +31 -31
- package/types/uni/uts-plugin-component/lib/uni-video/utssdk/interface.d.ts +354 -356
- package/types/uni-cloud/index.d.ts +59 -59
- package/types/uni-cloud/interface.d.ts +801 -801
- package/types/uni-cloud/unicloud-db/index.ts +313 -313
- package/types/uni-global/index.d.ts +1 -1
- package/types/vue/CheckboxGroupChangeEvent.d.ts +36 -36
- package/types/vue/LifeCycle.d.ts +55 -55
- package/types/vue/PickerViewChangeEvent.d.ts +36 -36
- package/types/vue/ProgressActiveendEvent.d.ts +30 -30
- package/types/vue/RadioGroupChangeEvent.d.ts +36 -36
- package/types/vue/SliderChangeEvent.d.ts +32 -32
- package/types/vue/SwitchChangeEvent.d.ts +30 -30
- package/types/vue/UniCanvasElement.d.ts +270 -270
- package/types/vue/UniCloudDBElement.d.ts +215 -215
- package/types/vue/UniFormElement.d.ts +51 -51
- package/types/vue/UniNavigatorElement.d.ts +7 -7
- package/types/vue/index.d.ts +11 -11
- package/uts-plugin.d.ts +26 -26
- package/types/uni-cloud/unicloud-db/index.d.ts +0 -81
- package/types/vue/UniButtonElement.d.ts +0 -7
|
@@ -1,423 +1,423 @@
|
|
|
1
|
-
|
|
2
|
-
export type ReadFileSuccessResult = {
|
|
3
|
-
data: string
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* 通用的正确返回结果
|
|
9
|
-
*/
|
|
10
|
-
export type FileManagerSuccessResult = {
|
|
11
|
-
errMsg: string,
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* 通用的正确返回结果回调
|
|
15
|
-
*/
|
|
16
|
-
export type FileManagerSuccessCallback = (res: FileManagerSuccessResult) => void
|
|
17
|
-
/**
|
|
18
|
-
* 通用的错误返回结果回调
|
|
19
|
-
*/
|
|
20
|
-
export type FileManagerFailCallback = (res: UniError) => void
|
|
21
|
-
/**
|
|
22
|
-
* 通用的结束返回结果回调
|
|
23
|
-
*/
|
|
24
|
-
export type FileManagerCompleteCallback = (res: any) => void
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
export type ReadFileSuccessCallback = (res: ReadFileSuccessResult) => void
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
export type ReadFileOptions = {
|
|
33
|
-
/**
|
|
34
|
-
* base64 / utf-8
|
|
35
|
-
*/
|
|
36
|
-
encoding: "base64" | "utf-8",
|
|
37
|
-
/**
|
|
38
|
-
* 文件路径,支持相对地址和绝对地址
|
|
39
|
-
*/
|
|
40
|
-
filePath: string.URIString,
|
|
41
|
-
/**
|
|
42
|
-
* 接口调用的回调函数
|
|
43
|
-
*/
|
|
44
|
-
success?: ReadFileSuccessCallback | null,
|
|
45
|
-
/**
|
|
46
|
-
* 接口调用失败的回调函数
|
|
47
|
-
*/
|
|
48
|
-
fail?: FileManagerFailCallback | null,
|
|
49
|
-
/**
|
|
50
|
-
* 接口调用结束的回调函数(调用成功、失败都会执行)
|
|
51
|
-
*/
|
|
52
|
-
complete?: FileManagerCompleteCallback | null
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
export type WriteFileOptions = {
|
|
60
|
-
/**
|
|
61
|
-
* 文件路径,只支持绝对地址
|
|
62
|
-
*/
|
|
63
|
-
filePath: string.URIString,
|
|
64
|
-
/**
|
|
65
|
-
* 指定写入文件的字符编码
|
|
66
|
-
* 支持:ascii base64 utf-8
|
|
67
|
-
*/
|
|
68
|
-
encoding: "ascii" | "base64" | "utf-8",
|
|
69
|
-
/**
|
|
70
|
-
* 写入的文本内容
|
|
71
|
-
*/
|
|
72
|
-
data: string,
|
|
73
|
-
/**
|
|
74
|
-
* 接口调用的回调函数
|
|
75
|
-
*/
|
|
76
|
-
success?: FileManagerSuccessCallback | null,
|
|
77
|
-
/**
|
|
78
|
-
* 接口调用失败的回调函数
|
|
79
|
-
*/
|
|
80
|
-
fail?: FileManagerFailCallback | null,
|
|
81
|
-
/**
|
|
82
|
-
* 接口调用结束的回调函数(调用成功、失败都会执行)
|
|
83
|
-
*/
|
|
84
|
-
complete?: FileManagerCompleteCallback | null
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
export type UnLinkSuccessCallback = (res: FileManagerSuccessResult) => void
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
export type UnLinkOptions = {
|
|
94
|
-
/**
|
|
95
|
-
* 文件路径,只支持绝对地址
|
|
96
|
-
*/
|
|
97
|
-
filePath: string.URIString,
|
|
98
|
-
/**
|
|
99
|
-
* 接口调用的回调函数
|
|
100
|
-
*/
|
|
101
|
-
success?: UnLinkSuccessCallback | null,
|
|
102
|
-
/**
|
|
103
|
-
* 接口调用失败的回调函数
|
|
104
|
-
*/
|
|
105
|
-
fail?: FileManagerFailCallback | null,
|
|
106
|
-
/**
|
|
107
|
-
* 接口调用结束的回调函数(调用成功、失败都会执行)
|
|
108
|
-
*/
|
|
109
|
-
complete?: FileManagerCompleteCallback | null
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
export type MkDirSuccessCallback = (res: FileManagerSuccessResult) => void
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
export type MkDirOptions = {
|
|
118
|
-
/**
|
|
119
|
-
* 创建的目录路径 (本地路径)
|
|
120
|
-
*/
|
|
121
|
-
dirPath: string.URIString,
|
|
122
|
-
/**
|
|
123
|
-
*是否在递归创建该目录的上级目录后再创建该目录。如果对应的上级目录已经存在,则不创建该上级目录。如 dirPath 为 a/b/c/d 且 recursive 为 true,将创建 a 目录,再在 a 目录下创建 b 目录,以此类推直至创建 a/b/c 目录下的 d 目录。
|
|
124
|
-
*/
|
|
125
|
-
recursive: boolean,
|
|
126
|
-
/**
|
|
127
|
-
* 接口调用的回调函数
|
|
128
|
-
*/
|
|
129
|
-
success?: MkDirSuccessCallback | null,
|
|
130
|
-
/**
|
|
131
|
-
* 接口调用失败的回调函数
|
|
132
|
-
*/
|
|
133
|
-
fail?: FileManagerFailCallback | null,
|
|
134
|
-
/**
|
|
135
|
-
* 接口调用结束的回调函数(调用成功、失败都会执行)
|
|
136
|
-
*/
|
|
137
|
-
complete?: FileManagerCompleteCallback | null
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
export type RmDirSuccessCallback = (res: FileManagerSuccessResult) => void
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
export type RmDirOptions = {
|
|
147
|
-
/**
|
|
148
|
-
* 要删除的目录路径 (本地路径)
|
|
149
|
-
*/
|
|
150
|
-
dirPath: string.URIString,
|
|
151
|
-
/**
|
|
152
|
-
*是否递归删除目录。如果为 true,则删除该目录和该目录下的所有子目录以及文件。
|
|
153
|
-
*/
|
|
154
|
-
recursive: boolean,
|
|
155
|
-
/**
|
|
156
|
-
* 接口调用的回调函数
|
|
157
|
-
*/
|
|
158
|
-
success?: MkDirSuccessCallback | null,
|
|
159
|
-
/**
|
|
160
|
-
* 接口调用失败的回调函数
|
|
161
|
-
*/
|
|
162
|
-
fail?: FileManagerFailCallback | null,
|
|
163
|
-
/**
|
|
164
|
-
* 接口调用结束的回调函数(调用成功、失败都会执行)
|
|
165
|
-
*/
|
|
166
|
-
complete?: FileManagerCompleteCallback | null
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
export type ReadDirSuccessResult = {
|
|
171
|
-
files: string[],
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
export type ReadDirSuccessCallback = (res: ReadDirSuccessResult) => void
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
export type ReadDirOptions = {
|
|
178
|
-
/**
|
|
179
|
-
* 要读取的目录路径 (本地路径)
|
|
180
|
-
*/
|
|
181
|
-
dirPath: string.URIString,
|
|
182
|
-
|
|
183
|
-
/**
|
|
184
|
-
* 接口调用的回调函数
|
|
185
|
-
*/
|
|
186
|
-
success?: ReadDirSuccessCallback | null,
|
|
187
|
-
/**
|
|
188
|
-
* 接口调用失败的回调函数
|
|
189
|
-
*/
|
|
190
|
-
fail?: FileManagerFailCallback | null,
|
|
191
|
-
/**
|
|
192
|
-
* 接口调用结束的回调函数(调用成功、失败都会执行)
|
|
193
|
-
*/
|
|
194
|
-
complete?: FileManagerCompleteCallback | null
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
export type AccessOptions = {
|
|
201
|
-
/**
|
|
202
|
-
* 要删除的目录路径 (本地路径)
|
|
203
|
-
*/
|
|
204
|
-
path: string.URIString,
|
|
205
|
-
|
|
206
|
-
/**
|
|
207
|
-
* 接口调用的回调函数
|
|
208
|
-
*/
|
|
209
|
-
success?: FileManagerSuccessCallback | null,
|
|
210
|
-
/**
|
|
211
|
-
* 接口调用失败的回调函数
|
|
212
|
-
*/
|
|
213
|
-
fail?: FileManagerFailCallback | null,
|
|
214
|
-
/**
|
|
215
|
-
* 接口调用结束的回调函数(调用成功、失败都会执行)
|
|
216
|
-
*/
|
|
217
|
-
complete?: FileManagerCompleteCallback | null
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
export type RenameOptions = {
|
|
221
|
-
/**
|
|
222
|
-
* 源文件路径,支持本地路径
|
|
223
|
-
*/
|
|
224
|
-
oldPath: string.URIString,
|
|
225
|
-
/**
|
|
226
|
-
* 新文件路径,支持本地路径
|
|
227
|
-
*/
|
|
228
|
-
newPath: string.URIString,
|
|
229
|
-
|
|
230
|
-
/**
|
|
231
|
-
* 接口调用的回调函数
|
|
232
|
-
*/
|
|
233
|
-
success?: FileManagerSuccessCallback | null,
|
|
234
|
-
/**
|
|
235
|
-
* 接口调用失败的回调函数
|
|
236
|
-
*/
|
|
237
|
-
fail?: FileManagerFailCallback | null,
|
|
238
|
-
/**
|
|
239
|
-
* 接口调用结束的回调函数(调用成功、失败都会执行)
|
|
240
|
-
*/
|
|
241
|
-
complete?: FileManagerCompleteCallback | null
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
export type CopyFileOptions = {
|
|
245
|
-
/**
|
|
246
|
-
* 源文件路径,支持本地路径
|
|
247
|
-
*/
|
|
248
|
-
srcPath: string.URIString,
|
|
249
|
-
/**
|
|
250
|
-
* 新文件路径,支持本地路径
|
|
251
|
-
*/
|
|
252
|
-
destPath: string.URIString,
|
|
253
|
-
|
|
254
|
-
/**
|
|
255
|
-
* 接口调用的回调函数
|
|
256
|
-
*/
|
|
257
|
-
success?: FileManagerSuccessCallback | null,
|
|
258
|
-
/**
|
|
259
|
-
* 接口调用失败的回调函数
|
|
260
|
-
*/
|
|
261
|
-
fail?: FileManagerFailCallback | null,
|
|
262
|
-
/**
|
|
263
|
-
* 接口调用结束的回调函数(调用成功、失败都会执行)
|
|
264
|
-
*/
|
|
265
|
-
complete?: FileManagerCompleteCallback | null
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
export type GetFileInfoSuccessResult = {
|
|
270
|
-
digest: string,
|
|
271
|
-
size:number,
|
|
272
|
-
errMsg:string
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
export type GetFileInfoSuccessCallback = (res: GetFileInfoSuccessResult) => void
|
|
276
|
-
|
|
277
|
-
export type GetFileInfoOptions = {
|
|
278
|
-
/**
|
|
279
|
-
* 要读取的文件路径 (本地路径)
|
|
280
|
-
*/
|
|
281
|
-
filePath: string.URIString,
|
|
282
|
-
/**
|
|
283
|
-
* md5 / sha1
|
|
284
|
-
*/
|
|
285
|
-
digestAlgorithm: "md5" | "sha1" | null,
|
|
286
|
-
/**
|
|
287
|
-
* 接口调用的回调函数
|
|
288
|
-
*/
|
|
289
|
-
success?: GetFileInfoSuccessCallback | null,
|
|
290
|
-
/**
|
|
291
|
-
* 接口调用失败的回调函数
|
|
292
|
-
*/
|
|
293
|
-
fail?: FileManagerFailCallback | null,
|
|
294
|
-
/**
|
|
295
|
-
* 接口调用结束的回调函数(调用成功、失败都会执行)
|
|
296
|
-
*/
|
|
297
|
-
complete?: FileManagerCompleteCallback | null
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
export class Stats implements io.dcloud.uts.log.LogSelf,io.dcloud.uts.json.IJsonStringify{
|
|
302
|
-
mode: number = 0;
|
|
303
|
-
size: number = 0;
|
|
304
|
-
lastAccessedTime: number = 0;
|
|
305
|
-
lastModifiedTime: number = 0;
|
|
306
|
-
|
|
307
|
-
mIsFile:boolean = false
|
|
308
|
-
constructor(){
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
isDirectory():boolean{
|
|
312
|
-
return !this.mIsFile
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
isFile():boolean{
|
|
316
|
-
return this.mIsFile
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
override toLog():any|null{
|
|
320
|
-
return this.toJSON()
|
|
321
|
-
}
|
|
322
|
-
override toJSON():any|null{
|
|
323
|
-
let jsonRet = new UTSJSONObject()
|
|
324
|
-
jsonRet.set("mode",this.mode)
|
|
325
|
-
jsonRet.set("size",this.size)
|
|
326
|
-
jsonRet.set("lastAccessedTime",this.lastAccessedTime)
|
|
327
|
-
jsonRet.set("lastModifiedTime",this.lastModifiedTime)
|
|
328
|
-
return jsonRet
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
export type FileStats = {
|
|
334
|
-
path: string,
|
|
335
|
-
stats:Stats,
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
export type StatSuccessResult = {
|
|
339
|
-
errMsg: string,
|
|
340
|
-
stats:FileStats[]
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
export type StatSuccessCallback = (res: StatSuccessResult) => void
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
export type StatOptions = {
|
|
348
|
-
/**
|
|
349
|
-
* 文件/目录路径 (本地路径)
|
|
350
|
-
*/
|
|
351
|
-
path: string.URIString,
|
|
352
|
-
/**
|
|
353
|
-
* 是否递归获取目录下的每个文件的 Stats 信息
|
|
354
|
-
*/
|
|
355
|
-
recursive: boolean,
|
|
356
|
-
/**
|
|
357
|
-
* 接口调用的回调函数
|
|
358
|
-
*/
|
|
359
|
-
success?: StatSuccessCallback | null,
|
|
360
|
-
/**
|
|
361
|
-
* 接口调用失败的回调函数
|
|
362
|
-
*/
|
|
363
|
-
fail?: FileManagerFailCallback | null,
|
|
364
|
-
/**
|
|
365
|
-
* 接口调用结束的回调函数(调用成功、失败都会执行)
|
|
366
|
-
*/
|
|
367
|
-
complete?: FileManagerCompleteCallback | null
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
export interface FileSystemManager {
|
|
372
|
-
readFile(options: ReadFileOptions): void;
|
|
373
|
-
// readFileSync(filePath: string,encoding:string): string|null;
|
|
374
|
-
writeFile(options: WriteFileOptions): void;
|
|
375
|
-
// writeFileSync(filePath: string,data:string): number;
|
|
376
|
-
unlink(options: UnLinkOptions): void;
|
|
377
|
-
// unlinkSync(filePath: string): number;
|
|
378
|
-
mkdir(options: MkDirOptions): void;
|
|
379
|
-
// mkdirSync(dirPath: string,recursive:boolean): number;
|
|
380
|
-
rmdir(options: RmDirOptions): void;
|
|
381
|
-
// rmdirSync(dirPath: string,recursive:boolean): number;
|
|
382
|
-
readdir(options: ReadDirOptions): void;
|
|
383
|
-
// readdirSync(dirPath: string): string[] | null;
|
|
384
|
-
access(options: AccessOptions): void;
|
|
385
|
-
// accessSync(path: string): number;
|
|
386
|
-
rename(options: RenameOptions): void;
|
|
387
|
-
// renameSync(oldPath:string,newPath:string): number;
|
|
388
|
-
copyFile(options: CopyFileOptions): void;
|
|
389
|
-
// copyFileSync(srcPath:string,destPath:string): number;
|
|
390
|
-
getFileInfo(options: GetFileInfoOptions): void;
|
|
391
|
-
//获取文件 Stats 对象
|
|
392
|
-
stat(options: StatOptions): void;
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
export type GetFileSystemManager = () => FileSystemManager;
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
export interface Uni {
|
|
400
|
-
/**
|
|
401
|
-
* 获取文件管理器
|
|
402
|
-
* @uniPlatform {
|
|
403
|
-
* "app": {
|
|
404
|
-
* "android": {
|
|
405
|
-
* "osVer": "5.0",
|
|
406
|
-
* "uniVer": "x",
|
|
407
|
-
* "unixVer": "3.9.0"
|
|
408
|
-
* },
|
|
409
|
-
* "ios": {
|
|
410
|
-
* "osVer": "x",
|
|
411
|
-
* "uniVer": "x",
|
|
412
|
-
* "unixVer": "x"
|
|
413
|
-
* }
|
|
414
|
-
* },
|
|
415
|
-
* "web": {
|
|
416
|
-
* "uniVer": "x",
|
|
417
|
-
* "unixVer": "x"
|
|
418
|
-
* }
|
|
419
|
-
* }
|
|
420
|
-
* @uniVueVersion 2,3 //支持的vue版本
|
|
421
|
-
*/
|
|
422
|
-
getFileSystemManager():FileSystemManager
|
|
423
|
-
}
|
|
1
|
+
|
|
2
|
+
export type ReadFileSuccessResult = {
|
|
3
|
+
data: string
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* 通用的正确返回结果
|
|
9
|
+
*/
|
|
10
|
+
export type FileManagerSuccessResult = {
|
|
11
|
+
errMsg: string,
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* 通用的正确返回结果回调
|
|
15
|
+
*/
|
|
16
|
+
export type FileManagerSuccessCallback = (res: FileManagerSuccessResult) => void
|
|
17
|
+
/**
|
|
18
|
+
* 通用的错误返回结果回调
|
|
19
|
+
*/
|
|
20
|
+
export type FileManagerFailCallback = (res: UniError) => void
|
|
21
|
+
/**
|
|
22
|
+
* 通用的结束返回结果回调
|
|
23
|
+
*/
|
|
24
|
+
export type FileManagerCompleteCallback = (res: any) => void
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
export type ReadFileSuccessCallback = (res: ReadFileSuccessResult) => void
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
export type ReadFileOptions = {
|
|
33
|
+
/**
|
|
34
|
+
* base64 / utf-8
|
|
35
|
+
*/
|
|
36
|
+
encoding: "base64" | "utf-8",
|
|
37
|
+
/**
|
|
38
|
+
* 文件路径,支持相对地址和绝对地址
|
|
39
|
+
*/
|
|
40
|
+
filePath: string.URIString,
|
|
41
|
+
/**
|
|
42
|
+
* 接口调用的回调函数
|
|
43
|
+
*/
|
|
44
|
+
success?: ReadFileSuccessCallback | null,
|
|
45
|
+
/**
|
|
46
|
+
* 接口调用失败的回调函数
|
|
47
|
+
*/
|
|
48
|
+
fail?: FileManagerFailCallback | null,
|
|
49
|
+
/**
|
|
50
|
+
* 接口调用结束的回调函数(调用成功、失败都会执行)
|
|
51
|
+
*/
|
|
52
|
+
complete?: FileManagerCompleteCallback | null
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
export type WriteFileOptions = {
|
|
60
|
+
/**
|
|
61
|
+
* 文件路径,只支持绝对地址
|
|
62
|
+
*/
|
|
63
|
+
filePath: string.URIString,
|
|
64
|
+
/**
|
|
65
|
+
* 指定写入文件的字符编码
|
|
66
|
+
* 支持:ascii base64 utf-8
|
|
67
|
+
*/
|
|
68
|
+
encoding: "ascii" | "base64" | "utf-8",
|
|
69
|
+
/**
|
|
70
|
+
* 写入的文本内容
|
|
71
|
+
*/
|
|
72
|
+
data: string,
|
|
73
|
+
/**
|
|
74
|
+
* 接口调用的回调函数
|
|
75
|
+
*/
|
|
76
|
+
success?: FileManagerSuccessCallback | null,
|
|
77
|
+
/**
|
|
78
|
+
* 接口调用失败的回调函数
|
|
79
|
+
*/
|
|
80
|
+
fail?: FileManagerFailCallback | null,
|
|
81
|
+
/**
|
|
82
|
+
* 接口调用结束的回调函数(调用成功、失败都会执行)
|
|
83
|
+
*/
|
|
84
|
+
complete?: FileManagerCompleteCallback | null
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
export type UnLinkSuccessCallback = (res: FileManagerSuccessResult) => void
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
export type UnLinkOptions = {
|
|
94
|
+
/**
|
|
95
|
+
* 文件路径,只支持绝对地址
|
|
96
|
+
*/
|
|
97
|
+
filePath: string.URIString,
|
|
98
|
+
/**
|
|
99
|
+
* 接口调用的回调函数
|
|
100
|
+
*/
|
|
101
|
+
success?: UnLinkSuccessCallback | null,
|
|
102
|
+
/**
|
|
103
|
+
* 接口调用失败的回调函数
|
|
104
|
+
*/
|
|
105
|
+
fail?: FileManagerFailCallback | null,
|
|
106
|
+
/**
|
|
107
|
+
* 接口调用结束的回调函数(调用成功、失败都会执行)
|
|
108
|
+
*/
|
|
109
|
+
complete?: FileManagerCompleteCallback | null
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export type MkDirSuccessCallback = (res: FileManagerSuccessResult) => void
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
export type MkDirOptions = {
|
|
118
|
+
/**
|
|
119
|
+
* 创建的目录路径 (本地路径)
|
|
120
|
+
*/
|
|
121
|
+
dirPath: string.URIString,
|
|
122
|
+
/**
|
|
123
|
+
*是否在递归创建该目录的上级目录后再创建该目录。如果对应的上级目录已经存在,则不创建该上级目录。如 dirPath 为 a/b/c/d 且 recursive 为 true,将创建 a 目录,再在 a 目录下创建 b 目录,以此类推直至创建 a/b/c 目录下的 d 目录。
|
|
124
|
+
*/
|
|
125
|
+
recursive: boolean,
|
|
126
|
+
/**
|
|
127
|
+
* 接口调用的回调函数
|
|
128
|
+
*/
|
|
129
|
+
success?: MkDirSuccessCallback | null,
|
|
130
|
+
/**
|
|
131
|
+
* 接口调用失败的回调函数
|
|
132
|
+
*/
|
|
133
|
+
fail?: FileManagerFailCallback | null,
|
|
134
|
+
/**
|
|
135
|
+
* 接口调用结束的回调函数(调用成功、失败都会执行)
|
|
136
|
+
*/
|
|
137
|
+
complete?: FileManagerCompleteCallback | null
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
export type RmDirSuccessCallback = (res: FileManagerSuccessResult) => void
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
export type RmDirOptions = {
|
|
147
|
+
/**
|
|
148
|
+
* 要删除的目录路径 (本地路径)
|
|
149
|
+
*/
|
|
150
|
+
dirPath: string.URIString,
|
|
151
|
+
/**
|
|
152
|
+
*是否递归删除目录。如果为 true,则删除该目录和该目录下的所有子目录以及文件。
|
|
153
|
+
*/
|
|
154
|
+
recursive: boolean,
|
|
155
|
+
/**
|
|
156
|
+
* 接口调用的回调函数
|
|
157
|
+
*/
|
|
158
|
+
success?: MkDirSuccessCallback | null,
|
|
159
|
+
/**
|
|
160
|
+
* 接口调用失败的回调函数
|
|
161
|
+
*/
|
|
162
|
+
fail?: FileManagerFailCallback | null,
|
|
163
|
+
/**
|
|
164
|
+
* 接口调用结束的回调函数(调用成功、失败都会执行)
|
|
165
|
+
*/
|
|
166
|
+
complete?: FileManagerCompleteCallback | null
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
export type ReadDirSuccessResult = {
|
|
171
|
+
files: string[],
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
export type ReadDirSuccessCallback = (res: ReadDirSuccessResult) => void
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
export type ReadDirOptions = {
|
|
178
|
+
/**
|
|
179
|
+
* 要读取的目录路径 (本地路径)
|
|
180
|
+
*/
|
|
181
|
+
dirPath: string.URIString,
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* 接口调用的回调函数
|
|
185
|
+
*/
|
|
186
|
+
success?: ReadDirSuccessCallback | null,
|
|
187
|
+
/**
|
|
188
|
+
* 接口调用失败的回调函数
|
|
189
|
+
*/
|
|
190
|
+
fail?: FileManagerFailCallback | null,
|
|
191
|
+
/**
|
|
192
|
+
* 接口调用结束的回调函数(调用成功、失败都会执行)
|
|
193
|
+
*/
|
|
194
|
+
complete?: FileManagerCompleteCallback | null
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
export type AccessOptions = {
|
|
201
|
+
/**
|
|
202
|
+
* 要删除的目录路径 (本地路径)
|
|
203
|
+
*/
|
|
204
|
+
path: string.URIString,
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* 接口调用的回调函数
|
|
208
|
+
*/
|
|
209
|
+
success?: FileManagerSuccessCallback | null,
|
|
210
|
+
/**
|
|
211
|
+
* 接口调用失败的回调函数
|
|
212
|
+
*/
|
|
213
|
+
fail?: FileManagerFailCallback | null,
|
|
214
|
+
/**
|
|
215
|
+
* 接口调用结束的回调函数(调用成功、失败都会执行)
|
|
216
|
+
*/
|
|
217
|
+
complete?: FileManagerCompleteCallback | null
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
export type RenameOptions = {
|
|
221
|
+
/**
|
|
222
|
+
* 源文件路径,支持本地路径
|
|
223
|
+
*/
|
|
224
|
+
oldPath: string.URIString,
|
|
225
|
+
/**
|
|
226
|
+
* 新文件路径,支持本地路径
|
|
227
|
+
*/
|
|
228
|
+
newPath: string.URIString,
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* 接口调用的回调函数
|
|
232
|
+
*/
|
|
233
|
+
success?: FileManagerSuccessCallback | null,
|
|
234
|
+
/**
|
|
235
|
+
* 接口调用失败的回调函数
|
|
236
|
+
*/
|
|
237
|
+
fail?: FileManagerFailCallback | null,
|
|
238
|
+
/**
|
|
239
|
+
* 接口调用结束的回调函数(调用成功、失败都会执行)
|
|
240
|
+
*/
|
|
241
|
+
complete?: FileManagerCompleteCallback | null
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
export type CopyFileOptions = {
|
|
245
|
+
/**
|
|
246
|
+
* 源文件路径,支持本地路径
|
|
247
|
+
*/
|
|
248
|
+
srcPath: string.URIString,
|
|
249
|
+
/**
|
|
250
|
+
* 新文件路径,支持本地路径
|
|
251
|
+
*/
|
|
252
|
+
destPath: string.URIString,
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* 接口调用的回调函数
|
|
256
|
+
*/
|
|
257
|
+
success?: FileManagerSuccessCallback | null,
|
|
258
|
+
/**
|
|
259
|
+
* 接口调用失败的回调函数
|
|
260
|
+
*/
|
|
261
|
+
fail?: FileManagerFailCallback | null,
|
|
262
|
+
/**
|
|
263
|
+
* 接口调用结束的回调函数(调用成功、失败都会执行)
|
|
264
|
+
*/
|
|
265
|
+
complete?: FileManagerCompleteCallback | null
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
export type GetFileInfoSuccessResult = {
|
|
270
|
+
digest: string,
|
|
271
|
+
size:number,
|
|
272
|
+
errMsg:string
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
export type GetFileInfoSuccessCallback = (res: GetFileInfoSuccessResult) => void
|
|
276
|
+
|
|
277
|
+
export type GetFileInfoOptions = {
|
|
278
|
+
/**
|
|
279
|
+
* 要读取的文件路径 (本地路径)
|
|
280
|
+
*/
|
|
281
|
+
filePath: string.URIString,
|
|
282
|
+
/**
|
|
283
|
+
* md5 / sha1
|
|
284
|
+
*/
|
|
285
|
+
digestAlgorithm: "md5" | "sha1" | null,
|
|
286
|
+
/**
|
|
287
|
+
* 接口调用的回调函数
|
|
288
|
+
*/
|
|
289
|
+
success?: GetFileInfoSuccessCallback | null,
|
|
290
|
+
/**
|
|
291
|
+
* 接口调用失败的回调函数
|
|
292
|
+
*/
|
|
293
|
+
fail?: FileManagerFailCallback | null,
|
|
294
|
+
/**
|
|
295
|
+
* 接口调用结束的回调函数(调用成功、失败都会执行)
|
|
296
|
+
*/
|
|
297
|
+
complete?: FileManagerCompleteCallback | null
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
|
|
301
|
+
export class Stats implements io.dcloud.uts.log.LogSelf,io.dcloud.uts.json.IJsonStringify{
|
|
302
|
+
mode: number = 0;
|
|
303
|
+
size: number = 0;
|
|
304
|
+
lastAccessedTime: number = 0;
|
|
305
|
+
lastModifiedTime: number = 0;
|
|
306
|
+
|
|
307
|
+
mIsFile:boolean = false
|
|
308
|
+
constructor(){
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
isDirectory():boolean{
|
|
312
|
+
return !this.mIsFile
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
isFile():boolean{
|
|
316
|
+
return this.mIsFile
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
override toLog():any|null{
|
|
320
|
+
return this.toJSON()
|
|
321
|
+
}
|
|
322
|
+
override toJSON():any|null{
|
|
323
|
+
let jsonRet = new UTSJSONObject()
|
|
324
|
+
jsonRet.set("mode",this.mode)
|
|
325
|
+
jsonRet.set("size",this.size)
|
|
326
|
+
jsonRet.set("lastAccessedTime",this.lastAccessedTime)
|
|
327
|
+
jsonRet.set("lastModifiedTime",this.lastModifiedTime)
|
|
328
|
+
return jsonRet
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
|
|
333
|
+
export type FileStats = {
|
|
334
|
+
path: string,
|
|
335
|
+
stats:Stats,
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
export type StatSuccessResult = {
|
|
339
|
+
errMsg: string,
|
|
340
|
+
stats:FileStats[]
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
|
|
344
|
+
export type StatSuccessCallback = (res: StatSuccessResult) => void
|
|
345
|
+
|
|
346
|
+
|
|
347
|
+
export type StatOptions = {
|
|
348
|
+
/**
|
|
349
|
+
* 文件/目录路径 (本地路径)
|
|
350
|
+
*/
|
|
351
|
+
path: string.URIString,
|
|
352
|
+
/**
|
|
353
|
+
* 是否递归获取目录下的每个文件的 Stats 信息
|
|
354
|
+
*/
|
|
355
|
+
recursive: boolean,
|
|
356
|
+
/**
|
|
357
|
+
* 接口调用的回调函数
|
|
358
|
+
*/
|
|
359
|
+
success?: StatSuccessCallback | null,
|
|
360
|
+
/**
|
|
361
|
+
* 接口调用失败的回调函数
|
|
362
|
+
*/
|
|
363
|
+
fail?: FileManagerFailCallback | null,
|
|
364
|
+
/**
|
|
365
|
+
* 接口调用结束的回调函数(调用成功、失败都会执行)
|
|
366
|
+
*/
|
|
367
|
+
complete?: FileManagerCompleteCallback | null
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
|
|
371
|
+
export interface FileSystemManager {
|
|
372
|
+
readFile(options: ReadFileOptions): void;
|
|
373
|
+
// readFileSync(filePath: string,encoding:string): string|null;
|
|
374
|
+
writeFile(options: WriteFileOptions): void;
|
|
375
|
+
// writeFileSync(filePath: string,data:string): number;
|
|
376
|
+
unlink(options: UnLinkOptions): void;
|
|
377
|
+
// unlinkSync(filePath: string): number;
|
|
378
|
+
mkdir(options: MkDirOptions): void;
|
|
379
|
+
// mkdirSync(dirPath: string,recursive:boolean): number;
|
|
380
|
+
rmdir(options: RmDirOptions): void;
|
|
381
|
+
// rmdirSync(dirPath: string,recursive:boolean): number;
|
|
382
|
+
readdir(options: ReadDirOptions): void;
|
|
383
|
+
// readdirSync(dirPath: string): string[] | null;
|
|
384
|
+
access(options: AccessOptions): void;
|
|
385
|
+
// accessSync(path: string): number;
|
|
386
|
+
rename(options: RenameOptions): void;
|
|
387
|
+
// renameSync(oldPath:string,newPath:string): number;
|
|
388
|
+
copyFile(options: CopyFileOptions): void;
|
|
389
|
+
// copyFileSync(srcPath:string,destPath:string): number;
|
|
390
|
+
getFileInfo(options: GetFileInfoOptions): void;
|
|
391
|
+
//获取文件 Stats 对象
|
|
392
|
+
stat(options: StatOptions): void;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
|
|
396
|
+
export type GetFileSystemManager = () => FileSystemManager;
|
|
397
|
+
|
|
398
|
+
|
|
399
|
+
export interface Uni {
|
|
400
|
+
/**
|
|
401
|
+
* 获取文件管理器
|
|
402
|
+
* @uniPlatform {
|
|
403
|
+
* "app": {
|
|
404
|
+
* "android": {
|
|
405
|
+
* "osVer": "5.0",
|
|
406
|
+
* "uniVer": "x",
|
|
407
|
+
* "unixVer": "3.9.0"
|
|
408
|
+
* },
|
|
409
|
+
* "ios": {
|
|
410
|
+
* "osVer": "x",
|
|
411
|
+
* "uniVer": "x",
|
|
412
|
+
* "unixVer": "x"
|
|
413
|
+
* }
|
|
414
|
+
* },
|
|
415
|
+
* "web": {
|
|
416
|
+
* "uniVer": "x",
|
|
417
|
+
* "unixVer": "x"
|
|
418
|
+
* }
|
|
419
|
+
* }
|
|
420
|
+
* @uniVueVersion 2,3 //支持的vue版本
|
|
421
|
+
*/
|
|
422
|
+
getFileSystemManager():FileSystemManager
|
|
423
|
+
}
|