1# @ohos.document (File Operation) 2 3> **NOTE** 4> 5> - The initial APIs of this module are supported since API version 6. Newly added APIs will be marked with a superscript to indicate their earliest API version. 6> - The APIs of this module have been deprecated since API version 9 and are not recommended for use. An exception will be thrown if any of the APIs is called. 7 8## Modules to Import 9 10```ts 11import document from '@ohos.document'; 12``` 13 14## document.choose<sup>(deprecated)</sup> 15 16choose(types?: string[]): Promise<string> 17 18Chooses files of the specified types. This API uses a promise to return the result. 19 20**System capability**: SystemCapability.FileManagement.UserFileService 21 22**Parameters** 23 24 | Name| Type | Mandatory| Description | 25 | ------ | ------ | ---- | ---------------------------- | 26 | types | string[] | No | Types of the files to choose.| 27 28**Return value** 29 30 | Type | Description | 31 | --------------------- | -------------- | 32 | Promise<string> | Promise used to return the result. An error code is returned.| 33 34**Example** 35 36 ```ts 37 let types: Array<string> = []; 38 document.choose(types); 39 ``` 40## document.choose<sup>(deprecated)</sup> 41 42choose(callback:AsyncCallback<string>): void 43 44Chooses a file. This API uses an asynchronous callback to return the result. 45 46**System capability**: SystemCapability.FileManagement.UserFileService 47 48**Parameters** 49 50 | Name | Type | Mandatory| Description | 51 | -------- | --------------------------- | ---- | ---------------------------- | 52 | callback | AsyncCallback<string> | Yes | Callback used to return the result. An error code is returned.| 53 54**Example** 55 56 ```ts 57 let uri: string = ""; 58 document.choose((err: TypeError, uri: string) => { 59 // Do something with the URI. 60 }); 61 ``` 62## document.choose<sup>(deprecated)</sup> 63 64choose(types:string[], callback:AsyncCallback<string>): void 65 66Chooses files of the specified types. This API uses an asynchronous callback to return the result. 67 68**System capability**: SystemCapability.FileManagement.UserFileService 69 70**Parameters** 71 72 | Name | Type | Mandatory| Description | 73 | -------- | --------------------------- | ---- | ---------------------------- | 74 | types | string[] | Yes | Types of the files to choose.| 75 | callback | AsyncCallback<string> | Yes | Callback used to return the result. An error code is returned.| 76 77**Example** 78 79 ```ts 80 let types: Array<string> = []; 81 let uri: string = ""; 82 document.choose(types, (err: TypeError, uri: string) => { 83 // Do something with the URI. 84 }); 85 ``` 86 87## document.show<sup>(deprecated)</sup> 88 89show(uri:string, type:string):Promise<void> 90 91Opens a file. This API uses a promise to return the result. 92 93**System capability**: SystemCapability.FileManagement.UserFileService 94 95**Parameters** 96 97 | Name| Type | Mandatory| Description | 98 | ---- | ------ | ---- | ---------------------------- | 99 | uri | string | Yes | URI of the file to open.| 100 | type | string | Yes | Type of the file to open.| 101 102**Return value** 103 104 | Type | Description | 105 | --------------------- | ------------ | 106 | Promise<void> | Promise used to return the result. An error code is returned.| 107 108**Example** 109 110 ```ts 111 let type: string = ""; 112 let uri: string = ""; 113 document.show(uri, type); 114 ``` 115 116## document.show<sup>(deprecated)</sup> 117 118show(uri:string, type:string, callback:AsyncCallback<void>): void 119 120Opens a file. This API uses an asynchronous callback to return the result. 121 122**System capability**: SystemCapability.FileManagement.UserFileService 123 124**Parameters** 125 126 | Name | Type | Mandatory| Description | 127 | -------- | --------------------------- | ---- | ---------------------------- | 128 | uri | string | Yes | URI of the file to open.| 129 | type | string | Yes | Type of the file to open.| 130 | callback | AsyncCallback<void> | Yes | Callback used to return the result. An error code is returned. | 131 132**Example** 133 134 ```ts 135 let type: string = ""; 136 let uri: string = ""; 137 document.show(uri, type, (err: TypeError) => { 138 //do something 139 }); 140 ``` 141