@dcloudio/uni-app-x 0.7.11 → 0.7.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (238) hide show
  1. package/.prettierrc +5 -0
  2. package/README.md +1 -1
  3. package/index.d.ts +1 -1
  4. package/options.d.ts +9 -9
  5. package/package.json +27 -27
  6. package/types/app.d.ts +843 -843
  7. package/types/index.d.ts +7 -7
  8. package/types/native/AsyncApiResult.d.ts +7 -7
  9. package/types/native/CSSStyleDeclaration.d.ts +25 -25
  10. package/types/native/DOMRect.d.ts +56 -56
  11. package/types/native/DrawableContext.d.ts +162 -162
  12. package/types/native/INavigationBar.d.ts +22 -22
  13. package/types/native/IUniElement.d.ts +760 -777
  14. package/types/native/IUniError.d.ts +20 -20
  15. package/types/native/IUniForm.d.ts +9 -9
  16. package/types/native/NativeLoadFontFaceOptions.d.ts +11 -11
  17. package/types/native/NodeData.d.ts +22 -22
  18. package/types/native/PageNode.d.ts +6 -6
  19. package/types/native/SnapshotOptions.d.ts +63 -63
  20. package/types/native/SourceError.d.ts +46 -46
  21. package/types/native/UTSAndroidHookProxy.d.ts +14 -14
  22. package/types/native/UniAggregateError.d.ts +19 -19
  23. package/types/native/UniApp.d.ts +79 -66
  24. package/types/native/UniCallbackWrapper.d.ts +7 -7
  25. package/types/native/UniCustomEvent.d.ts +24 -24
  26. package/types/native/UniDocument.d.ts +83 -35
  27. package/types/native/UniElement.d.ts +74 -74
  28. package/types/native/UniError.d.ts +70 -70
  29. package/types/native/UniEvent.d.ts +62 -62
  30. package/types/native/UniFormControl.d.ts +8 -8
  31. package/types/native/UniFormControlElement.d.ts +14 -14
  32. package/types/native/UniImageErrorEvent.d.ts +33 -33
  33. package/types/native/UniImageLoadEvent.d.ts +37 -37
  34. package/types/native/UniInputBlurEvent.d.ts +36 -36
  35. package/types/native/UniInputConfirmEvent.d.ts +30 -30
  36. package/types/native/UniInputEvent.d.ts +38 -38
  37. package/types/native/UniInputFocusEvent.d.ts +53 -48
  38. package/types/native/UniNativePage.d.ts +219 -156
  39. package/types/native/UniNestedPreScrollEvent.d.ts +3 -4
  40. package/types/native/UniPageEvent.d.ts +10 -10
  41. package/types/native/UniPageManager.d.ts +17 -17
  42. package/types/native/UniPageScrollEvent.d.ts +13 -13
  43. package/types/native/UniPointerEvent.d.ts +74 -74
  44. package/types/native/UniRefresherEvent.d.ts +18 -18
  45. package/types/native/UniResizeEvent.d.ts +34 -34
  46. package/types/native/UniResizeObserver.d.ts +184 -0
  47. package/types/native/UniRichTextItemClickEvent.d.ts +41 -41
  48. package/types/native/UniScrollEvent.d.ts +42 -42
  49. package/types/native/UniScrollToLowerEvent.d.ts +23 -23
  50. package/types/native/UniScrollToUpperEvent.d.ts +23 -23
  51. package/types/native/UniStartNestedScrollEvent.d.ts +33 -33
  52. package/types/native/UniStopNestedScrollEvent.d.ts +28 -28
  53. package/types/native/UniSwiperAnimationFinishEvent.d.ts +22 -22
  54. package/types/native/UniSwiperChangeEvent.d.ts +22 -22
  55. package/types/native/UniSwiperTransitionEvent.d.ts +24 -24
  56. package/types/native/UniTabTapEvent.d.ts +18 -18
  57. package/types/native/UniTabsElement.d.ts +59 -29
  58. package/types/native/UniTextElement.d.ts +34 -17
  59. package/types/native/UniTextareaFocusEvent.d.ts +54 -49
  60. package/types/native/UniTouchEvent.d.ts +64 -64
  61. package/types/native/UniVideoElement.d.ts +70 -70
  62. package/types/native/UniWebViewDownloadEvent.d.ts +52 -52
  63. package/types/native/UniWebViewElement.d.ts +10 -10
  64. package/types/native/UniWebViewErrorEvent.d.ts +59 -47
  65. package/types/native/UniWebViewLoadEvent.d.ts +41 -36
  66. package/types/native/UniWebViewLoadingEvent.d.ts +41 -36
  67. package/types/native/UniWebViewMessageEvent.d.ts +36 -36
  68. package/types/native/UniWebViewServiceMessageEvent.d.ts +8 -8
  69. package/types/native/ViewToTempFilePathOptions.d.ts +47 -47
  70. package/types/native/WebViewStyles.d.ts +20 -20
  71. package/types/native/global.d.ts +530 -519
  72. package/types/native/index.d.ts +66 -65
  73. package/types/native-global/index.d.ts +1 -1
  74. package/types/page.d.ts +1593 -1593
  75. package/types/process.d.ts +5 -5
  76. package/types/uni/base/index.d.ts +3 -3
  77. package/types/uni/env/index.d.ts +64 -64
  78. package/types/uni/global.d.ts +5 -6
  79. package/types/uni/index.d.ts +2 -3
  80. package/types/uni/uts-plugin-api/global.d.ts +35 -23
  81. package/types/uni/uts-plugin-api/index.d.ts +35 -23
  82. package/types/uni/uts-plugin-api/lib/uni-createRequestPermissionListener/utssdk/global.d.ts +18 -18
  83. package/types/uni/uts-plugin-api/lib/uni-createRequestPermissionListener/utssdk/index.d.ts +8 -8
  84. package/types/uni/uts-plugin-api/lib/uni-createRequestPermissionListener/utssdk/interface.d.ts +43 -43
  85. package/types/uni/{core/lib/ui/create-selector-query → uts-plugin-api/lib/uni-createSelectorQuery/utssdk}/global.d.ts +20 -20
  86. package/types/uni/{core/lib/ui/create-selector-query → uts-plugin-api/lib/uni-createSelectorQuery/utssdk}/index.d.ts +9 -9
  87. package/types/uni/uts-plugin-api/lib/uni-createSelectorQuery/utssdk/interface.d.ts +412 -0
  88. package/types/uni/uts-plugin-api/lib/uni-createWebviewContext/utssdk/global.d.ts +12 -12
  89. package/types/uni/uts-plugin-api/lib/uni-createWebviewContext/utssdk/index.d.ts +5 -5
  90. package/types/uni/uts-plugin-api/lib/uni-createWebviewContext/utssdk/interface.d.ts +129 -99
  91. package/types/uni/{core/lib/base/event → uts-plugin-api/lib/uni-event/utssdk}/global.d.ts +16 -16
  92. package/types/uni/{core/lib/base/event → uts-plugin-api/lib/uni-event/utssdk}/index.d.ts +7 -7
  93. package/types/uni/uts-plugin-api/lib/uni-event/utssdk/interface.d.ts +277 -0
  94. package/types/uni/uts-plugin-api/lib/uni-exit/utssdk/global.d.ts +26 -26
  95. package/types/uni/uts-plugin-api/lib/uni-exit/utssdk/index.d.ts +12 -12
  96. package/types/uni/uts-plugin-api/lib/uni-exit/utssdk/interface.d.ts +82 -82
  97. package/types/uni/uts-plugin-api/lib/uni-fileSystemManager/utssdk/global.d.ts +136 -66
  98. package/types/uni/uts-plugin-api/lib/uni-fileSystemManager/utssdk/index.d.ts +67 -32
  99. package/types/uni/uts-plugin-api/lib/uni-fileSystemManager/utssdk/interface.d.ts +1784 -423
  100. package/types/uni/uts-plugin-api/lib/uni-getAccessibilityInfo/utssdk/global.d.ts +10 -10
  101. package/types/uni/uts-plugin-api/lib/uni-getAccessibilityInfo/utssdk/index.d.ts +4 -4
  102. package/types/uni/uts-plugin-api/lib/uni-getAppAuthorizeSetting/utssdk/global.d.ts +12 -12
  103. package/types/uni/uts-plugin-api/lib/uni-getAppAuthorizeSetting/utssdk/index.d.ts +5 -5
  104. package/types/uni/uts-plugin-api/lib/uni-getAppAuthorizeSetting/utssdk/interface.d.ts +116 -112
  105. package/types/uni/uts-plugin-api/lib/uni-getAppBaseInfo/utssdk/global.d.ts +14 -14
  106. package/types/uni/uts-plugin-api/lib/uni-getAppBaseInfo/utssdk/index.d.ts +6 -6
  107. package/types/uni/uts-plugin-api/lib/uni-getAppBaseInfo/utssdk/interface.d.ts +398 -350
  108. package/types/uni/uts-plugin-api/lib/uni-getDeviceInfo/utssdk/global.d.ts +14 -14
  109. package/types/uni/uts-plugin-api/lib/uni-getDeviceInfo/utssdk/index.d.ts +6 -6
  110. package/types/uni/uts-plugin-api/lib/uni-getDeviceInfo/utssdk/interface.d.ts +2 -2
  111. package/types/uni/{core/lib/ui/get-element-by-id → uts-plugin-api/lib/uni-getElementById/utssdk}/global.d.ts +10 -10
  112. package/types/uni/{core/lib/ui/get-element-by-id → uts-plugin-api/lib/uni-getElementById/utssdk}/index.d.ts +4 -4
  113. package/types/uni/uts-plugin-api/lib/uni-getElementById/utssdk/interface.d.ts +73 -0
  114. package/types/uni/{core/lib/lifecycle → uts-plugin-api/lib/uni-getLaunchOptionsSync/utssdk}/global.d.ts +12 -10
  115. package/types/uni/{core/lib/lifecycle → uts-plugin-api/lib/uni-getLaunchOptionsSync/utssdk}/index.d.ts +5 -4
  116. package/types/uni/uts-plugin-api/lib/uni-getLaunchOptionsSync/utssdk/interface.d.ts +39 -0
  117. package/types/uni/uts-plugin-api/lib/uni-getLocation-system/utssdk/global.d.ts +20 -20
  118. package/types/uni/uts-plugin-api/lib/uni-getLocation-system/utssdk/index.d.ts +9 -9
  119. package/types/uni/uts-plugin-api/lib/uni-getLocation-system/utssdk/interface.d.ts +151 -151
  120. package/types/uni/uts-plugin-api/lib/uni-getNetworkType/utssdk/global.d.ts +24 -24
  121. package/types/uni/uts-plugin-api/lib/uni-getNetworkType/utssdk/index.d.ts +11 -11
  122. package/types/uni/uts-plugin-api/lib/uni-getNetworkType/utssdk/interface.d.ts +1 -1
  123. package/types/uni/{core/lib/performance → uts-plugin-api/lib/uni-getPerformance/utssdk}/global.d.ts +22 -22
  124. package/types/uni/{core/lib/performance → uts-plugin-api/lib/uni-getPerformance/utssdk}/index.d.ts +10 -10
  125. package/types/uni/uts-plugin-api/lib/uni-getPerformance/utssdk/interface.d.ts +157 -0
  126. package/types/uni/uts-plugin-api/lib/uni-getProvider/utssdk/global.d.ts +24 -24
  127. package/types/uni/uts-plugin-api/lib/uni-getProvider/utssdk/index.d.ts +11 -11
  128. package/types/uni/uts-plugin-api/lib/uni-getProvider/utssdk/interface.d.ts +84 -88
  129. package/types/uni/uts-plugin-api/lib/uni-getSystemInfo/utssdk/global.d.ts +30 -30
  130. package/types/uni/uts-plugin-api/lib/uni-getSystemInfo/utssdk/index.d.ts +14 -14
  131. package/types/uni/uts-plugin-api/lib/uni-getSystemInfo/utssdk/interface.d.ts +35 -35
  132. package/types/uni/uts-plugin-api/lib/uni-getSystemSetting/utssdk/global.d.ts +12 -12
  133. package/types/uni/uts-plugin-api/lib/uni-getSystemSetting/utssdk/index.d.ts +5 -5
  134. package/types/uni/uts-plugin-api/lib/uni-getSystemSetting/utssdk/interface.d.ts +2 -2
  135. package/types/uni/uts-plugin-api/lib/uni-installApk/utssdk/global.d.ts +24 -24
  136. package/types/uni/uts-plugin-api/lib/uni-installApk/utssdk/index.d.ts +11 -11
  137. package/types/uni/{core/lib/base/interceptor → uts-plugin-api/lib/uni-interceptor/utssdk}/global.d.ts +16 -18
  138. package/types/uni/{core/lib/base/interceptor → uts-plugin-api/lib/uni-interceptor/utssdk}/index.d.ts +7 -8
  139. package/types/uni/uts-plugin-api/lib/uni-interceptor/utssdk/interface.d.ts +152 -0
  140. package/types/uni/{core/lib/ui/load-font-face → uts-plugin-api/lib/uni-loadFontFace/utssdk}/global.d.ts +26 -26
  141. package/types/uni/{core/lib/ui/load-font-face → uts-plugin-api/lib/uni-loadFontFace/utssdk}/index.d.ts +12 -12
  142. package/types/uni/uts-plugin-api/lib/uni-loadFontFace/utssdk/interface.d.ts +557 -0
  143. package/types/uni/uts-plugin-api/lib/uni-media/utssdk/global.d.ts +158 -158
  144. package/types/uni/uts-plugin-api/lib/uni-media/utssdk/index.d.ts +78 -78
  145. package/types/uni/uts-plugin-api/lib/uni-media/utssdk/interface.d.ts +926 -906
  146. package/types/uni/{core/lib/ui/set-navigation-bar-color → uts-plugin-api/lib/uni-navigationBar/utssdk}/global.d.ts +44 -28
  147. package/types/uni/{core/lib/ui/set-navigation-bar-color → uts-plugin-api/lib/uni-navigationBar/utssdk}/index.d.ts +21 -13
  148. package/types/uni/uts-plugin-api/lib/uni-navigationBar/utssdk/interface.d.ts +794 -0
  149. package/types/uni/uts-plugin-api/lib/uni-network/utssdk/app-ios/global.d.ts +78 -68
  150. package/types/uni/uts-plugin-api/lib/uni-network/utssdk/app-ios/index.d.ts +38 -33
  151. package/types/uni/uts-plugin-api/lib/uni-network/utssdk/app-ios/interface.d.ts +110 -41
  152. package/types/uni/uts-plugin-api/lib/uni-network/utssdk/global.d.ts +72 -72
  153. package/types/uni/uts-plugin-api/lib/uni-network/utssdk/index.d.ts +35 -35
  154. package/types/uni/uts-plugin-api/lib/uni-network/utssdk/interface.d.ts +48 -31
  155. package/types/uni/uts-plugin-api/lib/uni-openAppAuthorizeSetting/utssdk/global.d.ts +24 -24
  156. package/types/uni/uts-plugin-api/lib/uni-openAppAuthorizeSetting/utssdk/index.d.ts +11 -11
  157. package/types/uni/uts-plugin-api/lib/uni-openAppAuthorizeSetting/utssdk/interface.d.ts +2 -2
  158. package/types/uni/{core/lib/ui/page-scroll-to → uts-plugin-api/lib/uni-pageScrollTo/utssdk}/global.d.ts +24 -26
  159. package/types/uni/{core/lib/ui/page-scroll-to → uts-plugin-api/lib/uni-pageScrollTo/utssdk}/index.d.ts +11 -12
  160. package/types/uni/uts-plugin-api/lib/uni-pageScrollTo/utssdk/interface.d.ts +143 -0
  161. package/types/uni/uts-plugin-api/lib/uni-payment/utssdk/global.d.ts +32 -30
  162. package/types/uni/uts-plugin-api/lib/uni-payment/utssdk/index.d.ts +15 -14
  163. package/types/uni/uts-plugin-api/lib/uni-payment/utssdk/interface.d.ts +2 -1
  164. package/types/uni/uts-plugin-api/lib/uni-prompt/utssdk/global.d.ts +74 -74
  165. package/types/uni/uts-plugin-api/lib/uni-prompt/utssdk/index.d.ts +36 -36
  166. package/types/uni/uts-plugin-api/lib/uni-prompt/utssdk/interface.d.ts +45 -45
  167. package/types/uni/{core/lib/ui/pull-down-refresh → uts-plugin-api/lib/uni-pullDownRefresh/utssdk}/global.d.ts +26 -28
  168. package/types/uni/{core/lib/ui/pull-down-refresh → uts-plugin-api/lib/uni-pullDownRefresh/utssdk}/index.d.ts +12 -13
  169. package/types/uni/uts-plugin-api/lib/uni-pullDownRefresh/utssdk/interface.d.ts +174 -0
  170. package/types/uni/{core/lib/route → uts-plugin-api/lib/uni-route/utssdk}/global.d.ts +58 -68
  171. package/types/uni/{core/lib/route → uts-plugin-api/lib/uni-route/utssdk}/index.d.ts +28 -33
  172. package/types/uni/uts-plugin-api/lib/uni-route/utssdk/interface.d.ts +2020 -0
  173. package/types/uni/uts-plugin-api/lib/uni-rpx2px/utssdk/global.d.ts +10 -10
  174. package/types/uni/uts-plugin-api/lib/uni-rpx2px/utssdk/index.d.ts +4 -4
  175. package/types/uni/uts-plugin-api/lib/uni-rpx2px/utssdk/interface.d.ts +33 -33
  176. package/types/uni/uts-plugin-api/lib/uni-storage/utssdk/global.d.ts +78 -78
  177. package/types/uni/uts-plugin-api/lib/uni-storage/utssdk/index.d.ts +38 -38
  178. package/types/uni/uts-plugin-api/lib/uni-storage/utssdk/interface.d.ts +531 -531
  179. package/types/uni/{core/lib/ui/tab-bar → uts-plugin-api/lib/uni-tabBar/utssdk}/global.d.ts +132 -130
  180. package/types/uni/{core/lib/ui/tab-bar → uts-plugin-api/lib/uni-tabBar/utssdk}/index.d.ts +65 -64
  181. package/types/uni/uts-plugin-api/lib/uni-tabBar/utssdk/interface.d.ts +926 -0
  182. package/types/uni/uts-plugin-api/lib/uni-websocket/utssdk/global.d.ts +58 -58
  183. package/types/uni/uts-plugin-api/lib/uni-websocket/utssdk/index.d.ts +28 -28
  184. package/types/uni/uts-plugin-api/lib/uni-websocket/utssdk/interface.d.ts +78 -78
  185. package/types/uni/uts-plugin-biz/global.d.ts +4 -4
  186. package/types/uni/uts-plugin-biz/index.d.ts +4 -4
  187. package/types/uni/uts-plugin-biz/lib/uni-ad/utssdk/global.d.ts +36 -36
  188. package/types/uni/uts-plugin-biz/lib/uni-ad/utssdk/index.d.ts +17 -17
  189. package/types/uni/uts-plugin-biz/lib/uni-ad/utssdk/interface.d.ts +132 -132
  190. package/types/uni/uts-plugin-biz/lib/uni-facialRecognitionVerify/utssdk/global.d.ts +28 -28
  191. package/types/uni/uts-plugin-biz/lib/uni-facialRecognitionVerify/utssdk/index.d.ts +13 -13
  192. package/types/uni/uts-plugin-biz/lib/uni-facialRecognitionVerify/utssdk/interface.d.ts +141 -141
  193. package/types/uni/uts-plugin-biz/lib/uni-push/utssdk/global.d.ts +56 -56
  194. package/types/uni/uts-plugin-biz/lib/uni-push/utssdk/index.d.ts +27 -27
  195. package/types/uni/uts-plugin-biz/lib/uni-verify/utssdk/global.d.ts +46 -46
  196. package/types/uni/uts-plugin-biz/lib/uni-verify/utssdk/index.d.ts +22 -22
  197. package/types/uni/uts-plugin-biz/lib/uni-verify/utssdk/interface.d.ts +203 -203
  198. package/types/uni/uts-plugin-component/global.d.ts +1 -1
  199. package/types/uni/uts-plugin-component/index.d.ts +1 -1
  200. package/types/uni/uts-plugin-component/lib/uni-video/utssdk/global.d.ts +64 -64
  201. package/types/uni/uts-plugin-component/lib/uni-video/utssdk/index.d.ts +31 -31
  202. package/types/uni/uts-plugin-component/lib/uni-video/utssdk/interface.d.ts +404 -354
  203. package/types/uni-cloud/index.d.ts +59 -59
  204. package/types/uni-cloud/interface.d.ts +848 -801
  205. package/types/uni-cloud/unicloud-db/index.d.ts +81 -0
  206. package/types/uni-cloud/unicloud-db/index.ts +313 -313
  207. package/types/uni-global/index.d.ts +1 -1
  208. package/types/vue/CheckboxGroupChangeEvent.d.ts +36 -36
  209. package/types/vue/LifeCycle.d.ts +55 -55
  210. package/types/vue/PickerViewChangeEvent.d.ts +36 -36
  211. package/types/vue/ProgressActiveendEvent.d.ts +30 -30
  212. package/types/vue/RadioGroupChangeEvent.d.ts +36 -36
  213. package/types/vue/SliderChangeEvent.d.ts +32 -32
  214. package/types/vue/SwitchChangeEvent.d.ts +30 -30
  215. package/types/vue/UniCanvasElement.d.ts +270 -270
  216. package/types/vue/UniCloudDBElement.d.ts +215 -215
  217. package/types/vue/UniFormElement.d.ts +51 -51
  218. package/types/vue/UniNavigatorElement.d.ts +7 -7
  219. package/types/vue/index.d.ts +11 -11
  220. package/uts-plugin.d.ts +27 -26
  221. package/types/uni/core/global.d.ts +0 -13
  222. package/types/uni/core/index.d.ts +0 -13
  223. package/types/uni/core/lib/base/event/interface.d.ts +0 -277
  224. package/types/uni/core/lib/base/interceptor/interface.d.ts +0 -150
  225. package/types/uni/core/lib/interface.d.ts +0 -28
  226. package/types/uni/core/lib/lifecycle/interface.d.ts +0 -37
  227. package/types/uni/core/lib/performance/interface.d.ts +0 -157
  228. package/types/uni/core/lib/route/interface.d.ts +0 -2031
  229. package/types/uni/core/lib/ui/create-selector-query/interface.d.ts +0 -412
  230. package/types/uni/core/lib/ui/get-element-by-id/interface.d.ts +0 -73
  231. package/types/uni/core/lib/ui/load-font-face/interface.d.ts +0 -560
  232. package/types/uni/core/lib/ui/page-scroll-to/interface.d.ts +0 -145
  233. package/types/uni/core/lib/ui/pull-down-refresh/interface.d.ts +0 -176
  234. package/types/uni/core/lib/ui/set-navigation-bar-color/interface.d.ts +0 -431
  235. package/types/uni/core/lib/ui/set-navigation-bar-title/global.d.ts +0 -28
  236. package/types/uni/core/lib/ui/set-navigation-bar-title/index.d.ts +0 -13
  237. package/types/uni/core/lib/ui/set-navigation-bar-title/interface.d.ts +0 -368
  238. package/types/uni/core/lib/ui/tab-bar/interface.d.ts +0 -928
@@ -1,423 +1,1784 @@
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
+ export type OpenFileSuccessResult = {
7
+ fd : string
8
+ }
9
+
10
+
11
+ /**
12
+ * 通用的正确返回结果
13
+ */
14
+ export type FileManagerSuccessResult = {
15
+ errMsg : string,
16
+ }
17
+ /**
18
+ * 通用的正确返回结果回调
19
+ */
20
+ export type FileManagerSuccessCallback = (res : FileManagerSuccessResult) => void
21
+ /**
22
+ * 通用的错误返回结果回调
23
+ */
24
+ export type FileManagerFailCallback = (res : UniError) => void
25
+ /**
26
+ * 通用的结束返回结果回调
27
+ */
28
+ export type FileManagerCompleteCallback = (res : any) => void
29
+
30
+
31
+
32
+ export type ReadFileSuccessCallback = (res : ReadFileSuccessResult) => void
33
+
34
+
35
+
36
+ export type ReadFileOptions = {
37
+ /**
38
+ * base64 / utf-8
39
+ */
40
+ encoding : "base64" | "utf-8",
41
+ /**
42
+ * 文件路径,支持相对地址和绝对地址
43
+ */
44
+ filePath : string.URIString,
45
+ /**
46
+ * 接口调用的回调函数
47
+ */
48
+ success ?: ReadFileSuccessCallback | null,
49
+ /**
50
+ * 接口调用失败的回调函数
51
+ */
52
+ fail ?: FileManagerFailCallback | null,
53
+ /**
54
+ * 接口调用结束的回调函数(调用成功、失败都会执行)
55
+ */
56
+ complete ?: FileManagerCompleteCallback | null
57
+ }
58
+
59
+
60
+
61
+
62
+
63
+ export type WriteFileOptions = {
64
+ /**
65
+ * 文件路径,只支持绝对地址
66
+ */
67
+ filePath : string.URIString,
68
+ /**
69
+ * 指定写入文件的字符编码
70
+ * 支持:ascii base64 utf-8
71
+ */
72
+ encoding : "ascii" | "base64" | "utf-8",
73
+ /**
74
+ * 写入的文本内容
75
+ */
76
+ data : string,
77
+ /**
78
+ * 接口调用的回调函数
79
+ */
80
+ success ?: FileManagerSuccessCallback | null,
81
+ /**
82
+ * 接口调用失败的回调函数
83
+ */
84
+ fail ?: FileManagerFailCallback | null,
85
+ /**
86
+ * 接口调用结束的回调函数(调用成功、失败都会执行)
87
+ */
88
+ complete ?: FileManagerCompleteCallback | null
89
+ }
90
+
91
+ export type AppendFileOptions = {
92
+ /**
93
+ * 要追加内容的文件路径 (本地路径)
94
+ */
95
+ filePath : string.URIString,
96
+ /**
97
+ * 指定写入文件的字符编码
98
+ * 支持:ascii base64 utf-8
99
+ */
100
+ encoding : "ascii" | "base64" | "utf-8",
101
+ /**
102
+ * 要追加的文本
103
+ */
104
+ data : string,
105
+ /**
106
+ * 接口调用的回调函数
107
+ */
108
+ success ?: FileManagerSuccessCallback | null,
109
+ /**
110
+ * 接口调用失败的回调函数
111
+ */
112
+ fail ?: FileManagerFailCallback | null,
113
+ /**
114
+ * 接口调用结束的回调函数(调用成功、失败都会执行)
115
+ */
116
+ complete ?: FileManagerCompleteCallback | null
117
+ }
118
+
119
+
120
+ export type OpenFileSuccessCallback = (res : OpenFileSuccessResult) => void
121
+
122
+ export type OpenFileOptions = {
123
+ /**
124
+ * 要追加内容的文件路径 (本地路径)
125
+ */
126
+ filePath : string.URIString,
127
+ /**
128
+ * 文件系统标志,默认值: 'r'
129
+ */
130
+ flag : "a" | "ax" | "a+" | "ax+" | "r" | "r+" | "w" | "wx" | "w+" | "wx" | "wx+",
131
+ /**
132
+ * 接口调用的回调函数
133
+ */
134
+ success ?: OpenFileSuccessCallback | null,
135
+ /**
136
+ * 接口调用失败的回调函数
137
+ */
138
+ fail ?: FileManagerFailCallback | null,
139
+ /**
140
+ * 接口调用结束的回调函数(调用成功、失败都会执行)
141
+ */
142
+ complete ?: FileManagerCompleteCallback | null
143
+ }
144
+
145
+ export type OpenFileSyncOptions = {
146
+ /**
147
+ * 要追加内容的文件路径 (本地路径)
148
+ */
149
+ filePath : string.URIString,
150
+ /**
151
+ * 文件系统标志,默认值: 'r'
152
+ */
153
+ flag : "a" | "ax" | "a+" | "ax+" | "r" | "r+" | "w" | "wx" | "w+" | "wx" | "wx+",
154
+ }
155
+
156
+
157
+
158
+
159
+ export type UnLinkSuccessCallback = (res : FileManagerSuccessResult) => void
160
+
161
+
162
+
163
+ export type UnLinkOptions = {
164
+ /**
165
+ * 文件路径,只支持绝对地址
166
+ */
167
+ filePath : string.URIString,
168
+ /**
169
+ * 接口调用的回调函数
170
+ */
171
+ success ?: UnLinkSuccessCallback | null,
172
+ /**
173
+ * 接口调用失败的回调函数
174
+ */
175
+ fail ?: FileManagerFailCallback | null,
176
+ /**
177
+ * 接口调用结束的回调函数(调用成功、失败都会执行)
178
+ */
179
+ complete ?: FileManagerCompleteCallback | null
180
+ }
181
+
182
+ export type MkDirSuccessCallback = (res : FileManagerSuccessResult) => void
183
+
184
+
185
+
186
+
187
+ export type MkDirOptions = {
188
+ /**
189
+ * 创建的目录路径 (本地路径)
190
+ */
191
+ dirPath : string.URIString,
192
+ /**
193
+ *是否在递归创建该目录的上级目录后再创建该目录。如果对应的上级目录已经存在,则不创建该上级目录。如 dirPath 为 a/b/c/d 且 recursive 为 true,将创建 a 目录,再在 a 目录下创建 b 目录,以此类推直至创建 a/b/c 目录下的 d 目录。
194
+ */
195
+ recursive : boolean,
196
+ /**
197
+ * 接口调用的回调函数
198
+ */
199
+ success ?: MkDirSuccessCallback | null,
200
+ /**
201
+ * 接口调用失败的回调函数
202
+ */
203
+ fail ?: FileManagerFailCallback | null,
204
+ /**
205
+ * 接口调用结束的回调函数(调用成功、失败都会执行)
206
+ */
207
+ complete ?: FileManagerCompleteCallback | null
208
+ }
209
+
210
+
211
+ export type RmDirSuccessCallback = (res : FileManagerSuccessResult) => void
212
+
213
+
214
+
215
+
216
+ export type RmDirOptions = {
217
+ /**
218
+ * 要删除的目录路径 (本地路径)
219
+ */
220
+ dirPath : string.URIString,
221
+ /**
222
+ *是否递归删除目录。如果为 true,则删除该目录和该目录下的所有子目录以及文件。
223
+ */
224
+ recursive : boolean,
225
+ /**
226
+ * 接口调用的回调函数
227
+ */
228
+ success ?: MkDirSuccessCallback | null,
229
+ /**
230
+ * 接口调用失败的回调函数
231
+ */
232
+ fail ?: FileManagerFailCallback | null,
233
+ /**
234
+ * 接口调用结束的回调函数(调用成功、失败都会执行)
235
+ */
236
+ complete ?: FileManagerCompleteCallback | null
237
+ }
238
+
239
+
240
+ export type ReadDirSuccessResult = {
241
+ files : string[],
242
+ }
243
+
244
+ export type ReadDirSuccessCallback = (res : ReadDirSuccessResult) => void
245
+
246
+
247
+ export type ReadDirOptions = {
248
+ /**
249
+ * 要读取的目录路径 (本地路径)
250
+ */
251
+ dirPath : string.URIString,
252
+
253
+ /**
254
+ * 接口调用的回调函数
255
+ */
256
+ success ?: ReadDirSuccessCallback | null,
257
+ /**
258
+ * 接口调用失败的回调函数
259
+ */
260
+ fail ?: FileManagerFailCallback | null,
261
+ /**
262
+ * 接口调用结束的回调函数(调用成功、失败都会执行)
263
+ */
264
+ complete ?: FileManagerCompleteCallback | null
265
+ }
266
+
267
+
268
+
269
+
270
+ export type AccessOptions = {
271
+ /**
272
+ * 要删除的目录路径 (本地路径)
273
+ */
274
+ path : string.URIString,
275
+
276
+ /**
277
+ * 接口调用的回调函数
278
+ */
279
+ success ?: FileManagerSuccessCallback | null,
280
+ /**
281
+ * 接口调用失败的回调函数
282
+ */
283
+ fail ?: FileManagerFailCallback | null,
284
+ /**
285
+ * 接口调用结束的回调函数(调用成功、失败都会执行)
286
+ */
287
+ complete ?: FileManagerCompleteCallback | null
288
+ }
289
+
290
+ export type RenameOptions = {
291
+ /**
292
+ * 源文件路径,支持本地路径
293
+ */
294
+ oldPath : string.URIString,
295
+ /**
296
+ * 新文件路径,支持本地路径
297
+ */
298
+ newPath : string.URIString,
299
+
300
+ /**
301
+ * 接口调用的回调函数
302
+ */
303
+ success ?: FileManagerSuccessCallback | null,
304
+ /**
305
+ * 接口调用失败的回调函数
306
+ */
307
+ fail ?: FileManagerFailCallback | null,
308
+ /**
309
+ * 接口调用结束的回调函数(调用成功、失败都会执行)
310
+ */
311
+ complete ?: FileManagerCompleteCallback | null
312
+ }
313
+
314
+ export type CopyFileOptions = {
315
+ /**
316
+ * 源文件路径,支持本地路径
317
+ */
318
+ srcPath : string.URIString,
319
+ /**
320
+ * 新文件路径,支持本地路径
321
+ */
322
+ destPath : string.URIString,
323
+
324
+ /**
325
+ * 接口调用的回调函数
326
+ */
327
+ success ?: FileManagerSuccessCallback | null,
328
+ /**
329
+ * 接口调用失败的回调函数
330
+ */
331
+ fail ?: FileManagerFailCallback | null,
332
+ /**
333
+ * 接口调用结束的回调函数(调用成功、失败都会执行)
334
+ */
335
+ complete ?: FileManagerCompleteCallback | null
336
+ }
337
+
338
+ export type SaveFileOptions = {
339
+ /**
340
+ * 临时存储文件路径 (本地路径)
341
+ */
342
+ tempFilePath : string.URIString,
343
+ /**
344
+ * 要存储的文件路径 (本地路径)
345
+ */
346
+ filePath : string.URIString | null,
347
+
348
+ /**
349
+ * 接口调用的回调函数
350
+ */
351
+ success ?: SaveFileSuccessCallback | null,
352
+ /**
353
+ * 接口调用失败的回调函数
354
+ */
355
+ fail ?: FileManagerFailCallback | null,
356
+ /**
357
+ * 接口调用结束的回调函数(调用成功、失败都会执行)
358
+ */
359
+ complete ?: FileManagerCompleteCallback | null
360
+ }
361
+
362
+
363
+ export type SaveFileSuccessCallback = (res : SaveFileSuccessResult) => void
364
+
365
+ export type SaveFileSuccessResult = {
366
+ /**
367
+ * 存储后的文件路径 (本地路径)
368
+ */
369
+ savedFilePath : string,
370
+ }
371
+
372
+ export type GetFileInfoSuccessResult = {
373
+ digest : string,
374
+ size : number,
375
+ errMsg : string
376
+ }
377
+
378
+ export type GetFileInfoSuccessCallback = (res : GetFileInfoSuccessResult) => void
379
+
380
+ export type GetFileInfoOptions = {
381
+ /**
382
+ * 要读取的文件路径 (本地路径)
383
+ */
384
+ filePath : string.URIString,
385
+ /**
386
+ * md5 / sha1
387
+ */
388
+ digestAlgorithm : "md5" | "sha1" | null,
389
+ /**
390
+ * 接口调用的回调函数
391
+ */
392
+ success ?: GetFileInfoSuccessCallback | null,
393
+ /**
394
+ * 接口调用失败的回调函数
395
+ */
396
+ fail ?: FileManagerFailCallback | null,
397
+ /**
398
+ * 接口调用结束的回调函数(调用成功、失败都会执行)
399
+ */
400
+ complete ?: FileManagerCompleteCallback | null
401
+ }
402
+
403
+
404
+ export interface Stats {
405
+ /**
406
+ * 文件的类型和存取的权限,对应 POSIX stat.st_mode
407
+ * 注意android中,文件类型只包含是否是目录与文件,
408
+ * 另外在android中这里的权限指的是当前进程对文件或者文件夹是否有读,写,执行的权限,
409
+ * 这里没有与 POSIX stat.st_mode对应的组,其他人等相关权限的数据返回,只有所有者的相关权限
410
+ */
411
+ mode : number;
412
+ /**
413
+ * 文件大小,单位:B,对应 POSIX stat.st_size
414
+ */
415
+ size : number;
416
+ /**
417
+ * 文件最近一次被存取或被执行的时间,UNIX 时间戳,对应 POSIX stat.st_atime
418
+ * 注意:android中由于系统限制无法获取该数据
419
+ */
420
+ lastAccessedTime : number;
421
+ /**
422
+ * 文件最后一次被修改的时间,UNIX 时间戳,对应 POSIX stat.st_mtime
423
+ */
424
+ lastModifiedTime : number;
425
+ /**
426
+ * @internal
427
+ */
428
+ mIsFile : boolean;
429
+ /**
430
+ * 判断当前文件是否一个目录
431
+ */
432
+ isDirectory() : boolean;
433
+ /**
434
+ * 判断当前文件是否一个普通文件
435
+ */
436
+ isFile() : boolean;
437
+ }
438
+
439
+
440
+ export type FileStats = {
441
+ path : string,
442
+ stats : Stats,
443
+ }
444
+
445
+ export type StatSuccessResult = {
446
+ errMsg : string,
447
+ stats : FileStats[]
448
+ }
449
+
450
+
451
+ export type StatSuccessCallback = (res : StatSuccessResult) => void
452
+
453
+
454
+ export type StatOptions = {
455
+ /**
456
+ * 文件/目录路径 (本地路径)
457
+ */
458
+ path : string.URIString,
459
+ /**
460
+ * 是否递归获取目录下的每个文件的 Stats 信息
461
+ */
462
+ recursive : boolean,
463
+ /**
464
+ * 接口调用的回调函数
465
+ */
466
+ success ?: StatSuccessCallback | null,
467
+ /**
468
+ * 接口调用失败的回调函数
469
+ */
470
+ fail ?: FileManagerFailCallback | null,
471
+ /**
472
+ * 接口调用结束的回调函数(调用成功、失败都会执行)
473
+ */
474
+ complete ?: FileManagerCompleteCallback | null
475
+ }
476
+
477
+
478
+ export type UnzipFileOptions = {
479
+ /**
480
+ * 源文件路径,支持本地路径, 只可以是 zip 压缩文件
481
+ */
482
+ zipFilePath : string,
483
+ /**
484
+ * 目标目录路径, 支持本地路径
485
+ */
486
+ targetPath : string,
487
+ /**
488
+ * 接口调用的回调函数
489
+ */
490
+ success ?: FileManagerSuccessCallback | null,
491
+ /**
492
+ * 接口调用失败的回调函数
493
+ */
494
+ fail ?: FileManagerFailCallback | null,
495
+ /**
496
+ * 接口调用结束的回调函数(调用成功、失败都会执行)
497
+ */
498
+ complete ?: FileManagerCompleteCallback | null
499
+ }
500
+
501
+ export type GetSavedFileListResult = {
502
+ fileList : string[]
503
+ }
504
+
505
+ export type GetSavedFileListCallback = (res : GetSavedFileListResult) => void
506
+
507
+ export type GetSavedFileListOptions = {
508
+ /**
509
+ * 接口调用的回调函数
510
+ */
511
+ success ?: GetSavedFileListCallback | null,
512
+ /**
513
+ * 接口调用失败的回调函数
514
+ */
515
+ fail ?: FileManagerFailCallback | null,
516
+ /**
517
+ * 接口调用结束的回调函数(调用成功、失败都会执行)
518
+ */
519
+ complete ?: FileManagerCompleteCallback | null
520
+ }
521
+
522
+
523
+
524
+ export type TruncateFileOptions = {
525
+ /**
526
+ * 要截断的文件路径 (本地路径)
527
+ */
528
+ filePath : string.URIString,
529
+ /**
530
+ * 截断位置,默认0。如果 length 小于文件长度(字节),则只有前面 length 个字节会保留在文件中,其余内容会被删除;
531
+ * 如果 length 大于文件长度,不做处理
532
+ */
533
+ length : number,
534
+ /**
535
+ * 接口调用的回调函数
536
+ */
537
+ success ?: FileManagerSuccessCallback | null,
538
+ /**
539
+ * 接口调用失败的回调函数
540
+ */
541
+ fail ?: FileManagerFailCallback | null,
542
+ /**
543
+ * 接口调用结束的回调函数(调用成功、失败都会执行)
544
+ */
545
+ complete ?: FileManagerCompleteCallback | null
546
+ }
547
+
548
+
549
+ export type ReadCompressedFileResult = {
550
+ data : string
551
+ }
552
+
553
+ export type ReadCompressedFileCallback = (res : ReadCompressedFileResult) => void
554
+ export type ReadCompressedFileOptions = {
555
+ /**
556
+ * 要读取的文件的路径 (本地用户文件或代码包文件)
557
+ */
558
+ filePath : string.URIString,
559
+ /**
560
+ * 文件压缩类型,目前仅支持 'br'。
561
+ */
562
+ compressionAlgorithm : "br",
563
+ /**
564
+ * 接口调用的回调函数
565
+ */
566
+ success ?: ReadCompressedFileCallback | null,
567
+ /**
568
+ * 接口调用失败的回调函数
569
+ */
570
+ fail ?: FileManagerFailCallback | null,
571
+ /**
572
+ * 接口调用结束的回调函数(调用成功、失败都会执行)
573
+ */
574
+ complete ?: FileManagerCompleteCallback | null
575
+ }
576
+
577
+
578
+ export type RemoveSavedFileOptions = {
579
+ /**
580
+ * 需要删除的文件路径 (本地路径)
581
+ */
582
+ filePath : string.URIString,
583
+ /**
584
+ * 接口调用的回调函数
585
+ */
586
+ success ?: FileManagerSuccessCallback | null,
587
+ /**
588
+ * 接口调用失败的回调函数
589
+ */
590
+ fail ?: FileManagerFailCallback | null,
591
+ /**
592
+ * 接口调用结束的回调函数(调用成功、失败都会执行)
593
+ */
594
+ complete ?: FileManagerCompleteCallback | null
595
+ }
596
+
597
+
598
+
599
+ export type WriteResult = {
600
+ /**
601
+ * 实际被写入到文件中的字节数(注意,被写入的字节数不一定与被写入的字符串字符数相同)
602
+ */
603
+ bytesWritten : number
604
+ }
605
+
606
+ export type WriteCallback = (res : WriteResult) => void
607
+ export type WriteOptions = {
608
+ /**
609
+ * 文件描述符。fd 通过 FileSystemManager.open 或 FileSystemManager.openSync 接口获得
610
+ */
611
+ fd : string,
612
+ /**
613
+ * 写入的内容
614
+ */
615
+ data : string,
616
+ /**
617
+ * 指定写入文件的字符编码
618
+ * 支持:ascii base64 utf-8
619
+ */
620
+ encoding : "ascii" | "base64" | "utf-8",
621
+ // /**
622
+ // * 指定文件开头的偏移量,即数据要被写入的位置。当 position 不传或者传入非 Number 类型的值时,数据会被写入当前指针所在位置。
623
+ // */
624
+ // position : number | null,
625
+
626
+ /**
627
+ * 接口调用的回调函数
628
+ */
629
+ success ?: WriteCallback | null,
630
+ /**
631
+ * 接口调用失败的回调函数
632
+ */
633
+ fail ?: FileManagerFailCallback | null,
634
+ /**
635
+ * 接口调用结束的回调函数(调用成功、失败都会执行)
636
+ */
637
+ complete ?: FileManagerCompleteCallback | null
638
+ }
639
+ export type WriteSyncOptions = {
640
+ /**
641
+ * 文件描述符。fd 通过 FileSystemManager.open 或 FileSystemManager.openSync 接口获得
642
+ */
643
+ fd : string,
644
+ /**
645
+ * 写入的内容
646
+ */
647
+ data : string,
648
+ /**
649
+ * 指定写入文件的字符编码
650
+ * 支持:ascii base64 utf-8
651
+ */
652
+ encoding : "ascii" | "base64" | "utf-8",
653
+ }
654
+
655
+ export type CloseOptions = {
656
+ /**
657
+ * 需要被关闭的文件描述符。fd 通过 FileSystemManager.open 或 FileSystemManager.openSync 接口获得
658
+ */
659
+ fd : string,
660
+ /**
661
+ * 接口调用的回调函数
662
+ */
663
+ success ?: FileManagerSuccessCallback | null,
664
+ /**
665
+ * 接口调用失败的回调函数
666
+ */
667
+ fail ?: FileManagerFailCallback | null,
668
+ /**
669
+ * 接口调用结束的回调函数(调用成功、失败都会执行)
670
+ */
671
+ complete ?: FileManagerCompleteCallback | null
672
+ }
673
+
674
+ export type CloseSyncOptions = {
675
+ /**
676
+ * 需要被关闭的文件描述符。fd 通过 FileSystemManager.open 或 FileSystemManager.openSync 接口获得
677
+ */
678
+ fd : string,
679
+ }
680
+
681
+
682
+ export type FStatSuccessResult = {
683
+ /**
684
+ * Stats 对象,包含了文件的状态信息
685
+ */
686
+ stats : Stats
687
+ }
688
+
689
+
690
+ export type FStatSuccessCallback = (res : FStatSuccessResult) => void
691
+
692
+
693
+ export type FStatOptions = {
694
+ /**
695
+ * 文件描述符。fd 通过 FileSystemManager.open 或 FileSystemManager.openSync 接口获得
696
+ */
697
+ fd : string,
698
+ /**
699
+ * 接口调用的回调函数
700
+ */
701
+ success ?: FStatSuccessCallback | null,
702
+ /**
703
+ * 接口调用失败的回调函数
704
+ */
705
+ fail ?: FileManagerFailCallback | null,
706
+ /**
707
+ * 接口调用结束的回调函数(调用成功、失败都会执行)
708
+ */
709
+ complete ?: FileManagerCompleteCallback | null
710
+ }
711
+
712
+ export type FStatSyncOptions = {
713
+ /**
714
+ * 文件描述符。fd 通过 FileSystemManager.open 或 FileSystemManager.openSync 接口获得
715
+ */
716
+ fd : string
717
+ }
718
+
719
+ export type FTruncateFileOptions = {
720
+ /**
721
+ * 文件描述符。fd 通过 FileSystemManager.open 或 FileSystemManager.openSync 接口获得
722
+ */
723
+ fd : string,
724
+ /**
725
+ * 截断位置,默认0。如果 length 小于文件长度(字节),则只有前面 length 个字节会保留在文件中,其余内容会被删除;
726
+ * 如果 length 大于文件长度,不做处理
727
+ */
728
+ length : number,
729
+ /**
730
+ * 接口调用的回调函数
731
+ */
732
+ success ?: FileManagerSuccessCallback | null,
733
+ /**
734
+ * 接口调用失败的回调函数
735
+ */
736
+ fail ?: FileManagerFailCallback | null,
737
+ /**
738
+ * 接口调用结束的回调函数(调用成功、失败都会执行)
739
+ */
740
+ complete ?: FileManagerCompleteCallback | null
741
+ }
742
+
743
+ export type FTruncateFileSyncOptions = {
744
+ /**
745
+ * 文件描述符。fd 通过 FileSystemManager.open 或 FileSystemManager.openSync 接口获得
746
+ */
747
+ fd : string,
748
+ /**
749
+ * 截断位置,默认0。如果 length 小于文件长度(字节),则只有前面 length 个字节会保留在文件中,其余内容会被删除;
750
+ * 如果 length 大于文件长度,不做处理
751
+ */
752
+ length : number,
753
+ }
754
+
755
+
756
+ export type EntryItem = {
757
+ /** 压缩包内文件路径 */
758
+ path : string
759
+ /**
760
+ * 指定写入文件的字符编码
761
+ * 支持:ascii base64 utf-8
762
+ */
763
+ encoding : "ascii" | "base64" | "base64",
764
+ // /** 指定文件的长度,如果不指定,则读到文件末尾。有效范围:[1, fileLength]。单位:byte */
765
+ // length ?: number
766
+ // /** 从文件指定位置开始读,如果不指定,则从文件头开始读。读取的范围应该是左闭右开区间 [position, position+length)。有效范围:[0, fileLength - 1]。单位:byte */
767
+ // position ?: number
768
+ }
769
+ export type EntriesResult = {
770
+ /** 文件路径 */
771
+ result : Map<string, ZipFileItem>
772
+ }
773
+ export type ZipFileItem = {
774
+ /** 文件内容 */
775
+ data ?: string | null,
776
+ /** 错误信息 */
777
+ errMsg : string
778
+ }
779
+ export type ReadZipEntryCallback = (res : EntriesResult) => void
780
+ export type ReadZipEntryOptions = {
781
+ /**
782
+ * 要读取的压缩包的路径 (本地路径)
783
+ */
784
+ filePath : string.URIString,
785
+ /**
786
+ *统一指定读取文件的字符编码,只在 entries 值为"all"时有效。
787
+ *如果 entries 值为"all"且不传 encoding,则以 string 格式读取文件的内容
788
+ */
789
+ encoding : "ascii" | "base64" | "utf-8",
790
+ /** 要读取的压缩包内的文件列表(当不传入时表示读取压缩包内所有文件) */
791
+ entries ?: EntryItem[] | null,
792
+ /**
793
+ * 接口调用的回调函数
794
+ */
795
+ success ?: ReadZipEntryCallback | null,
796
+ /**
797
+ * 接口调用失败的回调函数
798
+ */
799
+ fail ?: FileManagerFailCallback | null,
800
+ /**
801
+ * 接口调用结束的回调函数(调用成功、失败都会执行)
802
+ */
803
+ complete ?: FileManagerCompleteCallback | null
804
+ }
805
+
806
+
807
+ export interface FileSystemManager {
808
+ /**
809
+ * 读取本地文件内容
810
+ * @uniPlatform {
811
+ * "app": {
812
+ * "android": {
813
+ * "osVer": "5.0",
814
+ * "uniVer": "x",
815
+ * "unixVer": "3.9.0"
816
+ * },
817
+ * "ios": {
818
+ * "osVer": "12.0",
819
+ * "uniVer": "x",
820
+ * "unixVer": "4.11"
821
+ * }
822
+ * },
823
+ * "web": {
824
+ * "uniVer": "x",
825
+ * "unixVer": "x"
826
+ * }
827
+ * }
828
+ */
829
+ readFile(options : ReadFileOptions) : void;
830
+ /**
831
+ * FileSystemManager.readFile 的同步版本参数
832
+ * @uniPlatform {
833
+ * "app": {
834
+ * "android": {
835
+ * "osVer": "5.0",
836
+ * "uniVer": "x",
837
+ * "unixVer": "4.13"
838
+ * },
839
+ * "ios": {
840
+ * "osVer": "12.0",
841
+ * "uniVer": "x",
842
+ * "unixVer": "x"
843
+ * }
844
+ * },
845
+ * "web": {
846
+ * "uniVer": "x",
847
+ * "unixVer": "x"
848
+ * }
849
+ * }
850
+ */
851
+ readFileSync(filePath : string, encoding : string | null) : string;
852
+ /**
853
+ * 写文件
854
+ * @uniPlatform {
855
+ * "app": {
856
+ * "android": {
857
+ * "osVer": "5.0",
858
+ * "uniVer": "x",
859
+ * "unixVer": "3.9.0"
860
+ * },
861
+ * "ios": {
862
+ * "osVer": "12.0",
863
+ * "uniVer": "x",
864
+ * "unixVer": "4.11"
865
+ * }
866
+ * },
867
+ * "web": {
868
+ * "uniVer": "x",
869
+ * "unixVer": "x"
870
+ * }
871
+ * }
872
+ */
873
+ writeFile(options : WriteFileOptions) : void;
874
+ /**
875
+ * FileSystemManager.writeFile 的同步版本
876
+ * @uniPlatform {
877
+ * "app": {
878
+ * "android": {
879
+ * "osVer": "5.0",
880
+ * "uniVer": "x",
881
+ * "unixVer": "4.13"
882
+ * },
883
+ * "ios": {
884
+ * "osVer": "12.0",
885
+ * "uniVer": "x",
886
+ * "unixVer": "x"
887
+ * }
888
+ * },
889
+ * "web": {
890
+ * "uniVer": "x",
891
+ * "unixVer": "x"
892
+ * }
893
+ * }
894
+ */
895
+ writeFileSync(filePath : string, data : string, encoding : string) : void;
896
+ /**
897
+ * 删除文件
898
+ * @uniPlatform {
899
+ * "app": {
900
+ * "android": {
901
+ * "osVer": "5.0",
902
+ * "uniVer": "x",
903
+ * "unixVer": "3.9.0"
904
+ * },
905
+ * "ios": {
906
+ * "osVer": "12.0",
907
+ * "uniVer": "x",
908
+ * "unixVer": "4.11"
909
+ * }
910
+ * },
911
+ * "web": {
912
+ * "uniVer": "x",
913
+ * "unixVer": "x"
914
+ * }
915
+ * }
916
+ */
917
+ unlink(options : UnLinkOptions) : void;
918
+ /**
919
+ * FileSystemManager.unlink 的同步版本
920
+ * @uniPlatform {
921
+ * "app": {
922
+ * "android": {
923
+ * "osVer": "5.0",
924
+ * "uniVer": "x",
925
+ * "unixVer": "4.13"
926
+ * },
927
+ * "ios": {
928
+ * "osVer": "12.0",
929
+ * "uniVer": "x",
930
+ * "unixVer": "x"
931
+ * }
932
+ * },
933
+ * "web": {
934
+ * "uniVer": "x",
935
+ * "unixVer": "x"
936
+ * }
937
+ * }
938
+ */
939
+ unlinkSync(filePath : string) : void;
940
+ /**
941
+ * 创建目录
942
+ * @uniPlatform {
943
+ * "app": {
944
+ * "android": {
945
+ * "osVer": "5.0",
946
+ * "uniVer": "x",
947
+ * "unixVer": "3.9.0"
948
+ * },
949
+ * "ios": {
950
+ * "osVer": "12.0",
951
+ * "uniVer": "x",
952
+ * "unixVer": "4.11"
953
+ * }
954
+ * },
955
+ * "web": {
956
+ * "uniVer": "x",
957
+ * "unixVer": "x"
958
+ * }
959
+ * }
960
+ */
961
+ mkdir(options : MkDirOptions) : void;
962
+ /**
963
+ * FileSystemManager.mkdir 的同步版本
964
+ * @uniPlatform {
965
+ * "app": {
966
+ * "android": {
967
+ * "osVer": "5.0",
968
+ * "uniVer": "x",
969
+ * "unixVer": "4.13"
970
+ * },
971
+ * "ios": {
972
+ * "osVer": "12.0",
973
+ * "uniVer": "x",
974
+ * "unixVer": "x"
975
+ * }
976
+ * },
977
+ * "web": {
978
+ * "uniVer": "x",
979
+ * "unixVer": "x"
980
+ * }
981
+ * }
982
+ */
983
+ mkdirSync(dirPath : string, recursive : boolean) : void;
984
+ /**
985
+ * 删除目录
986
+ * @uniPlatform {
987
+ * "app": {
988
+ * "android": {
989
+ * "osVer": "5.0",
990
+ * "uniVer": "x",
991
+ * "unixVer": "3.9.0"
992
+ * },
993
+ * "ios": {
994
+ * "osVer": "12.0",
995
+ * "uniVer": "x",
996
+ * "unixVer": "4.11"
997
+ * }
998
+ * },
999
+ * "web": {
1000
+ * "uniVer": "x",
1001
+ * "unixVer": "x"
1002
+ * }
1003
+ * }
1004
+ */
1005
+ rmdir(options : RmDirOptions) : void;
1006
+ /**
1007
+ * FileSystemManager.rmdir 的同步版本
1008
+ * @uniPlatform {
1009
+ * "app": {
1010
+ * "android": {
1011
+ * "osVer": "5.0",
1012
+ * "uniVer": "x",
1013
+ * "unixVer": "4.13"
1014
+ * },
1015
+ * "ios": {
1016
+ * "osVer": "12.0",
1017
+ * "uniVer": "x",
1018
+ * "unixVer": "x"
1019
+ * }
1020
+ * },
1021
+ * "web": {
1022
+ * "uniVer": "x",
1023
+ * "unixVer": "x"
1024
+ * }
1025
+ * }
1026
+ */
1027
+ rmdirSync(dirPath : string, recursive : boolean) : void;
1028
+ /**
1029
+ * 读取目录内文件列表
1030
+ * @uniPlatform {
1031
+ * "app": {
1032
+ * "android": {
1033
+ * "osVer": "5.0",
1034
+ * "uniVer": "x",
1035
+ * "unixVer": "3.9.0"
1036
+ * },
1037
+ * "ios": {
1038
+ * "osVer": "12.0",
1039
+ * "uniVer": "x",
1040
+ * "unixVer": "4.11"
1041
+ * }
1042
+ * },
1043
+ * "web": {
1044
+ * "uniVer": "x",
1045
+ * "unixVer": "x"
1046
+ * }
1047
+ * }
1048
+ */
1049
+ readdir(options : ReadDirOptions) : void;
1050
+ /**
1051
+ * FileSystemManager.readdir 的同步版本
1052
+ * @uniPlatform {
1053
+ * "app": {
1054
+ * "android": {
1055
+ * "osVer": "5.0",
1056
+ * "uniVer": "x",
1057
+ * "unixVer": "4.13"
1058
+ * },
1059
+ * "ios": {
1060
+ * "osVer": "12.0",
1061
+ * "uniVer": "x",
1062
+ * "unixVer": "x"
1063
+ * }
1064
+ * },
1065
+ * "web": {
1066
+ * "uniVer": "x",
1067
+ * "unixVer": "x"
1068
+ * }
1069
+ * }
1070
+ */
1071
+ readdirSync(dirPath : string) : string[] | null;
1072
+ /**
1073
+ * 判断文件/目录是否存在
1074
+ * @uniPlatform {
1075
+ * "app": {
1076
+ * "android": {
1077
+ * "osVer": "5.0",
1078
+ * "uniVer": "x",
1079
+ * "unixVer": "3.9.0"
1080
+ * },
1081
+ * "ios": {
1082
+ * "osVer": "12.0",
1083
+ * "uniVer": "x",
1084
+ * "unixVer": "4.11"
1085
+ * }
1086
+ * },
1087
+ * "web": {
1088
+ * "uniVer": "x",
1089
+ * "unixVer": "x"
1090
+ * }
1091
+ * }
1092
+ */
1093
+ access(options : AccessOptions) : void;
1094
+ /**
1095
+ * FileSystemManager.access 的同步版本
1096
+ * @uniPlatform {
1097
+ * "app": {
1098
+ * "android": {
1099
+ * "osVer": "5.0",
1100
+ * "uniVer": "x",
1101
+ * "unixVer": "4.13"
1102
+ * },
1103
+ * "ios": {
1104
+ * "osVer": "12.0",
1105
+ * "uniVer": "x",
1106
+ * "unixVer": "x"
1107
+ * }
1108
+ * },
1109
+ * "web": {
1110
+ * "uniVer": "x",
1111
+ * "unixVer": "x"
1112
+ * }
1113
+ * }
1114
+ */
1115
+ accessSync(path : string) : void;
1116
+ /**
1117
+ * 重命名文件。可以把文件从 oldPath 移动到 newPath
1118
+ * @uniPlatform {
1119
+ * "app": {
1120
+ * "android": {
1121
+ * "osVer": "5.0",
1122
+ * "uniVer": "x",
1123
+ * "unixVer": "3.9.0"
1124
+ * },
1125
+ * "ios": {
1126
+ * "osVer": "12.0",
1127
+ * "uniVer": "x",
1128
+ * "unixVer": "4.11"
1129
+ * }
1130
+ * },
1131
+ * "web": {
1132
+ * "uniVer": "x",
1133
+ * "unixVer": "x"
1134
+ * }
1135
+ * }
1136
+ */
1137
+ rename(options : RenameOptions) : void;
1138
+ /**
1139
+ * FileSystemManager.rename 的同步版本
1140
+ * @uniPlatform {
1141
+ * "app": {
1142
+ * "android": {
1143
+ * "osVer": "5.0",
1144
+ * "uniVer": "x",
1145
+ * "unixVer": "4.13"
1146
+ * },
1147
+ * "ios": {
1148
+ * "osVer": "12.0",
1149
+ * "uniVer": "x",
1150
+ * "unixVer": "x"
1151
+ * }
1152
+ * },
1153
+ * "web": {
1154
+ * "uniVer": "x",
1155
+ * "unixVer": "x"
1156
+ * }
1157
+ * }
1158
+ */
1159
+ renameSync(oldPath : string, newPath : string) : void;
1160
+ /**
1161
+ * 复制文件
1162
+ * @uniPlatform {
1163
+ * "app": {
1164
+ * "android": {
1165
+ * "osVer": "5.0",
1166
+ * "uniVer": "x",
1167
+ * "unixVer": "3.9.0"
1168
+ * },
1169
+ * "ios": {
1170
+ * "osVer": "12.0",
1171
+ * "uniVer": "x",
1172
+ * "unixVer": "4.11"
1173
+ * }
1174
+ * },
1175
+ * "web": {
1176
+ * "uniVer": "x",
1177
+ * "unixVer": "x"
1178
+ * }
1179
+ * }
1180
+ */
1181
+ copyFile(options : CopyFileOptions) : void;
1182
+ /**
1183
+ * FileSystemManager.copyFile 的同步版本
1184
+ * @uniPlatform {
1185
+ * "app": {
1186
+ * "android": {
1187
+ * "osVer": "5.0",
1188
+ * "uniVer": "x",
1189
+ * "unixVer": "4.13"
1190
+ * },
1191
+ * "ios": {
1192
+ * "osVer": "12.0",
1193
+ * "uniVer": "x",
1194
+ * "unixVer": "x"
1195
+ * }
1196
+ * },
1197
+ * "web": {
1198
+ * "uniVer": "x",
1199
+ * "unixVer": "x"
1200
+ * }
1201
+ * }
1202
+ */
1203
+ copyFileSync(srcPath : string, destPath : string) : void;
1204
+ /**
1205
+ * 获取该本地临时文件 或 本地缓存文件 信息
1206
+ * @uniPlatform {
1207
+ * "app": {
1208
+ * "android": {
1209
+ * "osVer": "5.0",
1210
+ * "uniVer": "x",
1211
+ * "unixVer": "3.9.0"
1212
+ * },
1213
+ * "ios": {
1214
+ * "osVer": "12.0",
1215
+ * "uniVer": "x",
1216
+ * "unixVer": "4.11"
1217
+ * }
1218
+ * },
1219
+ * "web": {
1220
+ * "uniVer": "x",
1221
+ * "unixVer": "x"
1222
+ * }
1223
+ * }
1224
+ */
1225
+ getFileInfo(options : GetFileInfoOptions) : void;
1226
+ /**
1227
+ * 获取文件 Stats 对象
1228
+ * @uniPlatform {
1229
+ * "app": {
1230
+ * "android": {
1231
+ * "osVer": "5.0",
1232
+ * "uniVer": "x",
1233
+ * "unixVer": "3.9.0"
1234
+ * },
1235
+ * "ios": {
1236
+ * "osVer": "12.0",
1237
+ * "uniVer": "x",
1238
+ * "unixVer": "4.11"
1239
+ * }
1240
+ * },
1241
+ * "web": {
1242
+ * "uniVer": "x",
1243
+ * "unixVer": "x"
1244
+ * }
1245
+ * }
1246
+ */
1247
+ stat(options : StatOptions) : void;
1248
+ /**
1249
+ * FileSystemManager.stat 的同步版本
1250
+ * @uniPlatform {
1251
+ * "app": {
1252
+ * "android": {
1253
+ * "osVer": "5.0",
1254
+ * "uniVer": "x",
1255
+ * "unixVer": "4.13"
1256
+ * },
1257
+ * "ios": {
1258
+ * "osVer": "12.0",
1259
+ * "uniVer": "x",
1260
+ * "unixVer": "x"
1261
+ * }
1262
+ * },
1263
+ * "web": {
1264
+ * "uniVer": "x",
1265
+ * "unixVer": "x"
1266
+ * }
1267
+ * }
1268
+ */
1269
+ statSync(path : string, recursive : boolean) : FileStats[];
1270
+ /**
1271
+ * 在文件结尾追加内容
1272
+ * @uniPlatform {
1273
+ * "app": {
1274
+ * "android": {
1275
+ * "osVer": "5.0",
1276
+ * "uniVer": "x",
1277
+ * "unixVer": "4.13"
1278
+ * },
1279
+ * "ios": {
1280
+ * "osVer": "12.0",
1281
+ * "uniVer": "x",
1282
+ * "unixVer": "x"
1283
+ * }
1284
+ * },
1285
+ * "web": {
1286
+ * "uniVer": "x",
1287
+ * "unixVer": "x"
1288
+ * }
1289
+ * }
1290
+ */
1291
+ appendFile(options : AppendFileOptions) : void;
1292
+ /**
1293
+ * FileSystemManager.appendFile 的同步版本
1294
+ * @uniPlatform {
1295
+ * "app": {
1296
+ * "android": {
1297
+ * "osVer": "5.0",
1298
+ * "uniVer": "x",
1299
+ * "unixVer": "4.13"
1300
+ * },
1301
+ * "ios": {
1302
+ * "osVer": "12.0",
1303
+ * "uniVer": "x",
1304
+ * "unixVer": "x"
1305
+ * }
1306
+ * },
1307
+ * "web": {
1308
+ * "uniVer": "x",
1309
+ * "unixVer": "x"
1310
+ * }
1311
+ * }
1312
+ */
1313
+ appendFileSync(filePath : string, data : string, encoding : string) : void;
1314
+ /**
1315
+ * 保存临时文件到本地。此接口会移动临时文件,因此调用成功后,tempFilePath 将不可用。
1316
+ * @uniPlatform {
1317
+ * "app": {
1318
+ * "android": {
1319
+ * "osVer": "5.0",
1320
+ * "uniVer": "x",
1321
+ * "unixVer": "4.13"
1322
+ * },
1323
+ * "ios": {
1324
+ * "osVer": "12.0",
1325
+ * "uniVer": "x",
1326
+ * "unixVer": "x"
1327
+ * }
1328
+ * },
1329
+ * "web": {
1330
+ * "uniVer": "x",
1331
+ * "unixVer": "x"
1332
+ * }
1333
+ * }
1334
+ */
1335
+ saveFile(options : SaveFileOptions) : void;
1336
+ /**
1337
+ * FileSystemManager.saveFile 的同步版本
1338
+ * @uniPlatform {
1339
+ * "app": {
1340
+ * "android": {
1341
+ * "osVer": "5.0",
1342
+ * "uniVer": "x",
1343
+ * "unixVer": "4.13"
1344
+ * },
1345
+ * "ios": {
1346
+ * "osVer": "12.0",
1347
+ * "uniVer": "x",
1348
+ * "unixVer": "x"
1349
+ * }
1350
+ * },
1351
+ * "web": {
1352
+ * "uniVer": "x",
1353
+ * "unixVer": "x"
1354
+ * }
1355
+ * }
1356
+ */
1357
+ saveFileSync(tempFilePath : string, filePath : string | null) : string;
1358
+ /**
1359
+ * 删除该小程序下已保存的本地缓存文件
1360
+ * @uniPlatform {
1361
+ * "app": {
1362
+ * "android": {
1363
+ * "osVer": "5.0",
1364
+ * "uniVer": "x",
1365
+ * "unixVer": "4.13"
1366
+ * },
1367
+ * "ios": {
1368
+ * "osVer": "12.0",
1369
+ * "uniVer": "x",
1370
+ * "unixVer": "x"
1371
+ * }
1372
+ * },
1373
+ * "web": {
1374
+ * "uniVer": "x",
1375
+ * "unixVer": "x"
1376
+ * }
1377
+ * }
1378
+ */
1379
+ removeSavedFile(options : RemoveSavedFileOptions) : void;
1380
+ /**
1381
+ * 解压文件
1382
+ * @uniPlatform {
1383
+ * "app": {
1384
+ * "android": {
1385
+ * "osVer": "5.0",
1386
+ * "uniVer": "x",
1387
+ * "unixVer": "4.13"
1388
+ * },
1389
+ * "ios": {
1390
+ * "osVer": "12.0",
1391
+ * "uniVer": "x",
1392
+ * "unixVer": "x"
1393
+ * }
1394
+ * },
1395
+ * "web": {
1396
+ * "uniVer": "x",
1397
+ * "unixVer": "x"
1398
+ * }
1399
+ * }
1400
+ */
1401
+ unzip(options : UnzipFileOptions) : void;
1402
+ /**
1403
+ * 获取该已保存的本地缓存文件列表
1404
+ * @uniPlatform {
1405
+ * "app": {
1406
+ * "android": {
1407
+ * "osVer": "5.0",
1408
+ * "uniVer": "x",
1409
+ * "unixVer": "4.13"
1410
+ * },
1411
+ * "ios": {
1412
+ * "osVer": "12.0",
1413
+ * "uniVer": "x",
1414
+ * "unixVer": "x"
1415
+ * }
1416
+ * },
1417
+ * "web": {
1418
+ * "uniVer": "x",
1419
+ * "unixVer": "x"
1420
+ * }
1421
+ * }
1422
+ */
1423
+ getSavedFileList(options : GetSavedFileListOptions) : void;
1424
+ /**
1425
+ * 对文件内容进行截断操作
1426
+ * @uniPlatform {
1427
+ * "app": {
1428
+ * "android": {
1429
+ * "osVer": "5.0",
1430
+ * "uniVer": "x",
1431
+ * "unixVer": "4.13"
1432
+ * },
1433
+ * "ios": {
1434
+ * "osVer": "12.0",
1435
+ * "uniVer": "x",
1436
+ * "unixVer": "x"
1437
+ * }
1438
+ * },
1439
+ * "web": {
1440
+ * "uniVer": "x",
1441
+ * "unixVer": "x"
1442
+ * }
1443
+ * }
1444
+ */
1445
+ truncate(options : TruncateFileOptions) : void;
1446
+ /**
1447
+ * 对文件内容进行截断操作 (truncate 的同步版本)
1448
+ * @uniPlatform {
1449
+ * "app": {
1450
+ * "android": {
1451
+ * "osVer": "5.0",
1452
+ * "uniVer": "x",
1453
+ * "unixVer": "4.13"
1454
+ * },
1455
+ * "ios": {
1456
+ * "osVer": "12.0",
1457
+ * "uniVer": "x",
1458
+ * "unixVer": "x"
1459
+ * }
1460
+ * },
1461
+ * "web": {
1462
+ * "uniVer": "x",
1463
+ * "unixVer": "x"
1464
+ * }
1465
+ * }
1466
+ */
1467
+ truncateSync(filePath : string, length ?: number) : void;
1468
+ /**
1469
+ * 读取指定压缩类型的本地文件内容
1470
+ * @uniPlatform {
1471
+ * "app": {
1472
+ * "android": {
1473
+ * "osVer": "5.0",
1474
+ * "uniVer": "x",
1475
+ * "unixVer": "4.13"
1476
+ * },
1477
+ * "ios": {
1478
+ * "osVer": "12.0",
1479
+ * "uniVer": "x",
1480
+ * "unixVer": "x"
1481
+ * }
1482
+ * },
1483
+ * "web": {
1484
+ * "uniVer": "x",
1485
+ * "unixVer": "x"
1486
+ * }
1487
+ * }
1488
+ */
1489
+ readCompressedFile(options : ReadCompressedFileOptions) : void;
1490
+ /**
1491
+ * 同步读取指定压缩类型的本地文件内容
1492
+ * @uniPlatform {
1493
+ * "app": {
1494
+ * "android": {
1495
+ * "osVer": "5.0",
1496
+ * "uniVer": "x",
1497
+ * "unixVer": "4.13"
1498
+ * },
1499
+ * "ios": {
1500
+ * "osVer": "12.0",
1501
+ * "uniVer": "x",
1502
+ * "unixVer": "x"
1503
+ * }
1504
+ * },
1505
+ * "web": {
1506
+ * "uniVer": "x",
1507
+ * "unixVer": "x"
1508
+ * }
1509
+ * }
1510
+ */
1511
+ readCompressedFileSync(filePath : string, compressionAlgorithm : string) : string
1512
+ /**
1513
+ * 打开文件,返回文件描述符
1514
+ * @uniPlatform {
1515
+ * "app": {
1516
+ * "android": {
1517
+ * "osVer": "5.0",
1518
+ * "uniVer": "x",
1519
+ * "unixVer": "4.13"
1520
+ * },
1521
+ * "ios": {
1522
+ * "osVer": "12.0",
1523
+ * "uniVer": "x",
1524
+ * "unixVer": "x"
1525
+ * }
1526
+ * },
1527
+ * "web": {
1528
+ * "uniVer": "x",
1529
+ * "unixVer": "x"
1530
+ * }
1531
+ * }
1532
+ */
1533
+ open(options : OpenFileOptions) : void;
1534
+ /**
1535
+ * 同步打开文件,返回文件描述符
1536
+ * @uniPlatform {
1537
+ * "app": {
1538
+ * "android": {
1539
+ * "osVer": "5.0",
1540
+ * "uniVer": "x",
1541
+ * "unixVer": "4.13"
1542
+ * },
1543
+ * "ios": {
1544
+ * "osVer": "12.0",
1545
+ * "uniVer": "x",
1546
+ * "unixVer": "x"
1547
+ * }
1548
+ * },
1549
+ * "web": {
1550
+ * "uniVer": "x",
1551
+ * "unixVer": "x"
1552
+ * }
1553
+ * }
1554
+ */
1555
+ openSync(options : OpenFileSyncOptions) : string;
1556
+ /**
1557
+ * 写入文件
1558
+ * @uniPlatform {
1559
+ * "app": {
1560
+ * "android": {
1561
+ * "osVer": "5.0",
1562
+ * "uniVer": "x",
1563
+ * "unixVer": "4.13"
1564
+ * },
1565
+ * "ios": {
1566
+ * "osVer": "12.0",
1567
+ * "uniVer": "x",
1568
+ * "unixVer": "x"
1569
+ * }
1570
+ * },
1571
+ * "web": {
1572
+ * "uniVer": "x",
1573
+ * "unixVer": "x"
1574
+ * }
1575
+ * }
1576
+ */
1577
+ write(options : WriteOptions) : void;
1578
+ /**
1579
+ * 同步写入文件
1580
+ * @uniPlatform {
1581
+ * "app": {
1582
+ * "android": {
1583
+ * "osVer": "5.0",
1584
+ * "uniVer": "x",
1585
+ * "unixVer": "4.13"
1586
+ * },
1587
+ * "ios": {
1588
+ * "osVer": "12.0",
1589
+ * "uniVer": "x",
1590
+ * "unixVer": "x"
1591
+ * }
1592
+ * },
1593
+ * "web": {
1594
+ * "uniVer": "x",
1595
+ * "unixVer": "x"
1596
+ * }
1597
+ * }
1598
+ */
1599
+ writeSync(options : WriteSyncOptions) : WriteResult;
1600
+ /**
1601
+ * 关闭文件
1602
+ * @uniPlatform {
1603
+ * "app": {
1604
+ * "android": {
1605
+ * "osVer": "5.0",
1606
+ * "uniVer": "x",
1607
+ * "unixVer": "4.13"
1608
+ * },
1609
+ * "ios": {
1610
+ * "osVer": "12.0",
1611
+ * "uniVer": "x",
1612
+ * "unixVer": "x"
1613
+ * }
1614
+ * },
1615
+ * "web": {
1616
+ * "uniVer": "x",
1617
+ * "unixVer": "x"
1618
+ * }
1619
+ * }
1620
+ */
1621
+ close(options : CloseOptions);
1622
+ /**
1623
+ * 同步关闭文件
1624
+ * @uniPlatform {
1625
+ * "app": {
1626
+ * "android": {
1627
+ * "osVer": "5.0",
1628
+ * "uniVer": "x",
1629
+ * "unixVer": "4.13"
1630
+ * },
1631
+ * "ios": {
1632
+ * "osVer": "12.0",
1633
+ * "uniVer": "x",
1634
+ * "unixVer": "x"
1635
+ * }
1636
+ * },
1637
+ * "web": {
1638
+ * "uniVer": "x",
1639
+ * "unixVer": "x"
1640
+ * }
1641
+ * }
1642
+ */
1643
+ closeSync(options : CloseSyncOptions) : void;
1644
+ /**
1645
+ * 获取文件的状态信息
1646
+ * @uniPlatform {
1647
+ * "app": {
1648
+ * "android": {
1649
+ * "osVer": "5.0",
1650
+ * "uniVer": "x",
1651
+ * "unixVer": "4.13"
1652
+ * },
1653
+ * "ios": {
1654
+ * "osVer": "12.0",
1655
+ * "uniVer": "x",
1656
+ * "unixVer": "x"
1657
+ * }
1658
+ * },
1659
+ * "web": {
1660
+ * "uniVer": "x",
1661
+ * "unixVer": "x"
1662
+ * }
1663
+ * }
1664
+ */
1665
+ fstat(options : FStatOptions) : void;
1666
+ /**
1667
+ * 同步获取文件的状态信息
1668
+ * @uniPlatform {
1669
+ * "app": {
1670
+ * "android": {
1671
+ * "osVer": "5.0",
1672
+ * "uniVer": "x",
1673
+ * "unixVer": "4.13"
1674
+ * },
1675
+ * "ios": {
1676
+ * "osVer": "12.0",
1677
+ * "uniVer": "x",
1678
+ * "unixVer": "x"
1679
+ * }
1680
+ * },
1681
+ * "web": {
1682
+ * "uniVer": "x",
1683
+ * "unixVer": "x"
1684
+ * }
1685
+ * }
1686
+ */
1687
+ fstatSync(options : FStatSyncOptions) : Stats;
1688
+ /**
1689
+ * 对文件内容进行截断操作
1690
+ * @uniPlatform {
1691
+ * "app": {
1692
+ * "android": {
1693
+ * "osVer": "5.0",
1694
+ * "uniVer": "x",
1695
+ * "unixVer": "4.13"
1696
+ * },
1697
+ * "ios": {
1698
+ * "osVer": "12.0",
1699
+ * "uniVer": "x",
1700
+ * "unixVer": "x"
1701
+ * }
1702
+ * },
1703
+ * "web": {
1704
+ * "uniVer": "x",
1705
+ * "unixVer": "x"
1706
+ * }
1707
+ * }
1708
+ */
1709
+ ftruncate(options : FTruncateFileOptions) : void;
1710
+ /**
1711
+ * 同步对文件内容进行截断操作
1712
+ * @uniPlatform {
1713
+ * "app": {
1714
+ * "android": {
1715
+ * "osVer": "5.0",
1716
+ * "uniVer": "x",
1717
+ * "unixVer": "4.13"
1718
+ * },
1719
+ * "ios": {
1720
+ * "osVer": "12.0",
1721
+ * "uniVer": "x",
1722
+ * "unixVer": "x"
1723
+ * }
1724
+ * },
1725
+ * "web": {
1726
+ * "uniVer": "x",
1727
+ * "unixVer": "x"
1728
+ * }
1729
+ * }
1730
+ */
1731
+ ftruncateSync(options : FTruncateFileSyncOptions) : void;
1732
+ /**
1733
+ * 读取压缩包内的文件
1734
+ * @uniPlatform {
1735
+ * "app": {
1736
+ * "android": {
1737
+ * "osVer": "5.0",
1738
+ * "uniVer": "x",
1739
+ * "unixVer": "4.13"
1740
+ * },
1741
+ * "ios": {
1742
+ * "osVer": "12.0",
1743
+ * "uniVer": "x",
1744
+ * "unixVer": "x"
1745
+ * }
1746
+ * },
1747
+ * "web": {
1748
+ * "uniVer": "x",
1749
+ * "unixVer": "x"
1750
+ * }
1751
+ * }
1752
+ */
1753
+ readZipEntry(options : ReadZipEntryOptions) : void;
1754
+ }
1755
+
1756
+
1757
+ export type GetFileSystemManager = () => FileSystemManager;
1758
+
1759
+
1760
+ export interface Uni {
1761
+ /**
1762
+ * 获取文件管理器
1763
+ * @uniPlatform {
1764
+ * "app": {
1765
+ * "android": {
1766
+ * "osVer": "5.0",
1767
+ * "uniVer": "x",
1768
+ * "unixVer": "3.9.0"
1769
+ * },
1770
+ * "ios": {
1771
+ * "osVer": "12.0",
1772
+ * "uniVer": "x",
1773
+ * "unixVer": "4.11"
1774
+ * }
1775
+ * },
1776
+ * "web": {
1777
+ * "uniVer": "x",
1778
+ * "unixVer": "x"
1779
+ * }
1780
+ * }
1781
+ * @uniVueVersion 2,3 //支持的vue版本
1782
+ */
1783
+ getFileSystemManager() : FileSystemManager
1784
+ }