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