未验证 提交 c7dd3312 编写于 作者: O openharmony_ci 提交者: Gitee

!14967 [翻译完成】#I6D82B

Merge pull request !14967 from Annie_wang/PR14240
...@@ -17,7 +17,7 @@ import fileAccess from '@ohos.file.fileAccess'; ...@@ -17,7 +17,7 @@ import fileAccess from '@ohos.file.fileAccess';
getFileAccessAbilityInfo( ) : Promise<Array<Want>> getFileAccessAbilityInfo( ) : Promise<Array<Want>>
Obtains information about all wants with **extension** set to **fileAcesss** in the system. A want is a basic communication component used to start services. This API uses a promise to return the result. Obtains information about all wants with **extension** set to **fileAccess** in the system. A want is a basic communication component used to start services. This API uses a promise to return the result.
**System capability**: SystemCapability.FileManagement.UserFileService **System capability**: SystemCapability.FileManagement.UserFileService
...@@ -25,9 +25,9 @@ Obtains information about all wants with **extension** set to **fileAcesss** in ...@@ -25,9 +25,9 @@ Obtains information about all wants with **extension** set to **fileAcesss** in
**Return value** **Return value**
| Type| Description| | Type| Description|
| --- | -- | | --- | -- |
| Promise<Array<Want>> | Promise used to return the **want** information obtained.| | Promise<Array<Want>> | Promise used to return the **want** information obtained.|
**Example** **Example**
...@@ -47,7 +47,7 @@ Obtains information about all wants with **extension** set to **fileAcesss** in ...@@ -47,7 +47,7 @@ Obtains information about all wants with **extension** set to **fileAcesss** in
getFileAccessAbilityInfo(callback: AsyncCallback<Array<Want>>): void; getFileAccessAbilityInfo(callback: AsyncCallback<Array<Want>>): void;
Obtains information about all wants with **extension** set to **fileAcesss** in the system. A want is a basic communication component used to start services. This API uses an asynchronous callback to return the result. Obtains information about all wants with **extension** set to **fileAccess** in the system. A want is a basic communication component used to start services. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.FileManagement.UserFileService **System capability**: SystemCapability.FileManagement.UserFileService
...@@ -55,9 +55,9 @@ Obtains information about all wants with **extension** set to **fileAcesss** in ...@@ -55,9 +55,9 @@ Obtains information about all wants with **extension** set to **fileAcesss** in
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| --- | --- | --- | -- | | --- | --- | --- | -- |
| callback | AsyncCallback<Array<Want>> | Yes| Promise used to return the **want** information obtained.| | callback | AsyncCallback<Array<Want>> | Yes| Promise used to return the **want** information obtained.|
**Example** **Example**
...@@ -89,16 +89,16 @@ Synchronously creates a **Helper** object to connect to the specified wants. The ...@@ -89,16 +89,16 @@ Synchronously creates a **Helper** object to connect to the specified wants. The
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| --- | --- | --- | -- | | --- | --- | --- | -- |
| context | Context | Yes| Context of the ability.| | context | Context | Yes| Context of the ability.|
| wants | Array<Want> | Yes| Wants to connect.| | wants | Array<Want> | Yes| Wants to connect.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| --- | -- | | --- | -- |
| FileAccessHelper | **Helper** object created.| | FileAccessHelper | **Helper** object created.|
**Example** **Example**
...@@ -114,7 +114,7 @@ Synchronously creates a **Helper** object to connect to the specified wants. The ...@@ -114,7 +114,7 @@ Synchronously creates a **Helper** object to connect to the specified wants. The
}, },
] ]
try { try {
// this.context is passed by MainAbility. // this.context is passed by EntryAbility.
fileAccessHelper = fileAccess.createFileAccessHelper(this.context, wantInfos); fileAccessHelper = fileAccess.createFileAccessHelper(this.context, wantInfos);
if (!fileAccessHelper) if (!fileAccessHelper)
console.error("createFileAccessHelper interface returns an undefined object"); console.error("createFileAccessHelper interface returns an undefined object");
...@@ -136,15 +136,15 @@ Synchronously creates a **Helper** object to connect to all file management serv ...@@ -136,15 +136,15 @@ Synchronously creates a **Helper** object to connect to all file management serv
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| --- | --- | --- | -- | | --- | --- | --- | -- |
| context | Context | Yes| Context of the ability.| | context | Context | Yes| Context of the ability.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| --- | -- | | --- | -- |
| FileAccessHelper | **Helper** object created.| | FileAccessHelper | **Helper** object created.|
**Example** **Example**
...@@ -153,7 +153,7 @@ Synchronously creates a **Helper** object to connect to all file management serv ...@@ -153,7 +153,7 @@ Synchronously creates a **Helper** object to connect to all file management serv
let fileAccesssHelperAllServer = null; let fileAccesssHelperAllServer = null;
// Create a Helper object to interact with all file management services configured with fileAccess in the system. // Create a Helper object to interact with all file management services configured with fileAccess in the system.
try { try {
// this.context is passed by MainAbility. // this.context is passed by EntryAbility.
fileAccesssHelperAllServer = fileAccess.createFileAccessHelper(this.context); fileAccesssHelperAllServer = fileAccess.createFileAccessHelper(this.context);
if (!fileAccesssHelperAllServer) if (!fileAccesssHelperAllServer)
console.error("createFileAccessHelper interface returns an undefined object"); console.error("createFileAccessHelper interface returns an undefined object");
...@@ -167,8 +167,7 @@ Synchronously creates a **Helper** object to connect to all file management serv ...@@ -167,8 +167,7 @@ Synchronously creates a **Helper** object to connect to all file management serv
getRoots( ) : Promise<RootIterator> getRoots( ) : Promise<RootIterator>
Obtains information about the device root nodes of the file management service type connected to the **Helper** object. This API uses a promise to return a **RootIterator** object, which Obtains information about the device root nodes of the file management service type connected to the **Helper** object. This API uses a promise to return a **RootIterator** object, which returns [RootInfo](#rootinfo) by using [next()](#rootiteratornext).
returns [RootInfo](#rootinfo) by using [next()](#rootiteratornext).
**System capability**: SystemCapability.FileManagement.UserFileService **System capability**: SystemCapability.FileManagement.UserFileService
...@@ -176,9 +175,9 @@ returns [RootInfo](#rootinfo) by using [next()](#rootiteratornext). ...@@ -176,9 +175,9 @@ returns [RootInfo](#rootinfo) by using [next()](#rootiteratornext).
**Return value** **Return value**
| Type| Description| | Type| Description|
| --- | -- | | --- | -- |
| Promise<RootIterator> | Promise used to return the **RootIterator** object obtained.| | Promise<RootIterator> | Promise used to return the **RootIterator** object obtained.|
**Example** **Example**
...@@ -211,8 +210,7 @@ returns [RootInfo](#rootinfo) by using [next()](#rootiteratornext). ...@@ -211,8 +210,7 @@ returns [RootInfo](#rootinfo) by using [next()](#rootiteratornext).
getRoots(callback:AsyncCallback<RootIterator>) : void; getRoots(callback:AsyncCallback<RootIterator>) : void;
Obtains information about the device root nodes of the file management service type connected to the **Helper** object. This API uses an asynchronous callback to return the result. Obtains information about the device root nodes of the file management service type connected to the **Helper** object. This API uses an asynchronous callback to return the result. The callback has a **RootIterator** object, which returns [RootInfo](#rootinfo) through [next()](#rootiteratornext).
The callback has a **RootIterator** object, which returns [RootInfo](#rootinfo) through [next()](#rootiteratornext).
**System capability**: SystemCapability.FileManagement.UserFileService **System capability**: SystemCapability.FileManagement.UserFileService
...@@ -220,9 +218,9 @@ The callback has a **RootIterator** object, which returns [RootInfo](#rootinfo) ...@@ -220,9 +218,9 @@ The callback has a **RootIterator** object, which returns [RootInfo](#rootinfo)
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| --- | --- | --- | -- | | --- | --- | --- | -- |
| callback | AsyncCallback<RootIterator> | Yes| Promise used to return the **RootIterator** object obtained.| | callback | AsyncCallback<RootIterator> | Yes| Promise used to return the **RootIterator** object obtained.|
**Example** **Example**
...@@ -263,16 +261,16 @@ Synchronously obtains the **FileIterator** object of the first-level files (file ...@@ -263,16 +261,16 @@ Synchronously obtains the **FileIterator** object of the first-level files (file
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| --- | --- | -- | -- | | --- | --- | -- | -- |
| filter | Filter | No| **Filter** object. | | filter | Filter | No| **Filter** object. |
**Return value** **Return value**
| Type| Description| | Type| Description|
| --- | -- | | --- | -- |
| FileIterator | **FileIterator** object obtained.| | FileIterator | **FileIterator** object obtained.|
**Example** **Example**
...@@ -314,15 +312,15 @@ Recursively obtains the **FileIterator** object of the files matching the condit ...@@ -314,15 +312,15 @@ Recursively obtains the **FileIterator** object of the files matching the condit
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| --- | --- | -- | -- | | --- | --- | -- | -- |
| filter | Filter | No| **Filter** object. | | filter | Filter | No| **Filter** object. |
**Return value** **Return value**
| Type| Description| | Type| Description|
| --- | -- | | --- | -- |
| FileIterator | **FileIterator** object obtained.| | FileIterator | **FileIterator** object obtained.|
**Example** **Example**
...@@ -364,15 +362,15 @@ Synchronously obtains the **FileIterator** object of the next-level files (file ...@@ -364,15 +362,15 @@ Synchronously obtains the **FileIterator** object of the next-level files (file
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| --- | --- | -- | -- | | --- | --- | -- | -- |
| filter | Filter | No| **Filter** object. | | filter | Filter | No| **Filter** object. |
**Return value** **Return value**
| Type| Description| | Type| Description|
| --- | -- | | --- | -- |
| FileIterator | **FileIterator** object obtained.| | FileIterator | **FileIterator** object obtained.|
**Example** **Example**
...@@ -414,16 +412,16 @@ Recursively obtains the **FileIterator** object of the files matching the condit ...@@ -414,16 +412,16 @@ Recursively obtains the **FileIterator** object of the files matching the condit
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| --- | --- | -- | -- | | --- | --- | -- | -- |
| filter | Filter | No| **Filter** object. | | filter | Filter | No| **Filter** object. |
**Return value** **Return value**
| Type| Description| | Type| Description|
| --- | -- | | --- | -- |
| FileIterator | **FileIterator** object obtained.| | FileIterator | **FileIterator** object obtained.|
**Example** **Example**
...@@ -465,10 +463,10 @@ Creates a file in a directory. This API uses a promise to return the result. ...@@ -465,10 +463,10 @@ Creates a file in a directory. This API uses a promise to return the result.
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| --- | --- | --- | -- | | --- | --- | --- | -- |
| uri | string | Yes| URI of the parent directory for the file to create.| | uri | string | Yes| URI of the parent directory for the file to create.|
| displayName | string | Yes| Name of the file to create. By default, the name of a local file must contain the file name extension.| | displayName | string | Yes| Name of the file to create. By default, the name of a local file must contain the file name extension.|
**Return value** **Return value**
...@@ -510,11 +508,11 @@ Creates a file in a directory. This API uses an asynchronous callback to return ...@@ -510,11 +508,11 @@ Creates a file in a directory. This API uses an asynchronous callback to return
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| --- | --- | --- | -- | | --- | --- | --- | -- |
| uri | string | Yes| URI of the parent directory for the file to create.| | uri | string | Yes| URI of the parent directory for the file to create.|
| displayName | string | Yes| Name of the file to create. By default, the name of a local file must contain the file name extension.| | displayName | string | Yes| Name of the file to create. By default, the name of a local file must contain the file name extension.|
| callback | AsyncCallback<string> | Yes| Promise used to return the URI of the file created.| | callback | AsyncCallback<string> | Yes| Promise used to return the URI of the file created.|
**Example** **Example**
...@@ -550,10 +548,10 @@ Creates a folder in a directory. This API uses a promise to return the result. ...@@ -550,10 +548,10 @@ Creates a folder in a directory. This API uses a promise to return the result.
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| --- | --- | --- | -- | | --- | --- | --- | -- |
| parentUri | string | Yes| URI of the parent directory for the folder to create.| | parentUri | string | Yes| URI of the parent directory for the folder to create.|
| displayName | string | Yes| Name of the folder to create.| | displayName | string | Yes| Name of the folder to create.|
**Return value** **Return value**
...@@ -595,11 +593,11 @@ Creates a folder in a directory. This API uses an asynchronous callback to retur ...@@ -595,11 +593,11 @@ Creates a folder in a directory. This API uses an asynchronous callback to retur
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| --- | --- | --- | -- | | --- | --- | --- | -- |
| parentUri | string | Yes| URI of the parent directory for the folder to create.| | parentUri | string | Yes| URI of the parent directory for the folder to create.|
| displayName | string | Yes| Name of the folder to create.| | displayName | string | Yes| Name of the folder to create.|
| callback | AsyncCallback<string> | Yes| Promise used to return the URI of the folder created.| | callback | AsyncCallback<string> | Yes| Promise used to return the URI of the folder created.|
**Example** **Example**
...@@ -635,16 +633,16 @@ Opens a file. This API uses a promise to return the result. ...@@ -635,16 +633,16 @@ Opens a file. This API uses a promise to return the result.
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| --- | --- | --- | -- | | --- | --- | --- | -- |
| uri | string | Yes| URI of the file to open.| | uri | string | Yes| URI of the file to open.|
| flags | [OPENFLAGS](#openflags) | Yes| File open mode.| | flags | [OPENFLAGS](#openflags) | Yes| File open mode.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| --- | -- | | --- | -- |
| Promise<number> | Promise used to return the handle to the file opened.| | Promise<number> | Promise used to return the file descriptor of the file opened.|
**Example** **Example**
...@@ -673,11 +671,11 @@ Opens a file. This API uses an asynchronous callback to return the result. ...@@ -673,11 +671,11 @@ Opens a file. This API uses an asynchronous callback to return the result.
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| --- | --- | --- | -- | | --- | --- | --- | -- |
| uri | string | Yes| URI of the file to open.| | uri | string | Yes| URI of the file to open.|
| flags | [OPENFLAGS](#openflags) | Yes| File open mode.| | flags | [OPENFLAGS](#openflags) | Yes| File open mode.|
| callback | AsyncCallback<number> | Yes| Promise used to return the handle to the file opened.| | callback | AsyncCallback<number> | Yes| Callback invoked to return the file descriptor of the file opened.|
**Example** **Example**
...@@ -712,9 +710,9 @@ Deletes a file or folder. This API uses a promise to return the result. ...@@ -712,9 +710,9 @@ Deletes a file or folder. This API uses a promise to return the result.
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| --- | --- | --- | -- | | --- | --- | --- | -- |
| uri | string | Yes| URI of the file or folder to delete.| | uri | string | Yes| URI of the file or folder to delete.|
**Return value** **Return value**
...@@ -751,10 +749,10 @@ Deletes a file or folder. This API uses an asynchronous callback to return the r ...@@ -751,10 +749,10 @@ Deletes a file or folder. This API uses an asynchronous callback to return the r
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| --- | --- | --- | -- | | --- | --- | --- | -- |
| uri | string | Yes| URI of the file or folder to delete.| | uri | string | Yes| URI of the file or folder to delete.|
| callback | AsyncCallback<number> | Yes| Promise used to return the result.| | callback | AsyncCallback<number> | Yes| Promise used to return the result.|
**Example** **Example**
...@@ -789,10 +787,10 @@ Moves a file or folder. This API uses a promise to return the result. ...@@ -789,10 +787,10 @@ Moves a file or folder. This API uses a promise to return the result.
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| --- | --- | --- | -- | | --- | --- | --- | -- |
| sourceFile | string | Yes| URI of the file or folder to move.| | sourceFile | string | Yes| URI of the file or folder to move.|
| destFile | string | Yes| URI of the folder to which the file or folder will be moved.| | destFile | string | Yes| URI of the folder to which the file or folder will be moved.|
**Return value** **Return value**
...@@ -829,11 +827,11 @@ Moves a file or folder. This API uses an asynchronous callback to return the res ...@@ -829,11 +827,11 @@ Moves a file or folder. This API uses an asynchronous callback to return the res
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| --- | --- | --- | -- | | --- | --- | --- | -- |
| sourceFile | string | Yes| URI of the file or folder to move.| | sourceFile | string | Yes| URI of the file or folder to move.|
| destFile | string | Yes| URI of the folder to which the file or folder will be moved.| | destFile | string | Yes| URI of the folder to which the file or folder will be moved.|
| callback | AsyncCallback<string> | Yes| Promise used to return the URI of the file or folder in the destination directory.| | callback | AsyncCallback<string> | Yes| Promise used to return the URI of the file or folder in the destination directory.|
**Example** **Example**
...@@ -869,10 +867,10 @@ Renames a file or folder. This API uses a promise to return the result. ...@@ -869,10 +867,10 @@ Renames a file or folder. This API uses a promise to return the result.
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| --- | --- | --- | -- | | --- | --- | --- | -- |
| uri | string | Yes| URI of the file or folder to rename.| | uri | string | Yes| URI of the file or folder to rename.|
| displayName | string | Yes| New name of the file or folder, which can contain the file name extension.| | displayName | string | Yes| New name of the file or folder, which can contain the file name extension.|
**Return value** **Return value**
...@@ -908,11 +906,11 @@ Renames a file or folder. This API uses an asynchronous callback to return the r ...@@ -908,11 +906,11 @@ Renames a file or folder. This API uses an asynchronous callback to return the r
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| --- | --- | --- | -- | | --- | --- | --- | -- |
| uri | string | Yes| URI of the file or folder to rename.| | uri | string | Yes| URI of the file or folder to rename.|
| displayName | string | Yes| New name of the file or folder, which can contain the file name extension.| | displayName | string | Yes| New name of the file or folder, which can contain the file name extension.|
| callback | AsyncCallback<string> | Yes| Promise used to return the URI of the renamed file or folder.| | callback | AsyncCallback<string> | Yes| Promise used to return the URI of the renamed file or folder.|
**Example** **Example**
...@@ -947,9 +945,9 @@ Checks whether a file or folder exists. This API uses a promise to return the re ...@@ -947,9 +945,9 @@ Checks whether a file or folder exists. This API uses a promise to return the re
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| --- | --- | --- | -- | | --- | --- | --- | -- |
| sourceFileUri | string | Yes| URI of the file or folder.| | sourceFileUri | string | Yes| URI of the file or folder.|
**Return value** **Return value**
...@@ -988,10 +986,10 @@ Checks whether a file or folder exists. This API uses an asynchronous callback t ...@@ -988,10 +986,10 @@ Checks whether a file or folder exists. This API uses an asynchronous callback t
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| --- | --- | --- | -- | | --- | --- | --- | -- |
| sourceFileUri | string | Yes| URI of the file or folder.| | sourceFileUri | string | Yes| URI of the file or folder.|
| callback | AsyncCallback<boolean> | Yes| Promise used to return the result.| | callback | AsyncCallback<boolean> | Yes| Promise used to return the result.|
**Example** **Example**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册