1/*
2 * Copyright (c) 2022-2023 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License"),
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16/**
17 * @file
18 * @kit CoreFileKit
19 */
20
21import type { AsyncCallback, Callback } from './@ohos.base';
22import Want from './@ohos.app.ability.Want';
23import Context from './application/Context';
24import { Filter } from './@ohos.file.fs';
25
26/**
27 * This module provides the capability to access user public files.
28 *
29 * @namespace fileAccess
30 * @syscap SystemCapability.FileManagement.UserFileService
31 * @since 9
32 */
33declare namespace fileAccess {
34  /**
35   * Query the want information of HAP configured with fileaccess.
36   *
37   * @permission ohos.permission.FILE_ACCESS_MANAGER and ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
38   * @param { AsyncCallback<Array<Want>> } callback - The callback is used to return a Array<Want> object.
39   * @throws { BusinessError } 13900001 - Operation not permitted
40   * @throws { BusinessError } 13900002 - No such file or directory
41   * @throws { BusinessError } 13900004 - Interrupted system call
42   * @throws { BusinessError } 13900006 - No such device or address
43   * @throws { BusinessError } 13900008 - Bad file descriptor
44   * @throws { BusinessError } 13900011 - Out of memory
45   * @throws { BusinessError } 13900012 - Permission denied
46   * @throws { BusinessError } 13900013 - Bad address
47   * @throws { BusinessError } 13900014 - Device or resource busy
48   * @throws { BusinessError } 13900015 - File exists
49   * @throws { BusinessError } 13900017 - No such device
50   * @throws { BusinessError } 13900018 - Not a directory
51   * @throws { BusinessError } 13900019 - Is a directory
52   * @throws { BusinessError } 13900020 - Invalid argument
53   * @throws { BusinessError } 13900022 - Too many open files
54   * @throws { BusinessError } 13900023 - Text file busy
55   * @throws { BusinessError } 13900024 - File too large
56   * @throws { BusinessError } 13900025 - No space left on device
57   * @throws { BusinessError } 13900027 - Read-only file system
58   * @throws { BusinessError } 13900029 - Resource deadlock would occur
59   * @throws { BusinessError } 13900030 - File name too long
60   * @throws { BusinessError } 13900033 - Too many symbolic links encountered
61   * @throws { BusinessError } 13900034 - Operation would block
62   * @throws { BusinessError } 13900038 - Value too large for defined data type
63   * @throws { BusinessError } 13900041 - Quota exceeded
64   * @throws { BusinessError } 13900042 - Unknown error
65   * @throws { BusinessError } 14300001 - IPC error
66   * @throws { BusinessError } 14300002 - Invalid uri
67   * @throws { BusinessError } 14300003 - Fail to get fileextension info
68   * @throws { BusinessError } 14300004 - Get wrong result
69   * @syscap SystemCapability.FileManagement.UserFileService
70   * @systemapi
71   * @StageModelOnly
72   * @since 9
73   */
74  function getFileAccessAbilityInfo(callback: AsyncCallback<Array<Want>>): void;
75
76  /**
77   * Query the want information of HAP configured with fileaccess.
78   *
79   * @permission ohos.permission.FILE_ACCESS_MANAGER and ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
80   * @returns { Promise<Array<Want>> } Returns the wants.
81   * @throws { BusinessError } 13900001 - Operation not permitted
82   * @throws { BusinessError } 13900002 - No such file or directory
83   * @throws { BusinessError } 13900004 - Interrupted system call
84   * @throws { BusinessError } 13900006 - No such device or address
85   * @throws { BusinessError } 13900008 - Bad file descriptor
86   * @throws { BusinessError } 13900011 - Out of memory
87   * @throws { BusinessError } 13900012 - Permission denied
88   * @throws { BusinessError } 13900013 - Bad address
89   * @throws { BusinessError } 13900014 - Device or resource busy
90   * @throws { BusinessError } 13900015 - File exists
91   * @throws { BusinessError } 13900017 - No such device
92   * @throws { BusinessError } 13900018 - Not a directory
93   * @throws { BusinessError } 13900019 - Is a directory
94   * @throws { BusinessError } 13900020 - Invalid argument
95   * @throws { BusinessError } 13900022 - Too many open files
96   * @throws { BusinessError } 13900023 - Text file busy
97   * @throws { BusinessError } 13900024 - File too large
98   * @throws { BusinessError } 13900025 - No space left on device
99   * @throws { BusinessError } 13900027 - Read-only file system
100   * @throws { BusinessError } 13900029 - Resource deadlock would occur
101   * @throws { BusinessError } 13900030 - File name too long
102   * @throws { BusinessError } 13900033 - Too many symbolic links encountered
103   * @throws { BusinessError } 13900034 - Operation would block
104   * @throws { BusinessError } 13900038 - Value too large for defined data type
105   * @throws { BusinessError } 13900041 - Quota exceeded
106   * @throws { BusinessError } 13900042 - Unknown error
107   * @throws { BusinessError } 14300001 - IPC error
108   * @throws { BusinessError } 14300002 - Invalid uri
109   * @throws { BusinessError } 14300003 - Fail to get fileextension info
110   * @throws { BusinessError } 14300004 - Get wrong result
111   * @syscap SystemCapability.FileManagement.UserFileService
112   * @systemapi
113   * @StageModelOnly
114   * @since 9
115   */
116  function getFileAccessAbilityInfo(): Promise<Array<Want>>;
117
118  /**
119   * Obtains the fileAccessHelper that connects all fileaccess servers in the system.
120   *
121   * @permission ohos.permission.FILE_ACCESS_MANAGER and ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
122   * @param { Context } context Indicates the application context.
123   * @returns { FileAccessHelper } Returns the fileAccessHelper.
124   * @throws { BusinessError } 13900001 - Operation not permitted
125   * @throws { BusinessError } 13900002 - No such file or directory
126   * @throws { BusinessError } 13900004 - Interrupted system call
127   * @throws { BusinessError } 13900006 - No such device or address
128   * @throws { BusinessError } 13900008 - Bad file descriptor
129   * @throws { BusinessError } 13900011 - Out of memory
130   * @throws { BusinessError } 13900012 - Permission denied
131   * @throws { BusinessError } 13900013 - Bad address
132   * @throws { BusinessError } 13900014 - Device or resource busy
133   * @throws { BusinessError } 13900015 - File exists
134   * @throws { BusinessError } 13900017 - No such device
135   * @throws { BusinessError } 13900018 - Not a directory
136   * @throws { BusinessError } 13900019 - Is a directory
137   * @throws { BusinessError } 13900020 - Invalid argument
138   * @throws { BusinessError } 13900022 - Too many open files
139   * @throws { BusinessError } 13900023 - Text file busy
140   * @throws { BusinessError } 13900024 - File too large
141   * @throws { BusinessError } 13900025 - No space left on device
142   * @throws { BusinessError } 13900027 - Read-only file system
143   * @throws { BusinessError } 13900029 - Resource deadlock would occur
144   * @throws { BusinessError } 13900030 - File name too long
145   * @throws { BusinessError } 13900033 - Too many symbolic links encountered
146   * @throws { BusinessError } 13900034 - Operation would block
147   * @throws { BusinessError } 13900038 - Value too large for defined data type
148   * @throws { BusinessError } 13900041 - Quota exceeded
149   * @throws { BusinessError } 13900042 - Unknown error
150   * @throws { BusinessError } 14300001 - IPC error
151   * @throws { BusinessError } 14300002 - Invalid uri
152   * @throws { BusinessError } 14300003 - Fail to get fileextension info
153   * @throws { BusinessError } 14300004 - Get wrong result
154   * @syscap SystemCapability.FileManagement.UserFileService
155   * @systemapi
156   * @StageModelOnly
157   * @since 9
158   */
159  function createFileAccessHelper(context: Context): FileAccessHelper;
160
161  /**
162   * Obtains the fileAccessHelper that connects some specified fileaccess servers in the system.
163   *
164   * @permission ohos.permission.FILE_ACCESS_MANAGER and ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
165   * @param { Context } context Indicates the application context.
166   * @param { Array<Want> } wants Represents the connected data provider.
167   * @returns { FileAccessHelper } Returns the fileAccessHelper.
168   * @throws { BusinessError } 13900001 - Operation not permitted
169   * @throws { BusinessError } 13900002 - No such file or directory
170   * @throws { BusinessError } 13900004 - Interrupted system call
171   * @throws { BusinessError } 13900006 - No such device or address
172   * @throws { BusinessError } 13900008 - Bad file descriptor
173   * @throws { BusinessError } 13900011 - Out of memory
174   * @throws { BusinessError } 13900012 - Permission denied
175   * @throws { BusinessError } 13900013 - Bad address
176   * @throws { BusinessError } 13900014 - Device or resource busy
177   * @throws { BusinessError } 13900015 - File exists
178   * @throws { BusinessError } 13900017 - No such device
179   * @throws { BusinessError } 13900018 - Not a directory
180   * @throws { BusinessError } 13900019 - Is a directory
181   * @throws { BusinessError } 13900020 - Invalid argument
182   * @throws { BusinessError } 13900022 - Too many open files
183   * @throws { BusinessError } 13900023 - Text file busy
184   * @throws { BusinessError } 13900024 - File too large
185   * @throws { BusinessError } 13900025 - No space left on device
186   * @throws { BusinessError } 13900027 - Read-only file system
187   * @throws { BusinessError } 13900029 - Resource deadlock would occur
188   * @throws { BusinessError } 13900030 - File name too long
189   * @throws { BusinessError } 13900033 - Too many symbolic links encountered
190   * @throws { BusinessError } 13900034 - Operation would block
191   * @throws { BusinessError } 13900038 - Value too large for defined data type
192   * @throws { BusinessError } 13900041 - Quota exceeded
193   * @throws { BusinessError } 13900042 - Unknown error
194   * @throws { BusinessError } 14300001 - IPC error
195   * @throws { BusinessError } 14300002 - Invalid uri
196   * @throws { BusinessError } 14300003 - Fail to get fileextension info
197   * @throws { BusinessError } 14300004 - Get wrong result
198   * @syscap SystemCapability.FileManagement.UserFileService
199   * @systemapi
200   * @StageModelOnly
201   * @since 9
202   */
203  function createFileAccessHelper(context: Context, wants: Array<Want>): FileAccessHelper;
204
205  /**
206   * File Object
207   *
208   * @interface FileInfo
209   * @syscap SystemCapability.FileManagement.UserFileService
210   * @systemapi
211   * @StageModelOnly
212   * @since 9
213   */
214  interface FileInfo {
215    /**
216     * Indicates the path of the file.
217     *
218     * @permission ohos.permission.FILE_ACCESS_MANAGER
219     * @type { string }
220     * @readonly
221     * @syscap SystemCapability.FileManagement.UserFileService
222     * @systemapi
223     * @StageModelOnly
224     * @since 9
225     */
226    uri: string;
227    /**
228     * Indicates the relativePath of the file.
229     *
230     * @permission ohos.permission.FILE_ACCESS_MANAGER
231     * @type { string }
232     * @readonly
233     * @syscap SystemCapability.FileManagement.UserFileService
234     * @systemapi
235     * @StageModelOnly
236     * @since 10
237     */
238    relativePath: string;
239    /**
240     * Indicates the name of the file.
241     *
242     * @permission ohos.permission.FILE_ACCESS_MANAGER
243     * @type { string }
244     * @readonly
245     * @syscap SystemCapability.FileManagement.UserFileService
246     * @systemapi
247     * @StageModelOnly
248     * @since 9
249     */
250    fileName: string;
251    /**
252     * Indicates the mode of the file.
253     *
254     * @permission ohos.permission.FILE_ACCESS_MANAGER
255     * @type { number }
256     * @readonly
257     * @syscap SystemCapability.FileManagement.UserFileService
258     * @systemapi
259     * @StageModelOnly
260     * @since 9
261     */
262    mode: number;
263    /**
264     * Indicates the size of the file.
265     *
266     * @permission ohos.permission.FILE_ACCESS_MANAGER
267     * @type { number }
268     * @readonly
269     * @syscap SystemCapability.FileManagement.UserFileService
270     * @systemapi
271     * @StageModelOnly
272     * @since 9
273     */
274    size: number;
275    /**
276     * Indicates the mtime of the file.
277     *
278     * @permission ohos.permission.FILE_ACCESS_MANAGER
279     * @type { number }
280     * @readonly
281     * @syscap SystemCapability.FileManagement.UserFileService
282     * @systemapi
283     * @StageModelOnly
284     * @since 9
285     */
286    mtime: number;
287    /**
288     * Indicates the mimeType of the file.
289     *
290     * @permission ohos.permission.FILE_ACCESS_MANAGER
291     * @type { string }
292     * @readonly
293     * @syscap SystemCapability.FileManagement.UserFileService
294     * @systemapi
295     * @StageModelOnly
296     * @since 9
297     */
298    mimeType: string;
299
300    /**
301     * List files in the current directory.
302     *
303     * @permission ohos.permission.FILE_ACCESS_MANAGER
304     * @param { Filter } filter Indicates the filter of file.
305     * @returns { FileIterator } Returns the FileIterator Object.
306     * @throws { BusinessError } 13900001 - Operation not permitted
307     * @throws { BusinessError } 13900002 - No such file or directory
308     * @throws { BusinessError } 13900004 - Interrupted system call
309     * @throws { BusinessError } 13900006 - No such device or address
310     * @throws { BusinessError } 13900008 - Bad file descriptor
311     * @throws { BusinessError } 13900011 - Out of memory
312     * @throws { BusinessError } 13900012 - Permission denied
313     * @throws { BusinessError } 13900013 - Bad address
314     * @throws { BusinessError } 13900014 - Device or resource busy
315     * @throws { BusinessError } 13900015 - File exists
316     * @throws { BusinessError } 13900017 - No such device
317     * @throws { BusinessError } 13900018 - Not a directory
318     * @throws { BusinessError } 13900019 - Is a directory
319     * @throws { BusinessError } 13900020 - Invalid argument
320     * @throws { BusinessError } 13900022 - Too many open files
321     * @throws { BusinessError } 13900023 - Text file busy
322     * @throws { BusinessError } 13900024 - File too large
323     * @throws { BusinessError } 13900025 - No space left on device
324     * @throws { BusinessError } 13900027 - Read-only file system
325     * @throws { BusinessError } 13900029 - Resource deadlock would occur
326     * @throws { BusinessError } 13900030 - File name too long
327     * @throws { BusinessError } 13900033 - Too many symbolic links encountered
328     * @throws { BusinessError } 13900034 - Operation would block
329     * @throws { BusinessError } 13900038 - Value too large for defined data type
330     * @throws { BusinessError } 13900041 - Quota exceeded
331     * @throws { BusinessError } 13900042 - Unknown error
332     * @throws { BusinessError } 14000001 - Invalid display name
333     * @throws { BusinessError } 14000002 - Invalid uri
334     * @throws { BusinessError } 14000003 - Invalid file extension
335     * @throws { BusinessError } 14000004 - File has been put into trash bin
336     * @throws { BusinessError } 14300001 - IPC error
337     * @throws { BusinessError } 14300002 - Invalid uri
338     * @throws { BusinessError } 14300003 - Fail to get fileextension info
339     * @throws { BusinessError } 14300004 - Get wrong result
340     * @syscap SystemCapability.FileManagement.UserFileService
341     * @systemapi
342     * @StageModelOnly
343     * @since 9
344     */
345    listFile(filter?: Filter): FileIterator;
346
347    /**
348     * Recursively list all files in the current directory.
349     *
350     * @permission ohos.permission.FILE_ACCESS_MANAGER
351     * @param { Filter } filter Indicates the filter of file.
352     * @returns { FileIterator } Returns the FileIterator Object.
353     * @throws { BusinessError } 13900001 - Operation not permitted
354     * @throws { BusinessError } 13900002 - No such file or directory
355     * @throws { BusinessError } 13900004 - Interrupted system call
356     * @throws { BusinessError } 13900006 - No such device or address
357     * @throws { BusinessError } 13900008 - Bad file descriptor
358     * @throws { BusinessError } 13900011 - Out of memory
359     * @throws { BusinessError } 13900012 - Permission denied
360     * @throws { BusinessError } 13900013 - Bad address
361     * @throws { BusinessError } 13900014 - Device or resource busy
362     * @throws { BusinessError } 13900015 - File exists
363     * @throws { BusinessError } 13900017 - No such device
364     * @throws { BusinessError } 13900018 - Not a directory
365     * @throws { BusinessError } 13900019 - Is a directory
366     * @throws { BusinessError } 13900020 - Invalid argument
367     * @throws { BusinessError } 13900022 - Too many open files
368     * @throws { BusinessError } 13900023 - Text file busy
369     * @throws { BusinessError } 13900024 - File too large
370     * @throws { BusinessError } 13900025 - No space left on device
371     * @throws { BusinessError } 13900027 - Read-only file system
372     * @throws { BusinessError } 13900029 - Resource deadlock would occur
373     * @throws { BusinessError } 13900030 - File name too long
374     * @throws { BusinessError } 13900033 - Too many symbolic links encountered
375     * @throws { BusinessError } 13900034 - Operation would block
376     * @throws { BusinessError } 13900038 - Value too large for defined data type
377     * @throws { BusinessError } 13900041 - Quota exceeded
378     * @throws { BusinessError } 13900042 - Unknown error
379     * @throws { BusinessError } 14000001 - Invalid display name
380     * @throws { BusinessError } 14000002 - Invalid uri
381     * @throws { BusinessError } 14000003 - Invalid file extension
382     * @throws { BusinessError } 14000004 - File has been put into trash bin
383     * @throws { BusinessError } 14300001 - IPC error
384     * @throws { BusinessError } 14300002 - Invalid uri
385     * @throws { BusinessError } 14300003 - Fail to get fileextension info
386     * @throws { BusinessError } 14300004 - Get wrong result
387     * @syscap SystemCapability.FileManagement.UserFileService
388     * @systemapi
389     * @StageModelOnly
390     * @since 9
391     */
392    scanFile(filter?: Filter): FileIterator;
393  }
394
395  /**
396   * FileIterator Object
397   *
398   * @interface FileIterator
399   * @syscap SystemCapability.FileManagement.UserFileService
400   * @systemapi
401   * @StageModelOnly
402   * @since 9
403   */
404  interface FileIterator {
405    /**
406     * Get the next fileInfo.
407     *
408     * @permission ohos.permission.FILE_ACCESS_MANAGER
409     * @returns { object } Returns FileInfo Object and boolean flag.
410     * @throws { BusinessError } 13900001 - Operation not permitted
411     * @throws { BusinessError } 13900002 - No such file or directory
412     * @throws { BusinessError } 13900004 - Interrupted system call
413     * @throws { BusinessError } 13900006 - No such device or address
414     * @throws { BusinessError } 13900008 - Bad file descriptor
415     * @throws { BusinessError } 13900011 - Out of memory
416     * @throws { BusinessError } 13900012 - Permission denied
417     * @throws { BusinessError } 13900013 - Bad address
418     * @throws { BusinessError } 13900014 - Device or resource busy
419     * @throws { BusinessError } 13900015 - File exists
420     * @throws { BusinessError } 13900017 - No such device
421     * @throws { BusinessError } 13900018 - Not a directory
422     * @throws { BusinessError } 13900019 - Is a directory
423     * @throws { BusinessError } 13900020 - Invalid argument
424     * @throws { BusinessError } 13900022 - Too many open files
425     * @throws { BusinessError } 13900023 - Text file busy
426     * @throws { BusinessError } 13900024 - File too large
427     * @throws { BusinessError } 13900025 - No space left on device
428     * @throws { BusinessError } 13900027 - Read-only file system
429     * @throws { BusinessError } 13900029 - Resource deadlock would occur
430     * @throws { BusinessError } 13900030 - File name too long
431     * @throws { BusinessError } 13900033 - Too many symbolic links encountered
432     * @throws { BusinessError } 13900034 - Operation would block
433     * @throws { BusinessError } 13900038 - Value too large for defined data type
434     * @throws { BusinessError } 13900041 - Quota exceeded
435     * @throws { BusinessError } 13900042 - Unknown error
436     * @throws { BusinessError } 14000001 - Invalid display name
437     * @throws { BusinessError } 14000002 - Invalid uri
438     * @throws { BusinessError } 14000003 - Invalid file extension
439     * @throws { BusinessError } 14000004 - File has been put into trash bin
440     * @throws { BusinessError } 14300001 - IPC error
441     * @throws { BusinessError } 14300002 - Invalid uri
442     * @throws { BusinessError } 14300003 - Fail to get fileextension info
443     * @throws { BusinessError } 14300004 - Get wrong result
444     * @syscap SystemCapability.FileManagement.UserFileService
445     * @systemapi
446     * @StageModelOnly
447     * @since 9
448     */
449    next(): { value: FileInfo, done: boolean };
450  }
451
452  /**
453   * Root Object
454   *
455   * @interface RootInfo
456   * @syscap SystemCapability.FileManagement.UserFileService
457   * @systemapi
458   * @StageModelOnly
459   * @since 9
460   */
461  interface RootInfo {
462    /**
463     * @permission ohos.permission.FILE_ACCESS_MANAGER
464     * @type { number }
465     * @readonly
466     * @syscap SystemCapability.FileManagement.UserFileService
467     * @systemapi
468     * @StageModelOnly
469     * @since 9
470     */
471    deviceType: number;
472    /**
473     * @permission ohos.permission.FILE_ACCESS_MANAGER
474     * @type { string }
475     * @readonly
476     * @syscap SystemCapability.FileManagement.UserFileService
477     * @systemapi
478     * @StageModelOnly
479     * @since 9
480     */
481    uri: string;
482    /**
483     * File or directory relative path
484     *
485     * @permission ohos.permission.FILE_ACCESS_MANAGER
486     * @type { string }
487     * @readonly
488     * @syscap SystemCapability.FileManagement.UserFileService
489     * @systemapi
490     * @StageModelOnly
491     * @since 10
492     */
493    relativePath: string;
494    /**
495     * @permission ohos.permission.FILE_ACCESS_MANAGER
496     * @type { string }
497     * @readonly
498     * @syscap SystemCapability.FileManagement.UserFileService
499     * @systemapi
500     * @StageModelOnly
501     * @since 9
502     */
503    displayName: string;
504    /**
505     * @permission ohos.permission.FILE_ACCESS_MANAGER
506     * @type { number }
507     * @readonly
508     * @syscap SystemCapability.FileManagement.UserFileService
509     * @systemapi
510     * @StageModelOnly
511     * @since 9
512     */
513    deviceFlags: number;
514
515    /**
516     * List files in the current directory.
517     *
518     * @permission ohos.permission.FILE_ACCESS_MANAGER
519     * @param { Filter } filter Indicates the filter of file.
520     * @returns { FileIterator } Returns the FileIterator Object.
521     * @throws { BusinessError } 13900001 - Operation not permitted
522     * @throws { BusinessError } 13900002 - No such file or directory
523     * @throws { BusinessError } 13900004 - Interrupted system call
524     * @throws { BusinessError } 13900006 - No such device or address
525     * @throws { BusinessError } 13900008 - Bad file descriptor
526     * @throws { BusinessError } 13900011 - Out of memory
527     * @throws { BusinessError } 13900012 - Permission denied
528     * @throws { BusinessError } 13900013 - Bad address
529     * @throws { BusinessError } 13900014 - Device or resource busy
530     * @throws { BusinessError } 13900015 - File exists
531     * @throws { BusinessError } 13900017 - No such device
532     * @throws { BusinessError } 13900018 - Not a directory
533     * @throws { BusinessError } 13900019 - Is a directory
534     * @throws { BusinessError } 13900020 - Invalid argument
535     * @throws { BusinessError } 13900022 - Too many open files
536     * @throws { BusinessError } 13900023 - Text file busy
537     * @throws { BusinessError } 13900024 - File too large
538     * @throws { BusinessError } 13900025 - No space left on device
539     * @throws { BusinessError } 13900027 - Read-only file system
540     * @throws { BusinessError } 13900029 - Resource deadlock would occur
541     * @throws { BusinessError } 13900030 - File name too long
542     * @throws { BusinessError } 13900033 - Too many symbolic links encountered
543     * @throws { BusinessError } 13900034 - Operation would block
544     * @throws { BusinessError } 13900038 - Value too large for defined data type
545     * @throws { BusinessError } 13900041 - Quota exceeded
546     * @throws { BusinessError } 13900042 - Unknown error
547     * @throws { BusinessError } 14000001 - Invalid display name
548     * @throws { BusinessError } 14000002 - Invalid uri
549     * @throws { BusinessError } 14000003 - Invalid file extension
550     * @throws { BusinessError } 14000004 - File has been put into trash bin
551     * @throws { BusinessError } 14300001 - IPC error
552     * @throws { BusinessError } 14300002 - Invalid uri
553     * @throws { BusinessError } 14300003 - Fail to get fileextension info
554     * @throws { BusinessError } 14300004 - Get wrong result
555     * @syscap SystemCapability.FileManagement.UserFileService
556     * @systemapi
557     * @StageModelOnly
558     * @since 9
559     */
560    listFile(filter?: Filter): FileIterator;
561
562    /**
563     * Recursively list all files in the current directory.
564     *
565     * @permission ohos.permission.FILE_ACCESS_MANAGER
566     * @param { Filter } filter Indicates the filter of file.
567     * @returns { FileIterator } Returns the RootIterator Object.
568     * @throws { BusinessError } 13900001 - Operation not permitted
569     * @throws { BusinessError } 13900002 - No such file or directory
570     * @throws { BusinessError } 13900004 - Interrupted system call
571     * @throws { BusinessError } 13900006 - No such device or address
572     * @throws { BusinessError } 13900008 - Bad file descriptor
573     * @throws { BusinessError } 13900011 - Out of memory
574     * @throws { BusinessError } 13900012 - Permission denied
575     * @throws { BusinessError } 13900013 - Bad address
576     * @throws { BusinessError } 13900014 - Device or resource busy
577     * @throws { BusinessError } 13900015 - File exists
578     * @throws { BusinessError } 13900017 - No such device
579     * @throws { BusinessError } 13900018 - Not a directory
580     * @throws { BusinessError } 13900019 - Is a directory
581     * @throws { BusinessError } 13900020 - Invalid argument
582     * @throws { BusinessError } 13900022 - Too many open files
583     * @throws { BusinessError } 13900023 - Text file busy
584     * @throws { BusinessError } 13900024 - File too large
585     * @throws { BusinessError } 13900025 - No space left on device
586     * @throws { BusinessError } 13900027 - Read-only file system
587     * @throws { BusinessError } 13900029 - Resource deadlock would occur
588     * @throws { BusinessError } 13900030 - File name too long
589     * @throws { BusinessError } 13900033 - Too many symbolic links encountered
590     * @throws { BusinessError } 13900034 - Operation would block
591     * @throws { BusinessError } 13900038 - Value too large for defined data type
592     * @throws { BusinessError } 13900041 - Quota exceeded
593     * @throws { BusinessError } 13900042 - Unknown error
594     * @throws { BusinessError } 14000001 - Invalid display name
595     * @throws { BusinessError } 14000002 - Invalid uri
596     * @throws { BusinessError } 14000003 - Invalid file extension
597     * @throws { BusinessError } 14000004 - File has been put into trash bin
598     * @throws { BusinessError } 14300001 - IPC error
599     * @throws { BusinessError } 14300002 - Invalid uri
600     * @throws { BusinessError } 14300003 - Fail to get fileextension info
601     * @throws { BusinessError } 14300004 - Get wrong result
602     * @syscap SystemCapability.FileManagement.UserFileService
603     * @systemapi
604     * @StageModelOnly
605     * @since 9
606     */
607    scanFile(filter?: Filter): FileIterator;
608  }
609
610  /**
611   * RootIterator Object
612   *
613   * @interface RootIterator
614   * @syscap SystemCapability.FileManagement.UserFileService
615   * @systemapi
616   * @StageModelOnly
617   * @since 9
618   */
619  interface RootIterator {
620    /**
621     * Get a next RootInfo.
622     *
623     * @permission ohos.permission.FILE_ACCESS_MANAGER
624     * @returns { object } Returns RootInfo Object and boolean flag.
625     * @throws { BusinessError } 13900001 - Operation not permitted
626     * @throws { BusinessError } 13900002 - No such file or directory
627     * @throws { BusinessError } 13900004 - Interrupted system call
628     * @throws { BusinessError } 13900006 - No such device or address
629     * @throws { BusinessError } 13900008 - Bad file descriptor
630     * @throws { BusinessError } 13900011 - Out of memory
631     * @throws { BusinessError } 13900012 - Permission denied
632     * @throws { BusinessError } 13900013 - Bad address
633     * @throws { BusinessError } 13900014 - Device or resource busy
634     * @throws { BusinessError } 13900015 - File exists
635     * @throws { BusinessError } 13900017 - No such device
636     * @throws { BusinessError } 13900018 - Not a directory
637     * @throws { BusinessError } 13900019 - Is a directory
638     * @throws { BusinessError } 13900020 - Invalid argument
639     * @throws { BusinessError } 13900022 - Too many open files
640     * @throws { BusinessError } 13900023 - Text file busy
641     * @throws { BusinessError } 13900024 - File too large
642     * @throws { BusinessError } 13900025 - No space left on device
643     * @throws { BusinessError } 13900027 - Read-only file system
644     * @throws { BusinessError } 13900029 - Resource deadlock would occur
645     * @throws { BusinessError } 13900030 - File name too long
646     * @throws { BusinessError } 13900033 - Too many symbolic links encountered
647     * @throws { BusinessError } 13900034 - Operation would block
648     * @throws { BusinessError } 13900038 - Value too large for defined data type
649     * @throws { BusinessError } 13900041 - Quota exceeded
650     * @throws { BusinessError } 13900042 - Unknown error
651     * @throws { BusinessError } 14000001 - Invalid display name
652     * @throws { BusinessError } 14000002 - Invalid uri
653     * @throws { BusinessError } 14000003 - Invalid file extension
654     * @throws { BusinessError } 14000004 - File has been put into trash bin
655     * @throws { BusinessError } 14300001 - IPC error
656     * @throws { BusinessError } 14300002 - Invalid uri
657     * @throws { BusinessError } 14300003 - Fail to get fileextension info
658     * @throws { BusinessError } 14300004 - Get wrong result
659     * @syscap SystemCapability.FileManagement.UserFileService
660     * @systemapi
661     * @StageModelOnly
662     * @since 9
663     */
664    next(): { value: RootInfo, done: boolean };
665  }
666
667  /**
668   * Describes the return information of the copy operation.
669   *
670   * @interface CopyResult
671   * @syscap SystemCapability.FileManagement.UserFileService
672   * @systemapi
673   * @since 10
674   */
675  interface CopyResult {
676    /**
677     * Represents the source file or directory uri to be copied
678     *
679     * @permission ohos.permission.FILE_ACCESS_MANAGER
680     * @type { string }
681     * @readonly
682     * @syscap SystemCapability.FileManagement.UserFileService
683     * @systemapi
684     * @stagemodeonly
685     * @since 10
686     */
687    sourceUri: string;
688    /**
689     * Represents a file or directory uri in the target folder
690     *
691     * @permission ohos.permission.FILE_ACCESS_MANAGER
692     * @type { string }
693     * @readonly
694     * @syscap SystemCapability.FileManagement.UserFileService
695     * @systemapi
696     * @stagemodeonly
697     * @since 10
698     */
699    destUri: string;
700    /**
701     * Error code for failure to copy a file or directory.
702     *
703     * @permission ohos.permission.FILE_ACCESS_MANAGER
704     * @type { number }
705     * @readonly
706     * @syscap SystemCapability.FileManagement.UserFileService
707     * @systemapi
708     * @stagemodeonly
709     * @since 10
710     */
711    errCode: number;
712    /**
713     * Error message for failure to copy a file or directory.
714     *
715     * @permission ohos.permission.FILE_ACCESS_MANAGER
716     * @type { string }
717     * @readonly
718     * @syscap SystemCapability.FileManagement.UserFileService
719     * @systemapi
720     * @stagemodeonly
721     * @since 10
722     */
723    errMsg: string;
724  }
725
726  /**
727   * OPENFLAGS represents the way to open the file.
728   *
729   * @enum { number } OPENFLAGS
730   * @syscap SystemCapability.FileManagement.UserFileService
731   * @systemapi
732   * @StageModelOnly
733   * @since 9
734   */
735  enum OPENFLAGS {
736    /**
737     * Open the file by Read-only mode.
738     *
739     * @syscap SystemCapability.FileManagement.UserFileService
740     * @systemapi
741     * @StageModelOnly
742     * @since 9
743     */
744    READ = 0o0,
745
746    /**
747     * Open the file by Write-only mode.
748     *
749     * @syscap SystemCapability.FileManagement.UserFileService
750     * @systemapi
751     * @StageModelOnly
752     * @since 9
753     */
754    WRITE = 0o1,
755
756    /**
757     * Open the file by Write-Read mode.
758     *
759     * @syscap SystemCapability.FileManagement.UserFileService
760     * @systemapi
761     * @StageModelOnly
762     * @since 9
763     */
764    WRITE_READ = 0o2
765  }
766
767  /**
768   * Property elements that support the file queries.
769   *
770   * @enum { string } FileKey
771   * @syscap SystemCapability.FileManagement.UserFileService
772   * @systemapi
773   * @StageModelOnly
774   * @since 10
775   */
776  enum FileKey {
777    /**
778     * The key represents the file name.
779     *
780     * @syscap SystemCapability.FileManagement.UserFileService
781     * @systemapi
782     * @StageModelOnly
783     * @since 10
784     */
785    DISPLAY_NAME = 'display_name',
786
787    /**
788     * The key represents the date of the file creation.
789     *
790     * @syscap SystemCapability.FileManagement.UserFileService
791     * @systemapi
792     * @StageModelOnly
793     * @since 10
794     */
795    DATE_ADDED = 'date_added',
796
797    /**
798     * The key represents the modify date of the file.
799     *
800     * @syscap SystemCapability.FileManagement.UserFileService
801     * @systemapi
802     * @StageModelOnly
803     * @since 10
804     */
805    DATE_MODIFIED = 'date_modified',
806
807    /**
808     * The key represents the relative path.
809     *
810     * @syscap SystemCapability.FileManagement.UserFileService
811     * @systemapi
812     * @StageModelOnly
813     * @since 10
814     */
815    RELATIVE_PATH = 'relative_path',
816
817    /**
818     * The key represents the file size.
819     *
820     * @syscap SystemCapability.FileManagement.UserFileService
821     * @systemapi
822     * @StageModelOnly
823     * @since 10
824     */
825    FILE_SIZE = 'size'
826  }
827
828  /**
829   * Describes the notifyType.
830   *
831   * @enum { number } NotifyType
832   * @syscap SystemCapability.FileManagement.UserFileService
833   * @systemapi
834   * @StageModelOnly
835   * @since 10
836   */
837  enum NotifyType {
838    /**
839     * Type for add notification
840     *
841     * @syscap SystemCapability.FileManagement.UserFileService
842     * @systemapi
843     * @StageModelOnly
844     * @since 10
845     */
846    NOTIFY_ADD,
847
848    /**
849     * Type for delete notification
850     *
851     * @syscap SystemCapability.FileManagement.UserFileService
852     * @systemapi
853     * @StageModelOnly
854     * @since 10
855     */
856    NOTIFY_DELETE,
857
858    /**
859     * The file was moved into the monitored directory.
860     *
861     * @syscap SystemCapability.FileManagement.UserFileService
862     * @systemapi
863     * @StageModelOnly
864     * @since 10
865     */
866    NOTIFY_MOVED_TO,
867
868    /**
869     * The file in the monitored directory was moved.
870     *
871     * @syscap SystemCapability.FileManagement.UserFileService
872     * @systemapi
873     * @StageModelOnly
874     * @since 10
875     */
876    NOTIFY_MOVED_FROM,
877
878    /**
879     * The monitored file or directory was moved.
880     *
881     * @syscap SystemCapability.FileManagement.UserFileService
882     * @systemapi
883     * @StageModelOnly
884     * @since 10
885     */
886    NOTIFY_MOVE_SELF,
887
888    /**
889     * Event type of device online.
890     *
891     * @syscap SystemCapability.FileManagement.UserFileService
892     * @systemapi
893     * @StageModelOnly
894     * @since 11
895     */
896    NOTIFY_DEVICE_ONLINE,
897
898    /**
899     * Event type of device offline.
900     *
901     * @syscap SystemCapability.FileManagement.UserFileService
902     * @systemapi
903     * @StageModelOnly
904     * @since 11
905     */
906    NOTIFY_DEVICE_OFFLINE
907  }
908
909  /**
910   * The value of the notify callback function
911   *
912   * @interface NotifyMessage
913   * @syscap SystemCapability.FileManagement.UserFileService
914   * @systemapi
915   * @StageModelOnly
916   * @since 10
917   */
918  interface NotifyMessage {
919    /**
920     * Indicates the change type.
921     *
922     * @permission ohos.permission.FILE_ACCESS_MANAGER
923     * @type { NotifyType }
924     * @readonly
925     * @syscap SystemCapability.FileManagement.UserFileService
926     * @systemapi
927     * @StageModelOnly
928     * @since 10
929     */
930    type: NotifyType;
931
932    /**
933     * Indicates the uris generated the change event.
934     *
935     * @permission ohos.permission.FILE_ACCESS_MANAGER
936     * @type { Array<string> }
937     * @readonly
938     * @syscap SystemCapability.FileManagement.UserFileService
939     * @systemapi
940     * @StageModelOnly
941     * @since 10
942     */
943    uris: Array<string>;
944  }
945
946  /**
947   * Describes the return information of the move operation.
948   *
949   * @interface MoveResult
950   * @syscap SystemCapability.FileManagement.UserFileService
951   * @systemapi
952   * @StageModelOnly
953   * @since 11
954   */
955  interface MoveResult {
956    /**
957     * Indicates the source file or directory uri to be moved.
958     *
959     * @permission ohos.permission.FILE_ACCESS_MANAGER
960     * @type { string }
961     * @readonly
962     * @syscap SystemCapability.FileManagement.UserFileService
963     * @systemapi
964     * @StageModelOnly
965     * @since 11
966     */
967    sourceUri: string;
968
969    /**
970     * Indicates the file or directory uri in the destination folder.
971     *
972     * @permission ohos.permission.FILE_ACCESS_MANAGER
973     * @type { string }
974     * @readonly
975     * @syscap SystemCapability.FileManagement.UserFileService
976     * @systemapi
977     * @StageModelOnly
978     * @since 11
979     */
980    destUri: string;
981
982    /**
983     * Error code for failure to move a file or directory.
984     *
985     * @permission ohos.permission.FILE_ACCESS_MANAGER
986     * @type { number }
987     * @readonly
988     * @syscap SystemCapability.FileManagement.UserFileService
989     * @systemapi
990     * @StageModelOnly
991     * @since 11
992     */
993    errCode: number;
994
995    /**
996     * Error message for failure to move a file.
997     *
998     * @permission ohos.permission.FILE_ACCESS_MANAGER
999     * @type { string }
1000     * @readonly
1001     * @syscap SystemCapability.FileManagement.UserFileService
1002     * @systemapi
1003     * @StageModelOnly
1004     * @since 11
1005     */
1006    errMsg: string;
1007  }
1008
1009  /**
1010   * Indicates the root uri of the device
1011   *
1012   * @constant
1013   * @syscap SystemCapability.FileManagement.UserFileService
1014   * @systemapi
1015   * @StageModelOnly
1016   * @since 11
1017   */
1018  const DEVICES_URI = 'file://docs';
1019
1020  /**
1021   * FileAccessHelper Object
1022   *
1023   * @interface FileAccessHelper
1024   * @syscap SystemCapability.FileManagement.UserFileService
1025   * @systemapi
1026   * @since 9
1027   */
1028  interface FileAccessHelper {
1029    /**
1030     * Open a file.
1031     *
1032     * @permission ohos.permission.FILE_ACCESS_MANAGER
1033     * @param { string } uri Indicates the path of the file to open.
1034     * @param { OPENFLAGS } flags Indicate options of opening a file. The default value is read-only.
1035     * @returns { Promise<number> } Returns the file descriptor.
1036     * @throws { BusinessError } 13900001 - Operation not permitted
1037     * @throws { BusinessError } 13900002 - No such file or directory
1038     * @throws { BusinessError } 13900004 - Interrupted system call
1039     * @throws { BusinessError } 13900006 - No such device or address
1040     * @throws { BusinessError } 13900008 - Bad file descriptor
1041     * @throws { BusinessError } 13900011 - Out of memory
1042     * @throws { BusinessError } 13900012 - Permission denied
1043     * @throws { BusinessError } 13900013 - Bad address
1044     * @throws { BusinessError } 13900014 - Device or resource busy
1045     * @throws { BusinessError } 13900015 - File exists
1046     * @throws { BusinessError } 13900017 - No such device
1047     * @throws { BusinessError } 13900018 - Not a directory
1048     * @throws { BusinessError } 13900019 - Is a directory
1049     * @throws { BusinessError } 13900020 - Invalid argument
1050     * @throws { BusinessError } 13900022 - Too many open files
1051     * @throws { BusinessError } 13900023 - Text file busy
1052     * @throws { BusinessError } 13900024 - File too large
1053     * @throws { BusinessError } 13900025 - No space left on device
1054     * @throws { BusinessError } 13900027 - Read-only file system
1055     * @throws { BusinessError } 13900029 - Resource deadlock would occur
1056     * @throws { BusinessError } 13900030 - File name too long
1057     * @throws { BusinessError } 13900033 - Too many symbolic links encountered
1058     * @throws { BusinessError } 13900034 - Operation would block
1059     * @throws { BusinessError } 13900038 - Value too large for defined data type
1060     * @throws { BusinessError } 13900041 - Quota exceeded
1061     * @throws { BusinessError } 13900042 - Unknown error
1062     * @throws { BusinessError } 14000001 - Invalid display name
1063     * @throws { BusinessError } 14000002 - Invalid uri
1064     * @throws { BusinessError } 14000003 - Invalid file extension
1065     * @throws { BusinessError } 14000004 - File has been put into trash bin
1066     * @throws { BusinessError } 14300001 - IPC error
1067     * @throws { BusinessError } 14300002 - Invalid uri
1068     * @throws { BusinessError } 14300003 - Fail to get fileextension info
1069     * @throws { BusinessError } 14300004 - Get wrong result
1070     * @syscap SystemCapability.FileManagement.UserFileService
1071     * @systemapi
1072     * @since 9
1073     */
1074    openFile(uri: string, flags: OPENFLAGS): Promise<number>;
1075
1076    /**
1077     * Open a file.
1078     *
1079     * @permission ohos.permission.FILE_ACCESS_MANAGER
1080     * @param { string } uri Indicates the path of the file to open.
1081     * @param { OPENFLAGS } flags Indicate options of opening a file. The default value is read-only.
1082     * @param { AsyncCallback<number> } callback - The callback is used to return the file descriptor.
1083     * @throws { BusinessError } 13900001 - Operation not permitted
1084     * @throws { BusinessError } 13900002 - No such file or directory
1085     * @throws { BusinessError } 13900004 - Interrupted system call
1086     * @throws { BusinessError } 13900006 - No such device or address
1087     * @throws { BusinessError } 13900008 - Bad file descriptor
1088     * @throws { BusinessError } 13900011 - Out of memory
1089     * @throws { BusinessError } 13900012 - Permission denied
1090     * @throws { BusinessError } 13900013 - Bad address
1091     * @throws { BusinessError } 13900014 - Device or resource busy
1092     * @throws { BusinessError } 13900015 - File exists
1093     * @throws { BusinessError } 13900017 - No such device
1094     * @throws { BusinessError } 13900018 - Not a directory
1095     * @throws { BusinessError } 13900019 - Is a directory
1096     * @throws { BusinessError } 13900020 - Invalid argument
1097     * @throws { BusinessError } 13900022 - Too many open files
1098     * @throws { BusinessError } 13900023 - Text file busy
1099     * @throws { BusinessError } 13900024 - File too large
1100     * @throws { BusinessError } 13900025 - No space left on device
1101     * @throws { BusinessError } 13900027 - Read-only file system
1102     * @throws { BusinessError } 13900029 - Resource deadlock would occur
1103     * @throws { BusinessError } 13900030 - File name too long
1104     * @throws { BusinessError } 13900033 - Too many symbolic links encountered
1105     * @throws { BusinessError } 13900034 - Operation would block
1106     * @throws { BusinessError } 13900038 - Value too large for defined data type
1107     * @throws { BusinessError } 13900041 - Quota exceeded
1108     * @throws { BusinessError } 13900042 - Unknown error
1109     * @throws { BusinessError } 14000001 - Invalid display name
1110     * @throws { BusinessError } 14000002 - Invalid uri
1111     * @throws { BusinessError } 14000003 - Invalid file extension
1112     * @throws { BusinessError } 14000004 - File has been put into trash bin
1113     * @throws { BusinessError } 14300001 - IPC error
1114     * @throws { BusinessError } 14300002 - Invalid uri
1115     * @throws { BusinessError } 14300003 - Fail to get fileextension info
1116     * @throws { BusinessError } 14300004 - Get wrong result
1117     * @syscap SystemCapability.FileManagement.UserFileService
1118     * @systemapi
1119     * @since 9
1120     */
1121    openFile(uri: string, flags: OPENFLAGS, callback: AsyncCallback<number>): void;
1122
1123    /**
1124     * Create a file.
1125     *
1126     * @permission ohos.permission.FILE_ACCESS_MANAGER
1127     * @param { string } uri Represents a specific parent directory.
1128     * @param { string } displayName Indicates the new file name, and supports with suffix.
1129     * @returns { Promise<string> } Returns the new file's URI.
1130     * @throws { BusinessError } 13900001 - Operation not permitted
1131     * @throws { BusinessError } 13900002 - No such file or directory
1132     * @throws { BusinessError } 13900004 - Interrupted system call
1133     * @throws { BusinessError } 13900006 - No such device or address
1134     * @throws { BusinessError } 13900008 - Bad file descriptor
1135     * @throws { BusinessError } 13900011 - Out of memory
1136     * @throws { BusinessError } 13900012 - Permission denied
1137     * @throws { BusinessError } 13900013 - Bad address
1138     * @throws { BusinessError } 13900014 - Device or resource busy
1139     * @throws { BusinessError } 13900015 - File exists
1140     * @throws { BusinessError } 13900017 - No such device
1141     * @throws { BusinessError } 13900018 - Not a directory
1142     * @throws { BusinessError } 13900019 - Is a directory
1143     * @throws { BusinessError } 13900020 - Invalid argument
1144     * @throws { BusinessError } 13900022 - Too many open files
1145     * @throws { BusinessError } 13900023 - Text file busy
1146     * @throws { BusinessError } 13900024 - File too large
1147     * @throws { BusinessError } 13900025 - No space left on device
1148     * @throws { BusinessError } 13900027 - Read-only file system
1149     * @throws { BusinessError } 13900029 - Resource deadlock would occur
1150     * @throws { BusinessError } 13900030 - File name too long
1151     * @throws { BusinessError } 13900033 - Too many symbolic links encountered
1152     * @throws { BusinessError } 13900034 - Operation would block
1153     * @throws { BusinessError } 13900038 - Value too large for defined data type
1154     * @throws { BusinessError } 13900041 - Quota exceeded
1155     * @throws { BusinessError } 13900042 - Unknown error
1156     * @throws { BusinessError } 14000001 - Invalid display name
1157     * @throws { BusinessError } 14000002 - Invalid uri
1158     * @throws { BusinessError } 14000003 - Invalid file extension
1159     * @throws { BusinessError } 14000004 - File has been put into trash bin
1160     * @throws { BusinessError } 14300001 - IPC error
1161     * @throws { BusinessError } 14300002 - Invalid uri
1162     * @throws { BusinessError } 14300003 - Fail to get fileextension info
1163     * @throws { BusinessError } 14300004 - Get wrong result
1164     * @syscap SystemCapability.FileManagement.UserFileService
1165     * @systemapi
1166     * @since 9
1167     */
1168    createFile(uri: string, displayName: string): Promise<string>;
1169
1170    /**
1171     * Create a file.
1172     *
1173     * @permission ohos.permission.FILE_ACCESS_MANAGER
1174     * @param { string } uri Represents a specific parent directory.
1175     * @param { string } displayName Indicates the new file name, and supports with suffix.
1176     * @param { AsyncCallback<string> } callback - The callback is used to return the new file's URI.
1177     * @throws { BusinessError } 13900001 - Operation not permitted
1178     * @throws { BusinessError } 13900002 - No such file or directory
1179     * @throws { BusinessError } 13900004 - Interrupted system call
1180     * @throws { BusinessError } 13900006 - No such device or address
1181     * @throws { BusinessError } 13900008 - Bad file descriptor
1182     * @throws { BusinessError } 13900011 - Out of memory
1183     * @throws { BusinessError } 13900012 - Permission denied
1184     * @throws { BusinessError } 13900013 - Bad address
1185     * @throws { BusinessError } 13900014 - Device or resource busy
1186     * @throws { BusinessError } 13900015 - File exists
1187     * @throws { BusinessError } 13900017 - No such device
1188     * @throws { BusinessError } 13900018 - Not a directory
1189     * @throws { BusinessError } 13900019 - Is a directory
1190     * @throws { BusinessError } 13900020 - Invalid argument
1191     * @throws { BusinessError } 13900022 - Too many open files
1192     * @throws { BusinessError } 13900023 - Text file busy
1193     * @throws { BusinessError } 13900024 - File too large
1194     * @throws { BusinessError } 13900025 - No space left on device
1195     * @throws { BusinessError } 13900027 - Read-only file system
1196     * @throws { BusinessError } 13900029 - Resource deadlock would occur
1197     * @throws { BusinessError } 13900030 - File name too long
1198     * @throws { BusinessError } 13900033 - Too many symbolic links encountered
1199     * @throws { BusinessError } 13900034 - Operation would block
1200     * @throws { BusinessError } 13900038 - Value too large for defined data type
1201     * @throws { BusinessError } 13900041 - Quota exceeded
1202     * @throws { BusinessError } 13900042 - Unknown error
1203     * @throws { BusinessError } 14000001 - Invalid display name
1204     * @throws { BusinessError } 14000002 - Invalid uri
1205     * @throws { BusinessError } 14000003 - Invalid file extension
1206     * @throws { BusinessError } 14000004 - File has been put into trash bin
1207     * @throws { BusinessError } 14300001 - IPC error
1208     * @throws { BusinessError } 14300002 - Invalid uri
1209     * @throws { BusinessError } 14300003 - Fail to get fileextension info
1210     * @throws { BusinessError } 14300004 - Get wrong result
1211     * @syscap SystemCapability.FileManagement.UserFileService
1212     * @systemapi
1213     * @since 9
1214     */
1215    createFile(uri: string, displayName: string, callback: AsyncCallback<string>): void;
1216
1217    /**
1218     * Create a Directory.
1219     *
1220     * @permission ohos.permission.FILE_ACCESS_MANAGER
1221     * @param { string } parentUri Represents a specific parent directory.
1222     * @param { string } displayName Indicates the new directory name.
1223     * @returns { Promise<string> } Returns the new directory's URI.
1224     * @throws { BusinessError } 13900001 - Operation not permitted
1225     * @throws { BusinessError } 13900002 - No such file or directory
1226     * @throws { BusinessError } 13900004 - Interrupted system call
1227     * @throws { BusinessError } 13900006 - No such device or address
1228     * @throws { BusinessError } 13900008 - Bad file descriptor
1229     * @throws { BusinessError } 13900011 - Out of memory
1230     * @throws { BusinessError } 13900012 - Permission denied
1231     * @throws { BusinessError } 13900013 - Bad address
1232     * @throws { BusinessError } 13900014 - Device or resource busy
1233     * @throws { BusinessError } 13900015 - File exists
1234     * @throws { BusinessError } 13900017 - No such device
1235     * @throws { BusinessError } 13900018 - Not a directory
1236     * @throws { BusinessError } 13900019 - Is a directory
1237     * @throws { BusinessError } 13900020 - Invalid argument
1238     * @throws { BusinessError } 13900022 - Too many open files
1239     * @throws { BusinessError } 13900023 - Text file busy
1240     * @throws { BusinessError } 13900024 - File too large
1241     * @throws { BusinessError } 13900025 - No space left on device
1242     * @throws { BusinessError } 13900027 - Read-only file system
1243     * @throws { BusinessError } 13900029 - Resource deadlock would occur
1244     * @throws { BusinessError } 13900030 - File name too long
1245     * @throws { BusinessError } 13900033 - Too many symbolic links encountered
1246     * @throws { BusinessError } 13900034 - Operation would block
1247     * @throws { BusinessError } 13900038 - Value too large for defined data type
1248     * @throws { BusinessError } 13900041 - Quota exceeded
1249     * @throws { BusinessError } 13900042 - Unknown error
1250     * @throws { BusinessError } 14000001 - Invalid display name
1251     * @throws { BusinessError } 14000002 - Invalid uri
1252     * @throws { BusinessError } 14000003 - Invalid file extension
1253     * @throws { BusinessError } 14000004 - File has been put into trash bin
1254     * @throws { BusinessError } 14300001 - IPC error
1255     * @throws { BusinessError } 14300002 - Invalid uri
1256     * @throws { BusinessError } 14300003 - Fail to get fileextension info
1257     * @throws { BusinessError } 14300004 - Get wrong result
1258     * @syscap SystemCapability.FileManagement.UserFileService
1259     * @systemapi
1260     * @since 9
1261     */
1262    mkDir(parentUri: string, displayName: string): Promise<string>;
1263
1264    /**
1265     * Create a Directory.
1266     *
1267     * @permission ohos.permission.FILE_ACCESS_MANAGER
1268     * @param { string } parentUri Represents a specific parent directory.
1269     * @param { string } displayName Indicates the new directory name.
1270     * @param { AsyncCallback<string> } callback - The callback is used to return the new directory's URI.
1271     * @throws { BusinessError } 13900001 - Operation not permitted
1272     * @throws { BusinessError } 13900002 - No such file or directory
1273     * @throws { BusinessError } 13900004 - Interrupted system call
1274     * @throws { BusinessError } 13900006 - No such device or address
1275     * @throws { BusinessError } 13900008 - Bad file descriptor
1276     * @throws { BusinessError } 13900011 - Out of memory
1277     * @throws { BusinessError } 13900012 - Permission denied
1278     * @throws { BusinessError } 13900013 - Bad address
1279     * @throws { BusinessError } 13900014 - Device or resource busy
1280     * @throws { BusinessError } 13900015 - File exists
1281     * @throws { BusinessError } 13900017 - No such device
1282     * @throws { BusinessError } 13900018 - Not a directory
1283     * @throws { BusinessError } 13900019 - Is a directory
1284     * @throws { BusinessError } 13900020 - Invalid argument
1285     * @throws { BusinessError } 13900022 - Too many open files
1286     * @throws { BusinessError } 13900023 - Text file busy
1287     * @throws { BusinessError } 13900024 - File too large
1288     * @throws { BusinessError } 13900025 - No space left on device
1289     * @throws { BusinessError } 13900027 - Read-only file system
1290     * @throws { BusinessError } 13900029 - Resource deadlock would occur
1291     * @throws { BusinessError } 13900030 - File name too long
1292     * @throws { BusinessError } 13900033 - Too many symbolic links encountered
1293     * @throws { BusinessError } 13900034 - Operation would block
1294     * @throws { BusinessError } 13900038 - Value too large for defined data type
1295     * @throws { BusinessError } 13900041 - Quota exceeded
1296     * @throws { BusinessError } 13900042 - Unknown error
1297     * @throws { BusinessError } 14000001 - Invalid display name
1298     * @throws { BusinessError } 14000002 - Invalid uri
1299     * @throws { BusinessError } 14000003 - Invalid file extension
1300     * @throws { BusinessError } 14000004 - File has been put into trash bin
1301     * @throws { BusinessError } 14300001 - IPC error
1302     * @throws { BusinessError } 14300002 - Invalid uri
1303     * @throws { BusinessError } 14300003 - Fail to get fileextension info
1304     * @throws { BusinessError } 14300004 - Get wrong result
1305     * @syscap SystemCapability.FileManagement.UserFileService
1306     * @systemapi
1307     * @since 9
1308     */
1309    mkDir(parentUri: string, displayName: string, callback: AsyncCallback<string>): void;
1310
1311    /**
1312     * Delete a file or delete a directory recursively.
1313     *
1314     * @permission ohos.permission.FILE_ACCESS_MANAGER
1315     * @param { string } uri Indicates the file or directory to be deleted.
1316     * @returns { Promise<number> }
1317     * @throws { BusinessError } 13900001 - Operation not permitted
1318     * @throws { BusinessError } 13900002 - No such file or directory
1319     * @throws { BusinessError } 13900004 - Interrupted system call
1320     * @throws { BusinessError } 13900006 - No such device or address
1321     * @throws { BusinessError } 13900008 - Bad file descriptor
1322     * @throws { BusinessError } 13900011 - Out of memory
1323     * @throws { BusinessError } 13900012 - Permission denied
1324     * @throws { BusinessError } 13900013 - Bad address
1325     * @throws { BusinessError } 13900014 - Device or resource busy
1326     * @throws { BusinessError } 13900015 - File exists
1327     * @throws { BusinessError } 13900017 - No such device
1328     * @throws { BusinessError } 13900018 - Not a directory
1329     * @throws { BusinessError } 13900019 - Is a directory
1330     * @throws { BusinessError } 13900020 - Invalid argument
1331     * @throws { BusinessError } 13900022 - Too many open files
1332     * @throws { BusinessError } 13900023 - Text file busy
1333     * @throws { BusinessError } 13900024 - File too large
1334     * @throws { BusinessError } 13900025 - No space left on device
1335     * @throws { BusinessError } 13900027 - Read-only file system
1336     * @throws { BusinessError } 13900029 - Resource deadlock would occur
1337     * @throws { BusinessError } 13900030 - File name too long
1338     * @throws { BusinessError } 13900033 - Too many symbolic links encountered
1339     * @throws { BusinessError } 13900034 - Operation would block
1340     * @throws { BusinessError } 13900038 - Value too large for defined data type
1341     * @throws { BusinessError } 13900041 - Quota exceeded
1342     * @throws { BusinessError } 13900042 - Unknown error
1343     * @throws { BusinessError } 14000001 - Invalid display name
1344     * @throws { BusinessError } 14000002 - Invalid uri
1345     * @throws { BusinessError } 14000003 - Invalid file extension
1346     * @throws { BusinessError } 14000004 - File has been put into trash bin
1347     * @throws { BusinessError } 14300001 - IPC error
1348     * @throws { BusinessError } 14300002 - Invalid uri
1349     * @throws { BusinessError } 14300003 - Fail to get fileextension info
1350     * @throws { BusinessError } 14300004 - Get wrong result
1351     * @syscap SystemCapability.FileManagement.UserFileService
1352     * @systemapi
1353     * @since 9
1354     */
1355    delete(uri: string): Promise<number>;
1356
1357    /**
1358     * Delete a file or delete a directory recursively.
1359     *
1360     * @permission ohos.permission.FILE_ACCESS_MANAGER
1361     * @param { string } uri Indicates the file or directory to be deleted.
1362     * @param { AsyncCallback<number> } callback
1363     * @throws { BusinessError } 13900001 - Operation not permitted
1364     * @throws { BusinessError } 13900002 - No such file or directory
1365     * @throws { BusinessError } 13900004 - Interrupted system call
1366     * @throws { BusinessError } 13900006 - No such device or address
1367     * @throws { BusinessError } 13900008 - Bad file descriptor
1368     * @throws { BusinessError } 13900011 - Out of memory
1369     * @throws { BusinessError } 13900012 - Permission denied
1370     * @throws { BusinessError } 13900013 - Bad address
1371     * @throws { BusinessError } 13900014 - Device or resource busy
1372     * @throws { BusinessError } 13900015 - File exists
1373     * @throws { BusinessError } 13900017 - No such device
1374     * @throws { BusinessError } 13900018 - Not a directory
1375     * @throws { BusinessError } 13900019 - Is a directory
1376     * @throws { BusinessError } 13900020 - Invalid argument
1377     * @throws { BusinessError } 13900022 - Too many open files
1378     * @throws { BusinessError } 13900023 - Text file busy
1379     * @throws { BusinessError } 13900024 - File too large
1380     * @throws { BusinessError } 13900025 - No space left on device
1381     * @throws { BusinessError } 13900027 - Read-only file system
1382     * @throws { BusinessError } 13900029 - Resource deadlock would occur
1383     * @throws { BusinessError } 13900030 - File name too long
1384     * @throws { BusinessError } 13900033 - Too many symbolic links encountered
1385     * @throws { BusinessError } 13900034 - Operation would block
1386     * @throws { BusinessError } 13900038 - Value too large for defined data type
1387     * @throws { BusinessError } 13900041 - Quota exceeded
1388     * @throws { BusinessError } 13900042 - Unknown error
1389     * @throws { BusinessError } 14000001 - Invalid display name
1390     * @throws { BusinessError } 14000002 - Invalid uri
1391     * @throws { BusinessError } 14000003 - Invalid file extension
1392     * @throws { BusinessError } 14000004 - File has been put into trash bin
1393     * @throws { BusinessError } 14300001 - IPC error
1394     * @throws { BusinessError } 14300002 - Invalid uri
1395     * @throws { BusinessError } 14300003 - Fail to get fileextension info
1396     * @throws { BusinessError } 14300004 - Get wrong result
1397     * @syscap SystemCapability.FileManagement.UserFileService
1398     * @systemapi
1399     * @since 9
1400     */
1401    delete(uri: string, callback: AsyncCallback<number>): void;
1402
1403    /**
1404     * Move a file or move a directory recursively.
1405     *
1406     * @permission ohos.permission.FILE_ACCESS_MANAGER
1407     * @param { string } sourceFile Indicates the file or directory to be moved.
1408     * @param { string } destFile Represents the destination folder.
1409     * @returns { Promise<string> } Returns the generated new file or directory.
1410     * @throws { BusinessError } 13900001 - Operation not permitted
1411     * @throws { BusinessError } 13900002 - No such file or directory
1412     * @throws { BusinessError } 13900004 - Interrupted system call
1413     * @throws { BusinessError } 13900006 - No such device or address
1414     * @throws { BusinessError } 13900008 - Bad file descriptor
1415     * @throws { BusinessError } 13900011 - Out of memory
1416     * @throws { BusinessError } 13900012 - Permission denied
1417     * @throws { BusinessError } 13900013 - Bad address
1418     * @throws { BusinessError } 13900014 - Device or resource busy
1419     * @throws { BusinessError } 13900015 - File exists
1420     * @throws { BusinessError } 13900017 - No such device
1421     * @throws { BusinessError } 13900018 - Not a directory
1422     * @throws { BusinessError } 13900019 - Is a directory
1423     * @throws { BusinessError } 13900020 - Invalid argument
1424     * @throws { BusinessError } 13900022 - Too many open files
1425     * @throws { BusinessError } 13900023 - Text file busy
1426     * @throws { BusinessError } 13900024 - File too large
1427     * @throws { BusinessError } 13900025 - No space left on device
1428     * @throws { BusinessError } 13900027 - Read-only file system
1429     * @throws { BusinessError } 13900029 - Resource deadlock would occur
1430     * @throws { BusinessError } 13900030 - File name too long
1431     * @throws { BusinessError } 13900033 - Too many symbolic links encountered
1432     * @throws { BusinessError } 13900034 - Operation would block
1433     * @throws { BusinessError } 13900038 - Value too large for defined data type
1434     * @throws { BusinessError } 13900041 - Quota exceeded
1435     * @throws { BusinessError } 13900042 - Unknown error
1436     * @throws { BusinessError } 14000001 - Invalid display name
1437     * @throws { BusinessError } 14000002 - Invalid uri
1438     * @throws { BusinessError } 14000003 - Invalid file extension
1439     * @throws { BusinessError } 14000004 - File has been put into trash bin
1440     * @throws { BusinessError } 14300001 - IPC error
1441     * @throws { BusinessError } 14300002 - Invalid uri
1442     * @throws { BusinessError } 14300003 - Fail to get fileextension info
1443     * @throws { BusinessError } 14300004 - Get wrong result
1444     * @syscap SystemCapability.FileManagement.UserFileService
1445     * @systemapi
1446     * @since 9
1447     */
1448    move(sourceFile: string, destFile: string): Promise<string>;
1449
1450    /**
1451     * Move a file or move a directory recursively.
1452     *
1453     * @permission ohos.permission.FILE_ACCESS_MANAGER
1454     * @param { string } sourceFile Indicates the file or directory to be moved.
1455     * @param { string } destFile Represents the destination folder.
1456     * @param { AsyncCallback<string> } callback - The callback is used to return the generated new file or directory.
1457     * @throws { BusinessError } 13900001 - Operation not permitted
1458     * @throws { BusinessError } 13900002 - No such file or directory
1459     * @throws { BusinessError } 13900004 - Interrupted system call
1460     * @throws { BusinessError } 13900006 - No such device or address
1461     * @throws { BusinessError } 13900008 - Bad file descriptor
1462     * @throws { BusinessError } 13900011 - Out of memory
1463     * @throws { BusinessError } 13900012 - Permission denied
1464     * @throws { BusinessError } 13900013 - Bad address
1465     * @throws { BusinessError } 13900014 - Device or resource busy
1466     * @throws { BusinessError } 13900015 - File exists
1467     * @throws { BusinessError } 13900017 - No such device
1468     * @throws { BusinessError } 13900018 - Not a directory
1469     * @throws { BusinessError } 13900019 - Is a directory
1470     * @throws { BusinessError } 13900020 - Invalid argument
1471     * @throws { BusinessError } 13900022 - Too many open files
1472     * @throws { BusinessError } 13900023 - Text file busy
1473     * @throws { BusinessError } 13900024 - File too large
1474     * @throws { BusinessError } 13900025 - No space left on device
1475     * @throws { BusinessError } 13900027 - Read-only file system
1476     * @throws { BusinessError } 13900029 - Resource deadlock would occur
1477     * @throws { BusinessError } 13900030 - File name too long
1478     * @throws { BusinessError } 13900033 - Too many symbolic links encountered
1479     * @throws { BusinessError } 13900034 - Operation would block
1480     * @throws { BusinessError } 13900038 - Value too large for defined data type
1481     * @throws { BusinessError } 13900041 - Quota exceeded
1482     * @throws { BusinessError } 13900042 - Unknown error
1483     * @throws { BusinessError } 14000001 - Invalid display name
1484     * @throws { BusinessError } 14000002 - Invalid uri
1485     * @throws { BusinessError } 14000003 - Invalid file extension
1486     * @throws { BusinessError } 14000004 - File has been put into trash bin
1487     * @throws { BusinessError } 14300001 - IPC error
1488     * @throws { BusinessError } 14300002 - Invalid uri
1489     * @throws { BusinessError } 14300003 - Fail to get fileextension info
1490     * @throws { BusinessError } 14300004 - Get wrong result
1491     * @syscap SystemCapability.FileManagement.UserFileService
1492     * @systemapi
1493     * @since 9
1494     */
1495    move(sourceFile: string, destFile: string, callback: AsyncCallback<string>): void;
1496
1497    /**
1498     * Copy file or directory in the promise way.
1499     *
1500     * @permission ohos.permission.FILE_ACCESS_MANAGER
1501     * @param { string } sourceUri - Indicates the file or directory to be copied.
1502     * @param { string } destUri - Represents the destination directory.
1503     * @param { boolean } force - Optional parameter that determines whether to forcibly copy files.
1504     * @returns { Promise<Array<CopyResult>> } Returns the file information where the error occurred.
1505     * @syscap SystemCapability.FileManagement.UserFileService
1506     * @systemapi
1507     * @since 10
1508     */
1509    copy(sourceUri: string, destUri: string, force?: boolean): Promise<Array<CopyResult>>;
1510
1511    /**
1512     * Copy file or directory in the asyncCallback way.
1513     *
1514     * @permission ohos.permission.FILE_ACCESS_MANAGER
1515     * @param { string } sourceUri - Indicates the file or directory to be copied.
1516     * @param { string } destUri - Represents the destination directory.
1517     * @param { AsyncCallback<Array<CopyResult>> } callback - The callback is used to return the file information where the error occurred.
1518     * @syscap SystemCapability.FileManagement.UserFileService
1519     * @systemapi
1520     * @since 10
1521     */
1522    copy(sourceUri: string, destUri: string, callback: AsyncCallback<Array<CopyResult>>): void;
1523
1524    /**
1525     * Copy file or directory in the asyncCallback way.
1526     *
1527     * @permission ohos.permission.FILE_ACCESS_MANAGER
1528     * @param { string } sourceUri - Indicates the file or directory to be copied.
1529     * @param { string } destUri - Represents the destination directory.
1530     * @param { boolean } force - Determines whether to forcibly copy files.
1531     * @param { AsyncCallback<Array<CopyResult>> } callback - The callback is used to return the file information where the error occurred.
1532     * @syscap SystemCapability.FileManagement.UserFileService
1533     * @systemapi
1534     * @since 10
1535     */
1536    copy(sourceUri: string, destUri: string, force: boolean, callback: AsyncCallback<Array<CopyResult>>): void;
1537
1538    /**
1539     * copy the file with the specified file name in the promise way.
1540     *
1541     * @permission ohos.permission.FILE_ACCESS_MANAGER
1542     * @param { string } sourceUri - Indicates the file or directory to be moved.
1543     * @param { string } destUri - Represents the destination folder.
1544     * @param { string } fileName - Represents the name of the specified file.
1545     * @returns { Promise<string> } Returns the generated new file uri.
1546     * @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken
1547     * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API
1548     * @throws { BusinessError } 13900001 - Operation not permitted
1549     * @throws { BusinessError } 13900002 - No such file or directory
1550     * @throws { BusinessError } 13900004 - Interrupted system call
1551     * @throws { BusinessError } 13900008 - Bad file descriptor
1552     * @throws { BusinessError } 13900011 - Out of memory
1553     * @throws { BusinessError } 13900012 - Permission denied
1554     * @throws { BusinessError } 13900014 - Device or resource busy
1555     * @throws { BusinessError } 13900015 - File exists
1556     * @throws { BusinessError } 13900018 - Not a directory
1557     * @throws { BusinessError } 13900019 - Is a directory
1558     * @throws { BusinessError } 13900020 - Invalid argument
1559     * @throws { BusinessError } 13900022 - Too many open files
1560     * @throws { BusinessError } 13900023 - Text file busy
1561     * @throws { BusinessError } 13900024 - File too large
1562     * @throws { BusinessError } 13900025 - No space left on device
1563     * @throws { BusinessError } 13900027 - Read-only file system
1564     * @throws { BusinessError } 13900030 - File name too long
1565     * @throws { BusinessError } 13900042 - Unknown error
1566     * @throws { BusinessError } 14300001 - IPC error
1567     * @throws { BusinessError } 14300002 - Invalid uri
1568     * @throws { BusinessError } 14300003 - Fail to get fileextension info
1569     * @throws { BusinessError } 14300004 - Get wrong result
1570     * @syscap SystemCapability.FileManagement.UserFileService
1571     * @systemapi
1572     * @StageModelOnly
1573     * @since 11
1574     */
1575    copyFile(sourceUri: string, destUri: string, fileName: string): Promise<string>;
1576
1577    /**
1578     * copy the file with the specified file name in the asyncCallback way.
1579     *
1580     * @permission ohos.permission.FILE_ACCESS_MANAGER
1581     * @param { string } sourceUri - Indicates the file or directory to be moved.
1582     * @param { string } destUri - Represents the destination folder.
1583     * @param { string } fileName - Represents the name of the specified file.
1584     * @param { AsyncCallback<string> } callback - Returns the generated new file uri.
1585     * @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken
1586     * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API
1587     * @throws { BusinessError } 13900001 - Operation not permitted
1588     * @throws { BusinessError } 13900002 - No such file or directory
1589     * @throws { BusinessError } 13900004 - Interrupted system call
1590     * @throws { BusinessError } 13900008 - Bad file descriptor
1591     * @throws { BusinessError } 13900011 - Out of memory
1592     * @throws { BusinessError } 13900012 - Permission denied
1593     * @throws { BusinessError } 13900014 - Device or resource busy
1594     * @throws { BusinessError } 13900015 - File exists
1595     * @throws { BusinessError } 13900018 - Not a directory
1596     * @throws { BusinessError } 13900019 - Is a directory
1597     * @throws { BusinessError } 13900020 - Invalid argument
1598     * @throws { BusinessError } 13900022 - Too many open files
1599     * @throws { BusinessError } 13900023 - Text file busy
1600     * @throws { BusinessError } 13900024 - File too large
1601     * @throws { BusinessError } 13900025 - No space left on device
1602     * @throws { BusinessError } 13900027 - Read-only file system
1603     * @throws { BusinessError } 13900030 - File name too long
1604     * @throws { BusinessError } 13900042 - Unknown error
1605     * @throws { BusinessError } 14300001 - IPC error
1606     * @throws { BusinessError } 14300002 - Invalid uri
1607     * @throws { BusinessError } 14300003 - Fail to get fileextension info
1608     * @throws { BusinessError } 14300004 - Get wrong result
1609     * @syscap SystemCapability.FileManagement.UserFileService
1610     * @systemapi
1611     * @StageModelOnly
1612     * @since 11
1613     */
1614    copyFile(sourceUri: string, destUri: string, fileName: string, callback: AsyncCallback<string>): void;
1615
1616    /**
1617     * Rename the selected file or directory.
1618     *
1619     * @permission ohos.permission.FILE_ACCESS_MANAGER
1620     * @param { string } uri Indicates the selected file or directory.
1621     * @param { string } displayName Indicates the new directory or file name.
1622     * @returns { Promise<string> } Returns a URI representing the new file or directory.
1623     * @throws { BusinessError } 13900001 - Operation not permitted
1624     * @throws { BusinessError } 13900002 - No such file or directory
1625     * @throws { BusinessError } 13900004 - Interrupted system call
1626     * @throws { BusinessError } 13900006 - No such device or address
1627     * @throws { BusinessError } 13900008 - Bad file descriptor
1628     * @throws { BusinessError } 13900011 - Out of memory
1629     * @throws { BusinessError } 13900012 - Permission denied
1630     * @throws { BusinessError } 13900013 - Bad address
1631     * @throws { BusinessError } 13900014 - Device or resource busy
1632     * @throws { BusinessError } 13900015 - File exists
1633     * @throws { BusinessError } 13900017 - No such device
1634     * @throws { BusinessError } 13900018 - Not a directory
1635     * @throws { BusinessError } 13900019 - Is a directory
1636     * @throws { BusinessError } 13900020 - Invalid argument
1637     * @throws { BusinessError } 13900022 - Too many open files
1638     * @throws { BusinessError } 13900023 - Text file busy
1639     * @throws { BusinessError } 13900024 - File too large
1640     * @throws { BusinessError } 13900025 - No space left on device
1641     * @throws { BusinessError } 13900027 - Read-only file system
1642     * @throws { BusinessError } 13900029 - Resource deadlock would occur
1643     * @throws { BusinessError } 13900030 - File name too long
1644     * @throws { BusinessError } 13900033 - Too many symbolic links encountered
1645     * @throws { BusinessError } 13900034 - Operation would block
1646     * @throws { BusinessError } 13900038 - Value too large for defined data type
1647     * @throws { BusinessError } 13900041 - Quota exceeded
1648     * @throws { BusinessError } 13900042 - Unknown error
1649     * @throws { BusinessError } 14000001 - Invalid display name
1650     * @throws { BusinessError } 14000002 - Invalid uri
1651     * @throws { BusinessError } 14000003 - Invalid file extension
1652     * @throws { BusinessError } 14000004 - File has been put into trash bin
1653     * @throws { BusinessError } 14300001 - IPC error
1654     * @throws { BusinessError } 14300002 - Invalid uri
1655     * @throws { BusinessError } 14300003 - Fail to get fileextension info
1656     * @throws { BusinessError } 14300004 - Get wrong result
1657     * @syscap SystemCapability.FileManagement.UserFileService
1658     * @systemapi
1659     * @since 9
1660     */
1661    rename(uri: string, displayName: string): Promise<string>;
1662
1663    /**
1664     * Rename the selected file or directory.
1665     *
1666     * @permission ohos.permission.FILE_ACCESS_MANAGER
1667     * @param { string } uri Indicates the selected file or directory.
1668     * @param { string } displayName Indicates the new directory or file name.
1669     * @param { AsyncCallback<string> } callback - The callback is used to return a URI representing the new file or directory.
1670     * @throws { BusinessError } 13900001 - Operation not permitted
1671     * @throws { BusinessError } 13900002 - No such file or directory
1672     * @throws { BusinessError } 13900004 - Interrupted system call
1673     * @throws { BusinessError } 13900006 - No such device or address
1674     * @throws { BusinessError } 13900008 - Bad file descriptor
1675     * @throws { BusinessError } 13900011 - Out of memory
1676     * @throws { BusinessError } 13900012 - Permission denied
1677     * @throws { BusinessError } 13900013 - Bad address
1678     * @throws { BusinessError } 13900014 - Device or resource busy
1679     * @throws { BusinessError } 13900015 - File exists
1680     * @throws { BusinessError } 13900017 - No such device
1681     * @throws { BusinessError } 13900018 - Not a directory
1682     * @throws { BusinessError } 13900019 - Is a directory
1683     * @throws { BusinessError } 13900020 - Invalid argument
1684     * @throws { BusinessError } 13900022 - Too many open files
1685     * @throws { BusinessError } 13900023 - Text file busy
1686     * @throws { BusinessError } 13900024 - File too large
1687     * @throws { BusinessError } 13900025 - No space left on device
1688     * @throws { BusinessError } 13900027 - Read-only file system
1689     * @throws { BusinessError } 13900029 - Resource deadlock would occur
1690     * @throws { BusinessError } 13900030 - File name too long
1691     * @throws { BusinessError } 13900033 - Too many symbolic links encountered
1692     * @throws { BusinessError } 13900034 - Operation would block
1693     * @throws { BusinessError } 13900038 - Value too large for defined data type
1694     * @throws { BusinessError } 13900041 - Quota exceeded
1695     * @throws { BusinessError } 13900042 - Unknown error
1696     * @throws { BusinessError } 14000001 - Invalid display name
1697     * @throws { BusinessError } 14000002 - Invalid uri
1698     * @throws { BusinessError } 14000003 - Invalid file extension
1699     * @throws { BusinessError } 14000004 - File has been put into trash bin
1700     * @throws { BusinessError } 14300001 - IPC error
1701     * @throws { BusinessError } 14300002 - Invalid uri
1702     * @throws { BusinessError } 14300003 - Fail to get fileextension info
1703     * @throws { BusinessError } 14300004 - Get wrong result
1704     * @syscap SystemCapability.FileManagement.UserFileService
1705     * @systemapi
1706     * @since 9
1707     */
1708    rename(uri: string, displayName: string, callback: AsyncCallback<string>): void;
1709
1710    /**
1711     * Obtain the status of a file or directory.
1712     *
1713     * @permission ohos.permission.FILE_ACCESS_MANAGER
1714     * @param { string } sourceFileUri Indicates the selected file or directory.
1715     * @returns { Promise<boolean> } Returns whether it exists.
1716     * @throws { BusinessError } 13900001 - Operation not permitted
1717     * @throws { BusinessError } 13900002 - No such file or directory
1718     * @throws { BusinessError } 13900004 - Interrupted system call
1719     * @throws { BusinessError } 13900006 - No such device or address
1720     * @throws { BusinessError } 13900008 - Bad file descriptor
1721     * @throws { BusinessError } 13900011 - Out of memory
1722     * @throws { BusinessError } 13900012 - Permission denied
1723     * @throws { BusinessError } 13900013 - Bad address
1724     * @throws { BusinessError } 13900014 - Device or resource busy
1725     * @throws { BusinessError } 13900015 - File exists
1726     * @throws { BusinessError } 13900017 - No such device
1727     * @throws { BusinessError } 13900018 - Not a directory
1728     * @throws { BusinessError } 13900019 - Is a directory
1729     * @throws { BusinessError } 13900020 - Invalid argument
1730     * @throws { BusinessError } 13900022 - Too many open files
1731     * @throws { BusinessError } 13900023 - Text file busy
1732     * @throws { BusinessError } 13900024 - File too large
1733     * @throws { BusinessError } 13900025 - No space left on device
1734     * @throws { BusinessError } 13900027 - Read-only file system
1735     * @throws { BusinessError } 13900029 - Resource deadlock would occur
1736     * @throws { BusinessError } 13900030 - File name too long
1737     * @throws { BusinessError } 13900033 - Too many symbolic links encountered
1738     * @throws { BusinessError } 13900034 - Operation would block
1739     * @throws { BusinessError } 13900038 - Value too large for defined data type
1740     * @throws { BusinessError } 13900041 - Quota exceeded
1741     * @throws { BusinessError } 13900042 - Unknown error
1742     * @throws { BusinessError } 14000001 - Invalid display name
1743     * @throws { BusinessError } 14000002 - Invalid uri
1744     * @throws { BusinessError } 14000003 - Invalid file extension
1745     * @throws { BusinessError } 14000004 - File has been put into trash bin
1746     * @throws { BusinessError } 14300001 - IPC error
1747     * @throws { BusinessError } 14300002 - Invalid uri
1748     * @throws { BusinessError } 14300003 - Fail to get fileextension info
1749     * @throws { BusinessError } 14300004 - Get wrong result
1750     * @syscap SystemCapability.FileManagement.UserFileService
1751     * @systemapi
1752     * @since 9
1753     */
1754    access(sourceFileUri: string): Promise<boolean>;
1755
1756    /**
1757     * Obtain the status of a file or directory.
1758     *
1759     * @permission ohos.permission.FILE_ACCESS_MANAGER
1760     * @param { string } sourceFileUri Indicates the selected file or directory.
1761     * @param { AsyncCallback<boolean> } callback - The callback is used to return whether it exists.
1762     * @throws { BusinessError } 13900001 - Operation not permitted
1763     * @throws { BusinessError } 13900002 - No such file or directory
1764     * @throws { BusinessError } 13900004 - Interrupted system call
1765     * @throws { BusinessError } 13900006 - No such device or address
1766     * @throws { BusinessError } 13900008 - Bad file descriptor
1767     * @throws { BusinessError } 13900011 - Out of memory
1768     * @throws { BusinessError } 13900012 - Permission denied
1769     * @throws { BusinessError } 13900013 - Bad address
1770     * @throws { BusinessError } 13900014 - Device or resource busy
1771     * @throws { BusinessError } 13900015 - File exists
1772     * @throws { BusinessError } 13900017 - No such device
1773     * @throws { BusinessError } 13900018 - Not a directory
1774     * @throws { BusinessError } 13900019 - Is a directory
1775     * @throws { BusinessError } 13900020 - Invalid argument
1776     * @throws { BusinessError } 13900022 - Too many open files
1777     * @throws { BusinessError } 13900023 - Text file busy
1778     * @throws { BusinessError } 13900024 - File too large
1779     * @throws { BusinessError } 13900025 - No space left on device
1780     * @throws { BusinessError } 13900027 - Read-only file system
1781     * @throws { BusinessError } 13900029 - Resource deadlock would occur
1782     * @throws { BusinessError } 13900030 - File name too long
1783     * @throws { BusinessError } 13900033 - Too many symbolic links encountered
1784     * @throws { BusinessError } 13900034 - Operation would block
1785     * @throws { BusinessError } 13900038 - Value too large for defined data type
1786     * @throws { BusinessError } 13900041 - Quota exceeded
1787     * @throws { BusinessError } 13900042 - Unknown error
1788     * @throws { BusinessError } 14000001 - Invalid display name
1789     * @throws { BusinessError } 14000002 - Invalid uri
1790     * @throws { BusinessError } 14000003 - Invalid file extension
1791     * @throws { BusinessError } 14000004 - File has been put into trash bin
1792     * @throws { BusinessError } 14300001 - IPC error
1793     * @throws { BusinessError } 14300002 - Invalid uri
1794     * @throws { BusinessError } 14300003 - Fail to get fileextension info
1795     * @throws { BusinessError } 14300004 - Get wrong result
1796     * @syscap SystemCapability.FileManagement.UserFileService
1797     * @systemapi
1798     * @since 9
1799     */
1800    access(sourceFileUri: string, callback: AsyncCallback<boolean>): void;
1801
1802    /**
1803     * Query file related information by the uri in the promise way.
1804     *
1805     * @permission ohos.permission.FILE_ACCESS_MANAGER
1806     * @param { string } uri - Indicates the selected file or directory.
1807     * @param { string } metaJson The json string includes query property.
1808     * @returns { Promise<string> } Returns the json string, includes query property and value.
1809     * @syscap SystemCapability.FileManagement.UserFileService
1810     * @systemapi
1811     * @since 10
1812     */
1813    query(uri: string, metaJson: string): Promise<string>;
1814
1815    /**
1816     * Query file related information by the uri in the asyncCallback way.
1817     *
1818     * @permission ohos.permission.FILE_ACCESS_MANAGER
1819     * @param { string } uri - Indicates the selected file or directory.
1820     * @param { string } metaJson The json string includes query property.
1821     * @param { AsyncCallback<string> } callback - Returns the json string, includes query property and value.
1822     * @syscap SystemCapability.FileManagement.UserFileService
1823     * @systemapi
1824     * @since 10
1825     */
1826    query(uri: string, metaJson: string, callback: AsyncCallback<string>): void;
1827
1828    /**
1829     * Get a FileInfo by the uri in the promise way.
1830     *
1831     * @permission ohos.permission.FILE_ACCESS_MANAGER
1832     * @param { string } uri - Indicates the selected file or directory.
1833     * @returns { Promise<FileInfo> } Returns a FileInfo.
1834     * @syscap SystemCapability.FileManagement.UserFileService
1835     * @systemapi
1836     * @since 10
1837     */
1838    getFileInfoFromUri(uri: string): Promise<FileInfo>;
1839
1840    /**
1841     * Get a FileInfo by the uri in the asyncCallback way.
1842     *
1843     * @permission ohos.permission.FILE_ACCESS_MANAGER
1844     * @param { string } uri - Indicates the selected file or directory.
1845     * @param { AsyncCallback<FileInfo> } callback - The callback is used to return a fileinfo object.
1846     * @syscap SystemCapability.FileManagement.UserFileService
1847     * @systemapi
1848     * @since 10
1849     */
1850    getFileInfoFromUri(uri: string, callback: AsyncCallback<FileInfo>): void;
1851
1852    /**
1853     * Get a FileInfo by the relative path in the promise way.
1854     *
1855     * @permission ohos.permission.FILE_ACCESS_MANAGER
1856     * @param { string } relativePath - Indicates the selected file or directory.
1857     * @returns { Promise<FileInfo> } Returns a FileInfo.
1858     * @syscap SystemCapability.FileManagement.UserFileService
1859     * @systemapi
1860     * @since 10
1861     */
1862    getFileInfoFromRelativePath(relativePath: string): Promise<FileInfo>;
1863
1864    /**
1865     * Get a FileInfo by the relative path in the asyncCallback way.
1866     *
1867     * @permission ohos.permission.FILE_ACCESS_MANAGER
1868     * @param { string } relativePath - Indicates the selected file or directory.
1869     * @param { AsyncCallback<FileInfo> } callback - The callback is used to return a fileinfo object.
1870     * @syscap SystemCapability.FileManagement.UserFileService
1871     * @systemapi
1872     * @since 10
1873     */
1874    getFileInfoFromRelativePath(relativePath: string, callback: AsyncCallback<FileInfo>): void;
1875
1876    /**
1877     * Get a RootIterator.
1878     *
1879     * @permission ohos.permission.FILE_ACCESS_MANAGER
1880     * @returns { Promise<RootIterator> } Returns a RootIterator.
1881     * @throws { BusinessError } 13900001 - Operation not permitted
1882     * @throws { BusinessError } 13900002 - No such file or directory
1883     * @throws { BusinessError } 13900004 - Interrupted system call
1884     * @throws { BusinessError } 13900006 - No such device or address
1885     * @throws { BusinessError } 13900008 - Bad file descriptor
1886     * @throws { BusinessError } 13900011 - Out of memory
1887     * @throws { BusinessError } 13900012 - Permission denied
1888     * @throws { BusinessError } 13900013 - Bad address
1889     * @throws { BusinessError } 13900014 - Device or resource busy
1890     * @throws { BusinessError } 13900015 - File exists
1891     * @throws { BusinessError } 13900017 - No such device
1892     * @throws { BusinessError } 13900018 - Not a directory
1893     * @throws { BusinessError } 13900019 - Is a directory
1894     * @throws { BusinessError } 13900020 - Invalid argument
1895     * @throws { BusinessError } 13900022 - Too many open files
1896     * @throws { BusinessError } 13900023 - Text file busy
1897     * @throws { BusinessError } 13900024 - File too large
1898     * @throws { BusinessError } 13900025 - No space left on device
1899     * @throws { BusinessError } 13900027 - Read-only file system
1900     * @throws { BusinessError } 13900029 - Resource deadlock would occur
1901     * @throws { BusinessError } 13900030 - File name too long
1902     * @throws { BusinessError } 13900033 - Too many symbolic links encountered
1903     * @throws { BusinessError } 13900034 - Operation would block
1904     * @throws { BusinessError } 13900038 - Value too large for defined data type
1905     * @throws { BusinessError } 13900041 - Quota exceeded
1906     * @throws { BusinessError } 13900042 - Unknown error
1907     * @throws { BusinessError } 14000001 - Invalid display name
1908     * @throws { BusinessError } 14000002 - Invalid uri
1909     * @throws { BusinessError } 14000003 - Invalid file extension
1910     * @throws { BusinessError } 14000004 - File has been put into trash bin
1911     * @throws { BusinessError } 14300001 - IPC error
1912     * @throws { BusinessError } 14300002 - Invalid uri
1913     * @throws { BusinessError } 14300003 - Fail to get fileextension info
1914     * @throws { BusinessError } 14300004 - Get wrong result
1915     * @syscap SystemCapability.FileManagement.UserFileService
1916     * @systemapi
1917     * @since 9
1918     */
1919    getRoots(): Promise<RootIterator>;
1920
1921    /**
1922     * Get a RootIterator.
1923     *
1924     * @permission ohos.permission.FILE_ACCESS_MANAGER
1925     * @param { AsyncCallback<RootIterator> } callback - The callback is used to return a RootIterator.
1926     * @throws { BusinessError } 13900001 - Operation not permitted
1927     * @throws { BusinessError } 13900002 - No such file or directory
1928     * @throws { BusinessError } 13900004 - Interrupted system call
1929     * @throws { BusinessError } 13900006 - No such device or address
1930     * @throws { BusinessError } 13900008 - Bad file descriptor
1931     * @throws { BusinessError } 13900011 - Out of memory
1932     * @throws { BusinessError } 13900012 - Permission denied
1933     * @throws { BusinessError } 13900013 - Bad address
1934     * @throws { BusinessError } 13900014 - Device or resource busy
1935     * @throws { BusinessError } 13900015 - File exists
1936     * @throws { BusinessError } 13900017 - No such device
1937     * @throws { BusinessError } 13900018 - Not a directory
1938     * @throws { BusinessError } 13900019 - Is a directory
1939     * @throws { BusinessError } 13900020 - Invalid argument
1940     * @throws { BusinessError } 13900022 - Too many open files
1941     * @throws { BusinessError } 13900023 - Text file busy
1942     * @throws { BusinessError } 13900024 - File too large
1943     * @throws { BusinessError } 13900025 - No space left on device
1944     * @throws { BusinessError } 13900027 - Read-only file system
1945     * @throws { BusinessError } 13900029 - Resource deadlock would occur
1946     * @throws { BusinessError } 13900030 - File name too long
1947     * @throws { BusinessError } 13900033 - Too many symbolic links encountered
1948     * @throws { BusinessError } 13900034 - Operation would block
1949     * @throws { BusinessError } 13900038 - Value too large for defined data type
1950     * @throws { BusinessError } 13900041 - Quota exceeded
1951     * @throws { BusinessError } 13900042 - Unknown error
1952     * @throws { BusinessError } 14000001 - Invalid display name
1953     * @throws { BusinessError } 14000002 - Invalid uri
1954     * @throws { BusinessError } 14000003 - Invalid file extension
1955     * @throws { BusinessError } 14000004 - File has been put into trash bin
1956     * @throws { BusinessError } 14300001 - IPC error
1957     * @throws { BusinessError } 14300002 - Invalid uri
1958     * @throws { BusinessError } 14300003 - Fail to get fileextension info
1959     * @throws { BusinessError } 14300004 - Get wrong result
1960     * @syscap SystemCapability.FileManagement.UserFileService
1961     * @systemapi
1962     * @since 9
1963     */
1964    getRoots(callback: AsyncCallback<RootIterator>): void;
1965
1966    /**
1967     * Turn on monitor the specified uri.
1968     *
1969     * @permission ohos.permission.FILE_ACCESS_MANAGER
1970     * @param { string } uri - Indicates the file or directory to be monitored.
1971     * @param { boolean } notifyForDescendants - Indicates Whether to monitor changes in descendants.
1972     * @param { Callback<NotifyMessage> } callback - The callback is used to return the notify message.
1973     * @throws { BusinessError } 14300002 - Invalid uri
1974     * @syscap SystemCapability.FileManagement.UserFileService
1975     * @systemapi
1976     * @since 10
1977     */
1978    registerObserver(uri: string, notifyForDescendants: boolean, callback: Callback<NotifyMessage>): void;
1979
1980    /**
1981     * Turn off monitor the specified uri.
1982     *
1983     * @permission ohos.permission.FILE_ACCESS_MANAGER
1984     * @param { string } uri - Indicates the file or directory the file that will cancel monitored.
1985     * @param { Callback<NotifyMessage> } callback - The object bound to the uri.
1986     * @throws { BusinessError } 14300002 - Invalid uri
1987     * @syscap SystemCapability.FileManagement.UserFileService
1988     * @systemapi
1989     * @since 10
1990     */
1991    unregisterObserver(uri: string, callback?: Callback<NotifyMessage>): void;
1992
1993    /**
1994     * Move file or directory in the promise way, And return the MoveResult.
1995     *
1996     * @permission ohos.permission.FILE_ACCESS_MANAGER
1997     * @param { string } sourceUri - Indicates the file or directory to be moved.
1998     * @param { string } destUri - Represents the destination directory.
1999     * @param { boolean } [force] - Optional parameter that determines whether to forcibly move files.
2000     * @returns { Promise<Array<MoveResult>> } Returns the file information where the error occurred.
2001     * @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken.
2002     * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
2003     * @throws { BusinessError } 13900001 - Operation not permitted
2004     * @throws { BusinessError } 13900002 - No such file or directory
2005     * @throws { BusinessError } 13900004 - Interrupted system call
2006     * @throws { BusinessError } 13900008 - Bad file descriptor
2007     * @throws { BusinessError } 13900011 - Out of memory
2008     * @throws { BusinessError } 13900012 - Permission denied
2009     * @throws { BusinessError } 13900014 - Device or resource busy
2010     * @throws { BusinessError } 13900015 - File exists
2011     * @throws { BusinessError } 13900018 - Not a directory
2012     * @throws { BusinessError } 13900019 - Is a directory
2013     * @throws { BusinessError } 13900020 - Invalid argument
2014     * @throws { BusinessError } 13900022 - Too many open files
2015     * @throws { BusinessError } 13900023 - Text file busy
2016     * @throws { BusinessError } 13900024 - File too large
2017     * @throws { BusinessError } 13900025 - No space left on device
2018     * @throws { BusinessError } 13900027 - Read-only file system
2019     * @throws { BusinessError } 13900030 - File name too long
2020     * @throws { BusinessError } 13900042 - Unknown error
2021     * @throws { BusinessError } 14300001 - IPC error
2022     * @throws { BusinessError } 14300002 - Invalid uri
2023     * @throws { BusinessError } 14300003 - Fail to get fileextension info
2024     * @throws { BusinessError } 14300004 - Get wrong result
2025     * @syscap SystemCapability.FileManagement.UserFileService
2026     * @systemapi
2027     * @StageModelOnly
2028     * @since 11
2029     */
2030    moveItem(sourceUri: string, destUri: string, force?: boolean): Promise<Array<MoveResult>>;
2031
2032    /**
2033     * Move file or directory in the asyncCallback way, and return the MoveResult.
2034     *
2035     * @permission ohos.permission.FILE_ACCESS_MANAGER
2036     * @param { string } sourceUri - Indicates the file or directory to be moved.
2037     * @param { string } destUri - Represents the destination directory.
2038     * @param { AsyncCallback<Array<MoveResult>> } callback - The callback is used to return the file information where the error occurred.
2039     * @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken.
2040     * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
2041     * @throws { BusinessError } 13900001 - Operation not permitted
2042     * @throws { BusinessError } 13900002 - No such file or directory
2043     * @throws { BusinessError } 13900004 - Interrupted system call
2044     * @throws { BusinessError } 13900008 - Bad file descriptor
2045     * @throws { BusinessError } 13900011 - Out of memory
2046     * @throws { BusinessError } 13900012 - Permission denied
2047     * @throws { BusinessError } 13900014 - Device or resource busy
2048     * @throws { BusinessError } 13900015 - File exists
2049     * @throws { BusinessError } 13900018 - Not a directory
2050     * @throws { BusinessError } 13900019 - Is a directory
2051     * @throws { BusinessError } 13900020 - Invalid argument
2052     * @throws { BusinessError } 13900022 - Too many open files
2053     * @throws { BusinessError } 13900023 - Text file busy
2054     * @throws { BusinessError } 13900024 - File too large
2055     * @throws { BusinessError } 13900025 - No space left on device
2056     * @throws { BusinessError } 13900027 - Read-only file system
2057     * @throws { BusinessError } 13900030 - File name too long
2058     * @throws { BusinessError } 13900042 - Unknown error
2059     * @throws { BusinessError } 14300001 - IPC error
2060     * @throws { BusinessError } 14300002 - Invalid uri
2061     * @throws { BusinessError } 14300003 - Fail to get fileextension info
2062     * @throws { BusinessError } 14300004 - Get wrong result
2063     * @syscap SystemCapability.FileManagement.UserFileService
2064     * @systemapi
2065     * @StageModelOnly
2066     * @since 11
2067     */
2068    moveItem(sourceUri: string, destUri: string, callback: AsyncCallback<Array<MoveResult>>): void;
2069
2070    /**
2071     * Move file or directory in the asyncCallback way, and return the MoveResult.
2072     *
2073     * @permission ohos.permission.FILE_ACCESS_MANAGER
2074     * @param { string } sourceUri - Indicates the file or directory to be moved.
2075     * @param { string } destUri - Represents the destination directory.
2076     * @param { boolean } force - Determines whether to forcibly move files.
2077     * @param { AsyncCallback<Array<MoveResult>> } callback - The callback is used to return the file information where the error occurred.
2078     * @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken.
2079     * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
2080     * @throws { BusinessError } 13900001 - Operation not permitted
2081     * @throws { BusinessError } 13900002 - No such file or directory
2082     * @throws { BusinessError } 13900004 - Interrupted system call
2083     * @throws { BusinessError } 13900008 - Bad file descriptor
2084     * @throws { BusinessError } 13900011 - Out of memory
2085     * @throws { BusinessError } 13900012 - Permission denied
2086     * @throws { BusinessError } 13900014 - Device or resource busy
2087     * @throws { BusinessError } 13900015 - File exists
2088     * @throws { BusinessError } 13900018 - Not a directory
2089     * @throws { BusinessError } 13900019 - Is a directory
2090     * @throws { BusinessError } 13900020 - Invalid argument
2091     * @throws { BusinessError } 13900022 - Too many open files
2092     * @throws { BusinessError } 13900023 - Text file busy
2093     * @throws { BusinessError } 13900024 - File too large
2094     * @throws { BusinessError } 13900025 - No space left on device
2095     * @throws { BusinessError } 13900027 - Read-only file system
2096     * @throws { BusinessError } 13900030 - File name too long
2097     * @throws { BusinessError } 13900042 - Unknown error
2098     * @throws { BusinessError } 14300001 - IPC error
2099     * @throws { BusinessError } 14300002 - Invalid uri
2100     * @throws { BusinessError } 14300003 - Fail to get fileextension info
2101     * @throws { BusinessError } 14300004 - Get wrong result
2102     * @syscap SystemCapability.FileManagement.UserFileService
2103     * @systemapi
2104     * @StageModelOnly
2105     * @since 11
2106     */
2107    moveItem(sourceUri: string, destUri: string, force: boolean, callback: AsyncCallback<Array<MoveResult>>): void;
2108
2109    /**
2110     * Move the file with the specified file name in the promise way.
2111     *
2112     * @permission ohos.permission.FILE_ACCESS_MANAGER
2113     * @param { string } sourceUri - Indicates the file or directory to be moved.
2114     * @param { string } destUri - Represents the destination folder.
2115     * @param { string } fileName - Represents the name of the specified file.
2116     * @returns { Promise<string> } Returns the generated new file uri.
2117     * @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken.
2118     * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
2119     * @throws { BusinessError } 13900001 - Operation not permitted
2120     * @throws { BusinessError } 13900002 - No such file or directory
2121     * @throws { BusinessError } 13900004 - Interrupted system call
2122     * @throws { BusinessError } 13900008 - Bad file descriptor
2123     * @throws { BusinessError } 13900011 - Out of memory
2124     * @throws { BusinessError } 13900012 - Permission denied
2125     * @throws { BusinessError } 13900014 - Device or resource busy
2126     * @throws { BusinessError } 13900015 - File exists
2127     * @throws { BusinessError } 13900018 - Not a directory
2128     * @throws { BusinessError } 13900019 - Is a directory
2129     * @throws { BusinessError } 13900020 - Invalid argument
2130     * @throws { BusinessError } 13900022 - Too many open files
2131     * @throws { BusinessError } 13900023 - Text file busy
2132     * @throws { BusinessError } 13900024 - File too large
2133     * @throws { BusinessError } 13900025 - No space left on device
2134     * @throws { BusinessError } 13900027 - Read-only file system
2135     * @throws { BusinessError } 13900030 - File name too long
2136     * @throws { BusinessError } 13900042 - Unknown error
2137     * @throws { BusinessError } 14300001 - IPC error
2138     * @throws { BusinessError } 14300002 - Invalid uri
2139     * @throws { BusinessError } 14300003 - Fail to get fileextension info
2140     * @throws { BusinessError } 14300004 - Get wrong result
2141     * @syscap SystemCapability.FileManagement.UserFileService
2142     * @systemapi
2143     * @StageModelOnly
2144     * @since 11
2145     */
2146    moveFile(sourceUri: string, destUri: string, fileName: string): Promise<string>;
2147
2148    /**
2149     * Move the file with the specified file name in the asyncCallback way.
2150     *
2151     * @permission ohos.permission.FILE_ACCESS_MANAGER
2152     * @param { string } sourceUri - Indicates the file or directory to be moved.
2153     * @param { string } destUri - Represents the destination folder.
2154     * @param { string } fileName - Represents the name of the specified file.
2155     * @param { AsyncCallback<string> } callback - The callback is used to return the generated new file uri.
2156     * @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken.
2157     * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
2158     * @throws { BusinessError } 13900001 - Operation not permitted
2159     * @throws { BusinessError } 13900002 - No such file or directory
2160     * @throws { BusinessError } 13900004 - Interrupted system call
2161     * @throws { BusinessError } 13900008 - Bad file descriptor
2162     * @throws { BusinessError } 13900011 - Out of memory
2163     * @throws { BusinessError } 13900012 - Permission denied
2164     * @throws { BusinessError } 13900014 - Device or resource busy
2165     * @throws { BusinessError } 13900015 - File exists
2166     * @throws { BusinessError } 13900018 - Not a directory
2167     * @throws { BusinessError } 13900019 - Is a directory
2168     * @throws { BusinessError } 13900020 - Invalid argument
2169     * @throws { BusinessError } 13900022 - Too many open files
2170     * @throws { BusinessError } 13900023 - Text file busy
2171     * @throws { BusinessError } 13900024 - File too large
2172     * @throws { BusinessError } 13900025 - No space left on device
2173     * @throws { BusinessError } 13900027 - Read-only file system
2174     * @throws { BusinessError } 13900030 - File name too long
2175     * @throws { BusinessError } 13900042 - Unknown error
2176     * @throws { BusinessError } 14300001 - IPC error
2177     * @throws { BusinessError } 14300002 - Invalid uri
2178     * @throws { BusinessError } 14300003 - Fail to get fileextension info
2179     * @throws { BusinessError } 14300004 - Get wrong result
2180     * @syscap SystemCapability.FileManagement.UserFileService
2181     * @systemapi
2182     * @StageModelOnly
2183     * @since 11
2184     */
2185    moveFile(sourceUri: string, destUri: string, fileName: string, callback: AsyncCallback<string>): void;
2186  }
2187}
2188
2189export default fileAccess;
2190