1# @ohos.file.picker (File Picker) 2 3**Picker** encapsulates the system applications such as **PhotoViewPicker**, **DocumentViewPicker** and **AudioViewPicker** to provide capabilities of selecting and saving files of different types. The application can select the picker as required. 4 5> **NOTE** 6> 7> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. 8 9## Modules to Import 10 11```js 12import picker from '@ohos.file.picker'; 13``` 14 15## PhotoViewPicker 16 17Provides APIs for selecting and saving images and videos. Before using the APIs of **PhotoViewPicker**, you need to create a **PhotoViewPicker** instance. 18 19**System capability**: SystemCapability.FileManagement.UserFileService 20 21**Example** 22 23```ts 24let photoPicker = new picker.PhotoViewPicker(); 25``` 26 27### select 28 29select(option?: PhotoSelectOptions) : Promise<PhotoSelectResult> 30 31Selects one or more images or videos in a **photoPicker** page. This API uses a promise to return the result. You can pass in **PhotoSelectOptions** to specify the media file type and the maximum number of files to select. 32 33**System capability**: SystemCapability.FileManagement.UserFileService 34 35**Parameters** 36 37| Name | Type | Mandatory| Description | 38| ------- | ------- | ---- | -------------------------- | 39| option | [PhotoSelectOptions](#photoselectoptions) | No | Options for selecting files. If this parameter is not specified, images and videos are selected by default. A maximum of 50 files can be selected.| 40 41**Return value** 42 43| Type | Description | 44| ----------------------------- | :---- | 45| Promise<[PhotoSelectResult](#photoselectresult)> | Promise used to return information about the images or videos selected.| 46 47**Example** 48 49```ts 50async function example() { 51 try { 52 let PhotoSelectOptions = new picker.PhotoSelectOptions(); 53 PhotoSelectOptions.MIMEType = picker.PhotoViewMIMETypes.IMAGE_TYPE; 54 PhotoSelectOptions.maxSelectNumber = 5; 55 let photoPicker = new picker.PhotoViewPicker(); 56 photoPicker.select(PhotoSelectOptions).then((PhotoSelectResult) => { 57 console.info('PhotoViewPicker.select successfully, PhotoSelectResult uri: ' + JSON.stringify(PhotoSelectResult)); 58 }).catch((err) => { 59 console.error('PhotoViewPicker.select failed with err: ' + err); 60 }); 61 } catch (err) { 62 console.error('PhotoViewPicker failed with err: ' + err); 63 } 64} 65``` 66 67### select 68 69select(option: PhotoSelectOptions, callback: AsyncCallback<PhotoSelectResult>) : void 70 71Selects one or more images or videos in a **photoPicker** page. This API uses an asynchronous callback to return the result. You can pass in **PhotoSelectOptions** to specify the media file type and the maximum number of files to select. 72 73**System capability**: SystemCapability.FileManagement.UserFileService 74 75**Parameters** 76 77| Name | Type | Mandatory| Description | 78| ------- | ------- | ---- | -------------------------- | 79| option | [PhotoSelectOptions](#photoselectoptions) | Yes | Options for selecting images or videos.| 80| callback | AsyncCallback<[PhotoSelectResult](#photoselectresult)> | Yes | Callback invoked to return information about the images or videos selected.| 81 82**Example** 83 84```ts 85async function example() { 86 try { 87 let PhotoSelectOptions = new picker.PhotoSelectOptions(); 88 PhotoSelectOptions.MIMEType = picker.PhotoViewMIMETypes.IMAGE_TYPE; 89 PhotoSelectOptions.maxSelectNumber = 5; 90 let photoPicker = new picker.PhotoViewPicker(); 91 photoPicker.select(PhotoSelectOptions, (err, PhotoSelectResult) => { 92 if (err) { 93 console.error('PhotoViewPicker.select failed with err: ' + err); 94 return; 95 } 96 console.info('PhotoViewPicker.select successfully, PhotoSelectResult uri: ' + JSON.stringify(PhotoSelectResult)); 97 }); 98 } catch (err) { 99 console.error('PhotoViewPicker failed with err: ' + err); 100 } 101} 102``` 103 104### select 105 106select(callback: AsyncCallback<PhotoSelectResult>) : void 107 108Selects one or more images or videos in a **photoPicker** page. This API uses an asynchronous callback to return the result. 109 110**System capability**: SystemCapability.FileManagement.UserFileService 111 112**Parameters** 113 114| Name | Type | Mandatory| Description | 115| ------- | ------- | ---- | -------------------------- | 116| callback | AsyncCallback<[PhotoSelectResult](#photoselectresult)> | Yes | Callback invoked to return information about the images or videos selected.| 117 118**Example** 119 120```ts 121async function example() { 122 try { 123 let photoPicker = new picker.PhotoViewPicker(); 124 photoPicker.select((err, PhotoSelectResult) => { 125 if (err) { 126 console.error('PhotoViewPicker.select failed with err: ' + err); 127 return; 128 } 129 console.info('PhotoViewPicker.select successfully, PhotoSelectResult uri: ' + JSON.stringify(PhotoSelectResult)); 130 }); 131 } catch (err) { 132 console.error('PhotoViewPicker failed with err: ' + err); 133 } 134} 135``` 136 137### save 138 139save(option?: PhotoSaveOptions) : Promise<Array<string>> 140 141Saves one or more images or videos in a **photoPicker** page. This API uses a promise to return the result. You can pass in **PhotoSaveOptions** to specify the file names of the images or videos to save. 142 143**System capability**: SystemCapability.FileManagement.UserFileService 144 145**Parameters** 146 147| Name | Type | Mandatory| Description | 148| ------- | ------- | ---- | -------------------------- | 149| option | [PhotoSaveOptions](#photosaveoptions) | No | Options for saving files. If this parameter is not specified, a **photoPicker** page will be displayed for the user to enter the names of the files to save.| 150 151**Return value** 152 153| Type | Description | 154| ----------------------------- | :---- | 155| Promise<Array<string>> | Promise used to return the URIs of the files saved.| 156 157**Example** 158 159```ts 160async function example() { 161 try { 162 let PhotoSaveOptions = new picker.PhotoSaveOptions(); 163 PhotoSaveOptions.newFileNames = ['PhotoViewPicker01.jpg', 'PhotoViewPicker01.mp4']; 164 let photoPicker = new picker.PhotoViewPicker(); 165 photoPicker.save(PhotoSaveOptions).then((PhotoSaveResult) => { 166 console.info('PhotoViewPicker.save successfully, PhotoSaveResult uri: ' + JSON.stringify(PhotoSaveResult)); 167 }).catch((err) => { 168 console.error('PhotoViewPicker.save failed with err: ' + err); 169 }); 170 } catch (err) { 171 console.error('PhotoViewPicker failed with err: ' + err); 172 } 173} 174``` 175 176### save 177 178save(option: PhotoSaveOptions, callback: AsyncCallback<Array<string>>) : void 179 180Saves one or more images or videos in a **photoPicker** page. This API uses an asynchronous callback to return the result. You can pass in **PhotoSaveOptions** to specify the file names of the images or videos to save. 181 182**System capability**: SystemCapability.FileManagement.UserFileService 183 184**Parameters** 185 186| Name | Type | Mandatory| Description | 187| ------- | ------- | ---- | -------------------------- | 188| option | [PhotoSaveOptions](#photosaveoptions) | Yes | Options for saving images or videos.| 189| callback | AsyncCallback<Array<string>> | Yes | Callback invoked to return the URIs of the files saved.| 190 191**Example** 192 193```ts 194async function example() { 195 try { 196 let PhotoSaveOptions = new picker.PhotoSaveOptions(); 197 PhotoSaveOptions.newFileNames = ['PhotoViewPicker02.jpg','PhotoViewPicker02.mp4']; 198 let photoPicker = new picker.PhotoViewPicker(); 199 photoPicker.save(PhotoSaveOptions, (err, PhotoSaveResult) => { 200 if (err) { 201 console.error('PhotoViewPicker.save failed with err: ' + err); 202 return; 203 } 204 console.info('PhotoViewPicker.save successfully, PhotoSaveResult uri: ' + JSON.stringify(PhotoSaveResult)); 205 }); 206 } catch (err) { 207 console.error('PhotoViewPicker failed with err: ' + err); 208 } 209} 210``` 211 212### save 213 214save(callback: AsyncCallback<Array<string>>) : void 215 216Saves one or more images or videos in a **photoPicker** page. This API uses an asynchronous callback to return the result. 217 218**System capability**: SystemCapability.FileManagement.UserFileService 219 220**Parameters** 221 222| Name | Type | Mandatory| Description | 223| ------- | ------- | ---- | -------------------------- | 224| callback | AsyncCallback<Array<string>> | Yes | Callback invoked to return the URIs of the files saved.| 225 226**Example** 227 228```ts 229async function example() { 230 try { 231 let photoPicker = new picker.PhotoViewPicker(); 232 photoPicker.save((err, PhotoSaveResult) => { 233 if (err) { 234 console.error('PhotoViewPicker.save failed with err: ' + err); 235 return; 236 } 237 console.info('PhotoViewPicker.save successfully, PhotoSaveResult uri: ' + JSON.stringify(PhotoSaveResult)); 238 }); 239 } catch (err) { 240 console.error('PhotoViewPicker failed with err: ' + err); 241 } 242} 243``` 244 245## DocumentViewPicker 246 247Provides APIs for selecting and saving non-media files, for example, documents in a variety of formats. Before using the APIs of **DocumentViewPicker**, you need to create a **DocumentViewPicker** instance. 248 249**System capability**: SystemCapability.FileManagement.UserFileService 250 251**Example** 252 253```ts 254let documentPicker = new picker.DocumentViewPicker(); 255``` 256 257### select 258 259select(option?: DocumentSelectOptions) : Promise<Array<string>> 260 261Selects one or more documents in a **documentPicker** page. This API uses a promise to return the result. You can pass in **DocumentSelectOptions**. 262 263**System capability**: SystemCapability.FileManagement.UserFileService 264 265**Parameters** 266 267| Name | Type | Mandatory| Description | 268| ------- | ------- | ---- | -------------------------- | 269| option | [DocumentSelectOptions](#documentselectoptions) | No | Options for select documents. If this parameter is not specified, the **documentPicker** page is displayed by default.| 270 271**Return value** 272 273| Type | Description | 274| ----------------------------- | :---- | 275| Promise<Array<string>> | Promise used to return the URIs of the documents selected.| 276 277**Example** 278 279```ts 280async function example() { 281 try { 282 let DocumentSelectOptions = new picker.DocumentSelectOptions(); 283 let documentPicker = new picker.DocumentViewPicker(); 284 documentPicker.select(DocumentSelectOptions).then((DocumentSelectResult) => { 285 console.info('DocumentViewPicker.select successfully, DocumentSelectResult uri: ' + JSON.stringify(DocumentSelectResult)); 286 }).catch((err) => { 287 console.error('DocumentViewPicker.select failed with err: ' + err); 288 }); 289 } catch (err) { 290 console.error('DocumentViewPicker failed with err: ' + err); 291 } 292} 293``` 294 295### select 296 297select(option: DocumentSelectOptions, callback: AsyncCallback<Array<string>>) : void 298 299Selects one or more documents in a **documentPicker** page. This API uses an asynchronous callback to return the result. You can pass in **DocumentSelectOptions**. 300 301**System capability**: SystemCapability.FileManagement.UserFileService 302 303**Parameters** 304 305| Name | Type | Mandatory| Description | 306| ------- | ------- | ---- | -------------------------- | 307| option | [DocumentSelectOptions](#documentselectoptions) | Yes | Options for selecting documents.| 308| callback | AsyncCallback<Array<string>> | Yes | Callback invoked to return the URIs of the documents selected.| 309 310**Example** 311 312```ts 313async function example() { 314 try { 315 let DocumentSelectOptions = new picker.DocumentSelectOptions(); 316 let documentPicker = new picker.DocumentViewPicker(); 317 documentPicker.select(DocumentSelectOptions, (err, DocumentSelectResult) => { 318 if (err) { 319 console.error('DocumentViewPicker.select failed with err: ' + err); 320 return; 321 } 322 console.info('DocumentViewPicker.select successfully, DocumentSelectResult uri: ' + JSON.stringify(DocumentSelectResult)); 323 }); 324 } catch (err) { 325 console.error('DocumentViewPicker failed with err: ' + err); 326 } 327} 328``` 329 330### select 331 332select(callback: AsyncCallback<Array<string>>) : void 333 334Selects one or more documents in a **documentPicker** page. This API uses an asynchronous callback to return the result. 335 336**System capability**: SystemCapability.FileManagement.UserFileService 337 338**Parameters** 339 340| Name | Type | Mandatory| Description | 341| ------- | ------- | ---- | -------------------------- | 342| callback | AsyncCallback<Array<string>> | Yes | Callback invoked to return the URIs of the documents selected.| 343 344**Example** 345 346```ts 347async function example() { 348 try { 349 let documentPicker = new picker.DocumentViewPicker(); 350 documentPicker.select((err, DocumentSelectResult) => { 351 if (err) { 352 console.error('DocumentViewPicker.select failed with err: ' + err); 353 return; 354 } 355 console.info('DocumentViewPicker.select successfully, DocumentSelectResult uri: ' + JSON.stringify(DocumentSelectResult)); 356 }); 357 } catch (err) { 358 console.error('DocumentViewPicker failed with err: ' + err); 359 } 360} 361``` 362 363 364### save 365 366save(option?: DocumentSaveOptions) : Promise<Array<string>> 367 368Saves one or more documents in a **documentPicker** page. This API uses a promise to return the result. You can pass in **DocumentSaveOptions** to specify the file names to save. 369 370**System capability**: SystemCapability.FileManagement.UserFileService 371 372**Parameters** 373 374| Name | Type | Mandatory| Description | 375| ------- | ------- | ---- | -------------------------- | 376| option | [DocumentSaveOptions](#documentsaveoptions) | No | Options for saving the documents. If this parameter is not specified, a **documentPicker** page will be displayed for the user to enter the names of the documents to save.| 377 378**Return value** 379 380| Type | Description | 381| ----------------------------- | :---- | 382| Promise<Array<string>> | Promise used to return the URIs of the documents saved.| 383 384**Example** 385 386```ts 387async function example() { 388 try { 389 let DocumentSaveOptions = new picker.DocumentSaveOptions(); 390 DocumentSaveOptions.newFileNames = ['DocumentViewPicker01.txt']; 391 let documentPicker = new picker.DocumentViewPicker(); 392 documentPicker.save(DocumentSaveOptions).then((DocumentSaveResult) => { 393 console.info('DocumentViewPicker.save successfully, DocumentSaveResult uri: ' + JSON.stringify(DocumentSaveResult)); 394 }).catch((err) => { 395 console.error('DocumentViewPicker.save failed with err: ' + err); 396 }); 397 } catch (err) { 398 console.error('DocumentViewPicker failed with err: ' + err); 399 } 400} 401``` 402 403### save 404 405save(option: DocumentSaveOptions, callback: AsyncCallback<Array<string>>) : void 406 407Saves one or more documents in a **documentPicker** page. This API uses an asynchronous callback to return the result. You can pass in **DocumentSaveOptions** to specify the file names to save. 408 409**System capability**: SystemCapability.FileManagement.UserFileService 410 411**Parameters** 412 413| Name | Type | Mandatory| Description | 414| ------- | ------- | ---- | -------------------------- | 415| option | [DocumentSaveOptions](#documentsaveoptions) | Yes | Options for saving the documents.| 416| callback | AsyncCallback<Array<string>> | Yes | Callback invoked to return the URIs of the documents saved.| 417 418**Example** 419 420```ts 421async function example() { 422 try { 423 let DocumentSaveOptions = new picker.DocumentSaveOptions(); 424 DocumentSaveOptions.newFileNames = ['DocumentViewPicker02.txt']; 425 let documentPicker = new picker.DocumentViewPicker(); 426 documentPicker.save(DocumentSaveOptions, (err, DocumentSaveResult) => { 427 if (err) { 428 console.error('DocumentViewPicker.save failed with err: ' + err); 429 return; 430 } 431 console.info('DocumentViewPicker.save successfully, DocumentSaveResult uri: ' + JSON.stringify(DocumentSaveResult)); 432 }); 433 } catch (err) { 434 console.error('DocumentViewPicker failed with err: ' + err); 435 } 436} 437``` 438 439### save 440 441save(callback: AsyncCallback<Array<string>>) : void 442 443Saves one or more documents in a **documentPicker** page. This API uses an asynchronous callback to return the result. 444 445**System capability**: SystemCapability.FileManagement.UserFileService 446 447**Parameters** 448 449| Name | Type | Mandatory| Description | 450| ------- | ------- | ---- | -------------------------- | 451| callback | AsyncCallback<Array<string>> | Yes | Callback invoked to return the URIs of the documents saved.| 452 453**Example** 454 455```ts 456async function example() { 457 try { 458 let documentPicker = new picker.DocumentViewPicker(); 459 documentPicker.save((err, DocumentSaveResult) => { 460 if (err) { 461 console.error('DocumentViewPicker.save failed with err: ' + err); 462 return; 463 } 464 console.info('DocumentViewPicker.save successfully, DocumentSaveResult uri: ' + JSON.stringify(DocumentSaveResult)); 465 }); 466 } catch (err) { 467 console.error('DocumentViewPicker failed with err: ' + err); 468 } 469} 470``` 471 472## AudioViewPicker 473 474Provides APIs for selecting and saving audio files. Before using the APIs of **AudioViewPicker**, you need to create an **AudioViewPicker** instance. 475 476**System capability**: SystemCapability.FileManagement.UserFileService 477 478**Example** 479 480```ts 481let audioPicker = new picker.AudioViewPicker(); 482``` 483 484### select 485 486select(option?: AudioSelectOptions) : Promise<Array<string>> 487 488Selects one or more audio files in an **audioPicker** page (currently, a **documentPicker** page is displayed). This API uses a promise to return the result. You can pass in **AudioSelectOptions**. 489 490**System capability**: SystemCapability.FileManagement.UserFileService 491 492**Parameters** 493 494| Name | Type | Mandatory| Description | 495| ------- | ------- | ---- | -------------------------- | 496| option | [AudioSelectOptions](#audioselectoptions) | No | Options for selecting the audio files. If this parameter is not specified, the **audioPicker** page is displayed by default. | 497 498**Return value** 499 500| Type | Description | 501| ----------------------------- | :---- | 502| Promise<Array<string>> | Promise used to return the URIs of the audio files selected.| 503 504**Example** 505 506```ts 507async function example() { 508 try { 509 let AudioSelectOptions = new picker.AudioSelectOptions(); 510 let audioPicker = new picker.AudioViewPicker(); 511 audioPicker.select(AudioSelectOptions).then((AudioSelectResult) => { 512 console.info('AudioViewPicker.select successfully, AudioSelectResult uri: ' + JSON.stringify(AudioSelectResult)); 513 }).catch((err) => { 514 console.error('AudioViewPicker.select failed with err: ' + err); 515 }); 516 } catch (err) { 517 console.error('AudioViewPicker failed with err: ' + err); 518 } 519} 520``` 521 522### select 523 524select(option: AudioSelectOptions, callback: AsyncCallback<Array<string>>) : void 525 526Selects one or more audio files in an **audioPicker** page (currently, a **documentPicker** page is displayed). This API uses an asynchronous callback to return the result. You can pass in **AudioSelectOptions**. 527 528**System capability**: SystemCapability.FileManagement.UserFileService 529 530**Parameters** 531 532| Name | Type | Mandatory| Description | 533| ------- | ------- | ---- | -------------------------- | 534| option | [AudioSelectOptions](#audioselectoptions) | Yes | Options for selecting audio files.| 535| callback | AsyncCallback<Array<string>> | Yes | Callback invoked to return the URIs of the audio files selected.| 536 537**Example** 538 539```ts 540async function example() { 541 try { 542 let AudioSelectOptions = new picker.AudioSelectOptions(); 543 let audioPicker = new picker.AudioViewPicker(); 544 audioPicker.select(AudioSelectOptions, (err, AudioSelectResult) => { 545 if (err) { 546 console.error('AudioViewPicker.select failed with err: ' + err); 547 return; 548 } 549 console.info('AudioViewPicker.select successfully, AudioSelectResult uri: ' + JSON.stringify(AudioSelectResult)); 550 }); 551 } catch (err) { 552 console.error('AudioViewPicker failed with err: ' + err); 553 } 554} 555``` 556 557### select 558 559select(callback: AsyncCallback<Array<string>>) : void 560 561Selects one or more audio files in an **audioPicker** page (currently, a **documentPicker** page is displayed). This API uses an asynchronous callback to return the result. 562 563**System capability**: SystemCapability.FileManagement.UserFileService 564 565**Parameters** 566 567| Name | Type | Mandatory| Description | 568| ------- | ------- | ---- | -------------------------- | 569| callback | AsyncCallback<Array<string>> | Yes | Callback invoked to return the URIs of the audio files selected.| 570 571**Example** 572 573```ts 574async function example() { 575 try { 576 let audioPicker = new picker.AudioViewPicker(); 577 audioPicker.select((err, AudioSelectResult) => { 578 if (err) { 579 console.error('AudioViewPicker.select failed with err: ' + err); 580 return; 581 } 582 console.info('AudioViewPicker.select successfully, AudioSelectResult uri: ' + JSON.stringify(AudioSelectResult)); 583 }); 584 } catch (err) { 585 console.error('AudioViewPicker failed with err: ' + err); 586 } 587} 588``` 589 590### save 591 592save(option?: AudioSaveOptions) : Promise<Array<string>> 593 594Saves one or more audio files in an **audioPicker** page (currently, a **documentPicker** page is displayed). This API uses a promise to return the result. You can pass in **AudioSaveOptions** to specify the names of the audio files to save. 595 596**System capability**: SystemCapability.FileManagement.UserFileService 597 598**Parameters** 599 600| Name | Type | Mandatory| Description | 601| ------- | ------- | ---- | -------------------------- | 602| option | [AudioSaveOptions](#audiosaveoptions) | No | Options for saving audio files. If this parameter is not specified, an **audioPicker** page will be displayed for the user to enter the names of the files to save.| 603 604**Return value** 605 606| Type | Description | 607| ----------------------------- | ---- | 608| Promise<Array<string>> | Promise used to return the URIs of the audio files saved.| 609 610**Example** 611 612```ts 613async function example() { 614 try { 615 let AudioSaveOptions = new picker.AudioSaveOptions(); 616 AudioSaveOptions.newFileNames = ['AudioViewPicker01.mp3']; 617 let audioPicker = new picker.AudioViewPicker(); 618 audioPicker.save(AudioSaveOptions).then((AudioSaveResult) => { 619 console.info('AudioViewPicker.save successfully, AudioSaveResult uri: ' + JSON.stringify(AudioSaveResult)) 620 }).catch((err) => { 621 console.error('AudioViewPicker.save failed with err: ' + err); 622 }); 623 } catch (err) { 624 console.error('AudioViewPicker failed with err: ' + err); 625 } 626} 627``` 628 629### save 630 631save(option: AudioSaveOptions, callback: AsyncCallback<Array<string>>) : void 632 633Saves one or more audio files in an **audioPicker** page (currently, a **documentPicker** page is displayed). This API uses an asynchronous callback to return the result. You can pass in **AudioSaveOptions** to specify the names of the audio files to save. 634 635**System capability**: SystemCapability.FileManagement.UserFileService 636 637**Parameters** 638 639| Name | Type | Mandatory| Description | 640| ------- | ------- | ---- | -------------------------- | 641| option | [AudioSaveOptions](#audiosaveoptions) | Yes | Options for saving audio files.| 642| callback | AsyncCallback<Array<string>> | Yes | Callback invoked to return the URIs of the audio files saved.| 643 644**Example** 645 646```ts 647async function example() { 648 try { 649 let AudioSaveOptions = new picker.AudioSaveOptions(); 650 AudioSaveOptions.newFileNames = ['AudioViewPicker02.mp3']; 651 let audioPicker = new picker.AudioViewPicker(); 652 audioPicker.save(AudioSaveOptions, (err, AudioSaveResult) => { 653 if (err) { 654 console.error('AudioViewPicker.save failed with err: ' + err); 655 return; 656 } 657 console.info('AudioViewPicker.save successfully, AudioSaveResult uri: ' + JSON.stringify(AudioSaveResult)); 658 }); 659 } catch (err) { 660 console.error('AudioViewPicker failed with err: ' + err); 661 } 662} 663``` 664 665### save 666 667save(callback: AsyncCallback<Array<string>>) : void 668 669Saves one or more audio files in an **audioPicker** page (currently, a **documentPicker** page is displayed). This API uses an asynchronous callback to return the result. 670 671**System capability**: SystemCapability.FileManagement.UserFileService 672 673**Parameters** 674 675| Name | Type | Mandatory| Description | 676| ------- | ------- | ---- | -------------------------- | 677| callback | AsyncCallback<Array<string>> | Yes | Callback invoked to return the URIs of the audio files saved.| 678 679**Example** 680 681```ts 682async function example() { 683 try { 684 let audioPicker = new picker.AudioViewPicker(); 685 audioPicker.save((err, AudioSaveResult) => { 686 if (err) { 687 console.error('AudioViewPicker.save failed with err: ' + err); 688 return; 689 } 690 console.info('AudioViewPicker.save successfully, AudioSaveResult uri: ' + JSON.stringify(AudioSaveResult)); 691 }); 692 } catch (err) { 693 console.error('AudioViewPicker failed with err: ' + err); 694 } 695} 696``` 697 698## PhotoViewMIMETypes 699 700Enumerates the media file types that can be selected. 701 702**System capability**: SystemCapability.FileManagement.UserFileService 703 704| Name | Value| Description| 705| ----- | ---- | ---- | 706| IMAGE_TYPE | 'image/*' | Image.| 707| VIDEO_TYPE | 'video/*' | Video.| 708| IMAGE_VIDEO_TYPE | '\*/*' | Image and video.| 709 710## PhotoSelectOptions 711 712Defines the options for selecting images or videos. 713 714**System capability**: SystemCapability.FileManagement.UserFileService 715 716| Name | Type | Mandatory| Description | 717| ----------------------- | ------------------- | ---- | -------------------------------- | 718| MIMEType? | [PhotoViewMIMETypes](#photoviewmimetypes) | No | Available media file types. **IMAGE_VIDEO_TYPE** is used by default.| 719| maxSelectNumber? | number | No | Maximum number of media files to select. The default value is **50**, and the maximum value is **500**. | 720 721## PhotoSelectResult 722 723Defines information about the images or videos selected. 724 725**System capability**: SystemCapability.FileManagement.UserFileService 726 727| Name | Type | Readable| Writable| Description | 728| ----------------------- | ------------------- | ---- | ---- | ------------------------------ | 729| photoUris | Array<string> | Yes | Yes | URIs of the media files selected.| 730| isOriginalPhoto | boolean | Yes | Yes | Whether the selected media file is the original image.| 731 732## PhotoSaveOptions 733 734Defines the options for saving images or videos. 735 736**System capability**: SystemCapability.FileManagement.UserFileService 737 738| Name | Type | Mandatory| Description | 739| ----------------------- | ------------------- | ---- | ---------------------------- | 740| newFileNames? | Array<string> | No | Names of the files to save. If this parameter is not specified, the user needs to enter the file names.| 741 742## DocumentSelectOptions 743 744Defines the options for selecting documents. Currently, this parameter cannot be configured. 745 746**System capability**: SystemCapability.FileManagement.UserFileService 747 748## DocumentSaveOptions 749 750Defines the options for saving documents. 751 752**System capability**: SystemCapability.FileManagement.UserFileService 753 754| Name | Type | Mandatory| Description | 755| ----------------------- | ------------------- | ---- | ---------------------------- | 756| newFileNames? | Array<string> | No | Names of the documents to save. If this parameter is not specified, the user needs to enter the document names. | 757 758## AudioSelectOptions 759 760Defines the options for selecting audio files. Currently, this parameter cannot be configured. 761 762**System capability**: SystemCapability.FileManagement.UserFileService 763 764## AudioSaveOptions 765 766Defines the options for saving audio files. 767 768**System capability**: SystemCapability.FileManagement.UserFileService 769 770| Name | Type | Mandatory| Description | 771| ----------------------- | ------------------- | ---- | ---------------------------- | 772| newFileNames? | Array<string> | No | Name of the audio files to save. If this parameter is not specified, the user needs to enter the file names.| 773