# File Management Subsystem Changelog ## cl.file.1 mediaLibrary APIs Changed The **MediaLibrary** class of the multimedia component is replaced by the **FilePicker** class. **Change Impact** For applications developed based on earlier versions, pay attention to the changes of APIs. **FilePicker** is a system application preset in OpenHarmony. You can use it to select and save files. **Key API/Component Changes** The APIs of **MediaLibrary**, located in **@ohos.multimedia.medialibrary**, are deprecated. The **FilePicker** class, located in [@ohos.file.picker](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/@ohos.file.picker.d.ts) is used. | Module | Method/Attribute/Enum/Constant | Change Type| | ------------------------- | ------------------------------------------------------------ | -------- | | medialibrary | **function** getMediaLibrary(): MediaLibrary; | Deprecated | | medialibrary | **function** getMediaLibrary(context: Context): MediaLibrary; | Deprecated | | medialibrary | **function** getFileAssets(options: MediaFetchOptions, callback: AsyncCallback\): void | Deprecated | | medialibrary | **function** getFileAssets(options: MediaFetchOptions): Promise\ | Deprecated | | medialibrary | **function** on(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback: Callback\): void | Deprecated | | medialibrary | **function** off(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback?: Callback\): void | Deprecated | | medialibrary | **function** createAsset(mediaType: MediaType, displayName: string, relativePath: string, callback: AsyncCallback\): void | Deprecated | | medialibrary | **function** createAsset(mediaType: MediaType, displayName: string, relativePath: string): Promise\ | Deprecated | | medialibrary | **function** deleteAsset(uri: string): Promise\ | Deprecated | | medialibrary | **function** deleteAsset(uri: string, callback: AsyncCallback\): void | Deprecated | | medialibrary | **function** getPublicDirectory(type: DirectoryType, callback: AsyncCallback\): void | Deprecated | | medialibrary | **function** getPublicDirectory(type: DirectoryType): Promise\ | Deprecated | | medialibrary | **function** getAlbums(options: MediaFetchOptions, callback: AsyncCallback\\>): void | Deprecated | | medialibrary | **function** getAlbums(options: MediaFetchOptions): Promise\\> | Deprecated | | medialibrary | **function** release(callback: AsyncCallback\): void | Deprecated | | medialibrary | **function** release(): Promise\ | Deprecated | | medialibrary | **function** storeMediaAsset(option: MediaAssetOption, callback: AsyncCallback\): void | Deprecated | | medialibrary | **function** storeMediaAsset(option: MediaAssetOption): Promise\ | Deprecated | | medialibrary | **function** startImagePreview(images: Array\, index: number, callback: AsyncCallback\): void | Deprecated | | medialibrary | **function** startImagePreview(images: Array\, callback: AsyncCallback\): void | Deprecated | | medialibrary | **function** startImagePreview(images: Array\, index?: number): Promise\ | Deprecated | | medialibrary | **function** startMediaSelect(option: MediaSelectOption, callback: AsyncCallback\\>): void | Deprecated | | medialibrary | **function** startMediaSelect(option: MediaSelectOption): Promise\\> | Deprecated | | medialibrary | **function** getActivePeers(): Promise\\>; | Deprecated | | medialibrary | **function** getActivePeers(callback: AsyncCallback\\>): void; | Deprecated | | medialibrary | **function** getAllPeers(): Promise\\>; | Deprecated | | medialibrary | **function** FileAsset.isDirectory(callback: AsyncCallback\): void | Deprecated | | medialibrary | **function** FileAsset.isDirectory():Promise\ | Deprecated | | medialibrary | **function** FileAsset.commitModify(callback: AsyncCallback\): void | Deprecated | | medialibrary | **function** FileAsset.commitModify(): Promise\ | Deprecated | | medialibrary | **function** FileAsset.open(mode: string, callback: AsyncCallback\): void | Deprecated | | medialibrary | **function** FileAsset.open(mode: string): Promise\ | Deprecated | | medialibrary | **function** FileAsset.close(fd: number, callback: AsyncCallback\): void | Deprecated | | medialibrary | **function** FileAsset.close(fd: number): Promise\ | Deprecated | | medialibrary | **function** FileAsset.getThumbnail(callback: AsyncCallback\): void | Deprecated | | medialibrary | **function** FileAsset.getThumbnail(size: Size, callback: AsyncCallback\): void | Deprecated | | medialibrary | **function** FileAsset.getThumbnail(size?: Size): Promise\ | Deprecated | | medialibrary | **function** FileAsset.favorite(isFavorite: boolean, callback: AsyncCallback\): void | Deprecated | | medialibrary | **function** FileAsset.favorite(isFavorite: boolean): Promise\ | Deprecated | | medialibrary | **function** FileAsset.isFavorite(callback: AsyncCallback\): void | Deprecated | | medialibrary | **function** FileAsset.isFavorite():Promise\ | Deprecated | | medialibrary | **function** FileAsset.trash(isTrash: boolean, callback: AsyncCallback\): void | Deprecated | | medialibrary | **function** FileAsset.trash(isTrash: boolean): Promise\ | Deprecated | | medialibrary | **function** FileAsset.isTrash(callback: AsyncCallback\): void | Deprecated | | medialibrary | **function** FileAsset.isTrash():Promise\ | Deprecated | | medialibrary | **function** FetchFileResult.getCount(): number | Deprecated | | medialibrary | **function** FetchFileResult.isAfterLast(): boolean | Deprecated | | medialibrary | **function** FetchFileResult.close(): void | Deprecated | | medialibrary | **function** FetchFileResult.getFirstObject(callback: AsyncCallback\): void | Deprecated | | medialibrary | **function** FetchFileResult.getFirstObject(): Promise\ | Deprecated | | medialibrary | **function** FetchFileResult.getNextObject(callback: AsyncCallback\): void | Deprecated | | medialibrary | **function** FetchFileResult.getNextObject(): Promise\ | Deprecated | | medialibrary | **function** FetchFileResult.getLastObject(callback: AsyncCallback\): void | Deprecated | | medialibrary | **function** FetchFileResult.getLastObject(): Promise\ | Deprecated | | medialibrary | **function** FetchFileResult.getPositionObject(index: number, callback: AsyncCallback\): void | Deprecated | | medialibrary | **function** FetchFileResult.getPositionObject(index: number): Promise\ | Deprecated | | medialibrary | **function** FetchFileResult.getAllObject(callback: AsyncCallback\\>): void | Deprecated | | medialibrary | **function** FetchFileResult.getAllObject(): Promise\\> | Deprecated | | medialibrary | **function** Album.commitModify(callback: AsyncCallback\): void | Deprecated | | medialibrary | **function** Album.commitModify(): Promise\ | Deprecated | | medialibrary | **function** Album.getFileAssets(options: MediaFetchOptions, callback: AsyncCallback\): void | Deprecated | | medialibrary | **function** Album.getFileAssets(options?: MediaFetchOptions): Promise\ | Deprecated | | medialibrary | **enum** DeviceType | Deprecated | | medialibrary | **enum** FileKey | Deprecated | | medialibrary | **enum** DirectoryType | Deprecated | | medialibrary | **enum** MediaType | Deprecated | | medialibrary | **interface** PeerInfo | Deprecated | | medialibrary | **interface** Size | Deprecated | | medialibrary | **interface** MediaFetchOptions | Deprecated | | medialibrary | **interface** MediaAssetOption | Deprecated | | medialibrary | **interface** MediaSelectOption | Deprecated | | medialibrary | **interface** FileAsset | Deprecated | **Adaptation Guide** For example, refer to the code snippet below to call an API to select an image: ```js import picker from '@ohos.file.picker'; async function example() { try { let PhotoSelectOptions = new picker.PhotoSelectOptions(); PhotoSelectOptions.MIMEType = picker.PhotoViewMIMETypes.IMAGE_TYPE; PhotoSelectOptions.maxSelectNumber = 1; let photoPicker = new picker.PhotoViewPicker(); photoPicker.select(PhotoSelectOptions).then((PhotoSelectResult) => { if (PhotoSelectResult !== undefined) { console.info("PhotoViewPicker.select pass, PhotoSelectResult uri: " + JSON.stringify(PhotoSelectResult)); } else { console.error("PhotoViewPicker.select PhotoSelectResult is undefined"); } }).catch((err) => { console.error("PhotoViewPicker.select fail, err: " + err); }); } catch (err) { console.error("PhotoViewPicker fail, err: " + err); } } ```