1# JS API Changes of the File Management Subsystem 2 3The table below lists the APIs changes of the file management subsystem in OpenHarmony 3.2 Beta3 over OpenHarmony 3.2 Beta2. 4 5## API Changes 6 7| Module| Class| Method/Attribute/Enumeration/Constant| Change Type| 8|---|---|---|---| 9| ohos.data.fileAccess | FileAccessHelper | getRoots(): Promise\<RootIterator>;<br>getRoots(callback:AsyncCallback\<RootIterator>) : void; | Added| 10| ohos.data.fileAccess | FileAccessHelper | access(sourceFileUri: string) : Promise\<boolean>;<br>access(sourceFileUri: string, callback: AsyncCallback\<boolean>) : void; | Added| 11| ohos.data.fileAccess | FileAccessHelper | rename(uri: string, displayName: string) : Promise\<string>;<br>rename(uri: string, displayName: string, callback: AsyncCallback\<string>) : void; | Added| 12| ohos.data.fileAccess | FileAccessHelper | move(sourceFile: string, destFile: string) : Promise\<string>;<br>move(sourceFile: string, destFile: string, callback: AsyncCallback\<string>) : void; | Added| 13| ohos.data.fileAccess | FileAccessHelper | delete(uri: string) : Promise\<number>;<br>delete(uri: string, callback: AsyncCallback\<number>) : void; | Added| 14| ohos.data.fileAccess | FileAccessHelper | mkDir(parentUri: string, displayName: string) : Promise\<string>;<br>mkDir(parentUri: string, displayName: string, callback: AsyncCallback\<string>) : void; | Added| 15| ohos.data.fileAccess | FileAccessHelper | createFile(uri: string, displayName: string) : Promise\<string>;<br>createFile(uri: string, displayName: string, callback: AsyncCallback\<string>) : void; | Added| 16| ohos.data.fileAccess | FileAccessHelper | openFile(uri: string, flags: OPENFLAGS) : Promise\<number>;<br>openFile(uri: string, flags: OPENFLAGS, callback: AsyncCallback\<number>) : void; | Added| 17| ohos.data.fileAccess | OPENFLAGS | WRITE_READ = 0o2 | Added| 18| ohos.data.fileAccess | OPENFLAGS | WRITE = 0o1 | Added| 19| ohos.data.fileAccess | OPENFLAGS | READ = 0o0 | Added| 20| ohos.data.fileAccess | RootIterator | next(): {value: RootInfo, done: boolean} | Added| 21| ohos.data.fileAccess | RootInfo | scanFile(filter?: Filter): FileIterator; | Added| 22| ohos.data.fileAccess | RootInfo | listFile(filter?: Filter): FileIterator; | Added| 23| ohos.data.fileAccess | RootInfo | deviceFlags: number; | Added| 24| ohos.data.fileAccess | RootInfo | displayName: string; | Added| 25| ohos.data.fileAccess | RootInfo | uri: string; | Added| 26| ohos.data.fileAccess | RootInfo | deviceType: number; | Added| 27| ohos.data.fileAccess | FileIterator | next(): {value: FileInfo, done: boolean} | Added| 28| ohos.data.fileAccess | FileInfo | scanFile(filter?: Filter): FileIterator; | Added| 29| ohos.data.fileAccess | FileInfo | listFile(filter?: Filter): FileIterator; | Added| 30| ohos.data.fileAccess | FileInfo | mimeType: string; | Added| 31| ohos.data.fileAccess | FileInfo | mtime: number; | Added| 32| ohos.data.fileAccess | FileInfo | size: number; | Added| 33| ohos.data.fileAccess | FileInfo | mode: number; | Added| 34| ohos.data.fileAccess | FileInfo | fileName: string; | Added| 35| ohos.data.fileAccess | FileInfo | uri: string; | Added| 36| ohos.data.fileAccess | fileAccess | createFileAccessHelper(context: Context): FileAccessHelper;<br>createFileAccessHelper(context: Context, wants: Array\<Want>): FileAccessHelper; | Added| 37| ohos.data.fileAccess | fileAccess | getFileAccessAbilityInfo(callback: AsyncCallback\<Array\<Want>>): void;<br>getFileAccessAbilityInfo(): Promise\<Array\<Want>>; | Added| 38| ohos.fileExtensionInfo | DocumentFlag | const SUPPORTS_WRITE = 0b1000; | Added| 39| ohos.fileExtensionInfo | DocumentFlag | const SUPPORTS_READ = 0b100; | Added| 40| ohos.fileExtensionInfo | DocumentFlag | const REPRESENTS_DIR = 0b10; | Added| 41| ohos.fileExtensionInfo | DocumentFlag | const REPRESENTS_FILE = 0b1; | Added| 42| ohos.fileExtensionInfo | DeviceFlag | const SUPPORTS_WRITE = 0b10; | Added| 43| ohos.fileExtensionInfo | DeviceFlag | const SUPPORTS_READ = 0b1; | Added| 44| ohos.fileExtensionInfo | DeviceType | DEVICE_EXTERNAL_CLOUD | Added| 45| ohos.fileExtensionInfo | DeviceType | DEVICE_EXTERNAL_USB | Added| 46| ohos.fileExtensionInfo | DeviceType | DEVICE_EXTERNAL_MTP | Added| 47| ohos.fileExtensionInfo | DeviceType | DEVICE_NETWORK_NEIGHBORHOODS | Added| 48| ohos.fileExtensionInfo | DeviceType | DEVICE_SHARED_TERMINAL | Added| 49| ohos.fileExtensionInfo | DeviceType | DEVICE_SHARED_DISK | Added| 50| ohos.fileExtensionInfo | DeviceType | DEVICE_LOCAL_DISK = 1 | Added| 51| ohos.filemanagement.userfile_manager | VirtualAlbum | getFileAssets(type: Array\<MediaType>, options: MediaFetchOptions, callback: AsyncCallback\<FetchFileResult>): void;<br>getFileAssets(type: Array\<MediaType>, options: MediaFetchOptions): Promise\<FetchFileResult>; | Added| 52| ohos.filemanagement.userfile_manager | VirtualAlbumType | TYPE_TRASH | Added| 53| ohos.filemanagement.userfile_manager | VirtualAlbumType | TYPE_FAVORITE | Added| 54| ohos.filemanagement.userfile_manager | PeerInfo | readonly isOnline: boolean; | Added| 55| ohos.filemanagement.userfile_manager | PeerInfo | readonly networkId: string; | Added| 56| ohos.filemanagement.userfile_manager | PeerInfo | readonly deviceName: string; | Added| 57| ohos.filemanagement.userfile_manager | Size | height: number; | Added| 58| ohos.filemanagement.userfile_manager | Size | width: number; | Added| 59| ohos.filemanagement.userfile_manager | UserFileManager | release(callback: AsyncCallback\<void>): void;<br>release(): Promise\<void>; | Added| 60| ohos.filemanagement.userfile_manager | UserFileManager | getAllPeers(callback: AsyncCallback\<Array\<PeerInfo>>): void;<br>getAllPeers(): Promise\<Array\<PeerInfo>>; | Added| 61| ohos.filemanagement.userfile_manager | UserFileManager | getActivePeers(callback: AsyncCallback\<Array\<PeerInfo>>): void;<br>getActivePeers(): Promise\<Array\<PeerInfo>>; | Added| 62| ohos.filemanagement.userfile_manager | UserFileManager | getPrivateAlbum(type: VirtualAlbumType, callback: AsyncCallback\<Array\<VirtualAlbum>>): void;<br>getPrivateAlbum(type: VirtualAlbumType): Promise\<Array\<VirtualAlbum>>; | Added| 63| ohos.filemanagement.userfile_manager | UserFileManager | getAlbums(type: Array\<MediaType>, options: MediaFetchOptions, callback: AsyncCallback\<Array\<Album>>): void;<br>getAlbums(type: Array\<MediaType>, options: MediaFetchOptions): Promise\<Array\<Album>>; | Added| 64| ohos.filemanagement.userfile_manager | UserFileManager | deleteAsset(uri: string, callback: AsyncCallback\<void>): void;<br>deleteAsset(uri: string): Promise\<void>; | Added| 65| ohos.filemanagement.userfile_manager | UserFileManager | createAsset(mediaType: MediaType, displayName: string, relativePath: string, callback: AsyncCallback\<FileAsset>): void;<br>createAsset(mediaType: MediaType, displayName: string, relativePath: string): Promise\<FileAsset>; | Added| 66| ohos.filemanagement.userfile_manager | UserFileManager | off(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback?: Callback\<void>): void; | Added| 67| ohos.filemanagement.userfile_manager | UserFileManager | off(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback?: Callback\<void>): void; | Added| 68| ohos.filemanagement.userfile_manager | UserFileManager | off(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback?: Callback\<void>): void; | Added| 69| ohos.filemanagement.userfile_manager | UserFileManager | off(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback?: Callback\<void>): void; | Added| 70| ohos.filemanagement.userfile_manager | UserFileManager | off(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback?: Callback\<void>): void; | Added| 71| ohos.filemanagement.userfile_manager | UserFileManager | off(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback?: Callback\<void>): void; | Added| 72| ohos.filemanagement.userfile_manager | UserFileManager | off(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback?: Callback\<void>): void; | Added| 73| ohos.filemanagement.userfile_manager | UserFileManager | on(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback: Callback\<void>): void; | Added| 74| ohos.filemanagement.userfile_manager | UserFileManager | on(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback: Callback\<void>): void; | Added| 75| ohos.filemanagement.userfile_manager | UserFileManager | on(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback: Callback\<void>): void; | Added| 76| ohos.filemanagement.userfile_manager | UserFileManager | on(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback: Callback\<void>): void; | Added| 77| ohos.filemanagement.userfile_manager | UserFileManager | on(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback: Callback\<void>): void; | Added| 78| ohos.filemanagement.userfile_manager | UserFileManager | on(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback: Callback\<void>): void; | Added| 79| ohos.filemanagement.userfile_manager | UserFileManager | on(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback: Callback\<void>): void; | Added| 80| ohos.filemanagement.userfile_manager | UserFileManager | getFileAssets(type: Array\<MediaType>, options: MediaFetchOptions, callback: AsyncCallback\<FetchFileResult>): void;<br>getFileAssets(type: Array\<MediaType>, options: MediaFetchOptions): Promise\<FetchFileResult>; | Added| 81| ohos.filemanagement.userfile_manager | UserFileManager | getPublicDirectory(type: DirectoryType, callback: AsyncCallback\<string>): void;<br>getPublicDirectory(type: DirectoryType): Promise\<string>; | Added| 82| ohos.filemanagement.userfile_manager | DirectoryType | DIR_DOWNLOAD | Added| 83| ohos.filemanagement.userfile_manager | DirectoryType | DIR_DOCUMENTS | Added| 84| ohos.filemanagement.userfile_manager | DirectoryType | DIR_AUDIO | Added| 85| ohos.filemanagement.userfile_manager | DirectoryType | DIR_IMAGE | Added| 86| ohos.filemanagement.userfile_manager | DirectoryType | DIR_VIDEO | Added| 87| ohos.filemanagement.userfile_manager | DirectoryType | DIR_CAMERA = 0 | Added| 88| ohos.filemanagement.userfile_manager | Album | getFileAssets(type: Array\<MediaType>, callback: AsyncCallback\<FetchFileResult>): void;<br>getFileAssets(type: Array\<MediaType>, options: MediaFetchOptions, callback: AsyncCallback\<FetchFileResult>): void;<br>getFileAssets(type: Array\<MediaType>, options?: MediaFetchOptions): Promise\<FetchFileResult>; | Added| 89| ohos.filemanagement.userfile_manager | Album | commitModify(callback: AsyncCallback\<void>): void;<br>commitModify(): Promise\<void>; | Added| 90| ohos.filemanagement.userfile_manager | Album | readonly coverUri: string; | Added| 91| ohos.filemanagement.userfile_manager | Album | readonly relativePath: string; | Added| 92| ohos.filemanagement.userfile_manager | Album | readonly count: number; | Added| 93| ohos.filemanagement.userfile_manager | Album | readonly dateModified: number; | Added| 94| ohos.filemanagement.userfile_manager | Album | readonly albumUri: string; | Added| 95| ohos.filemanagement.userfile_manager | Album | albumName: string; | Added| 96| ohos.filemanagement.userfile_manager | FetchFileResult | getPositionObject(index: number, callback: AsyncCallback\<FileAsset>): void;<br>getPositionObject(index: number): Promise\<FileAsset>; | Added| 97| ohos.filemanagement.userfile_manager | FetchFileResult | getLastObject(callback: AsyncCallback\<FileAsset>): void;<br>getLastObject(): Promise\<FileAsset>; | Added| 98| ohos.filemanagement.userfile_manager | FetchFileResult | getNextObject(callback: AsyncCallback\<FileAsset>): void;<br>getNextObject(): Promise\<FileAsset>; | Added| 99| ohos.filemanagement.userfile_manager | FetchFileResult | getFirstObject(callback: AsyncCallback\<FileAsset>): void;<br>getFirstObject(): Promise\<FileAsset>; | Added| 100| ohos.filemanagement.userfile_manager | FetchFileResult | close(): void; | Added| 101| ohos.filemanagement.userfile_manager | FetchFileResult | isAfterLast(): boolean; | Added| 102| ohos.filemanagement.userfile_manager | FetchFileResult | getCount(): number; | Added| 103| ohos.filemanagement.userfile_manager | MediaFetchOptions | selectionArgs: Array\<string>; | Added| 104| ohos.filemanagement.userfile_manager | MediaFetchOptions | selections: string; | Added| 105| ohos.filemanagement.userfile_manager | AlbumKey | DATE_MODIFIED = "date_modified" | Added| 106| ohos.filemanagement.userfile_manager | AlbumKey | DATE_ADDED = "date_added" | Added| 107| ohos.filemanagement.userfile_manager | AlbumKey | DISPLAY_NAME = "display_name" | Added| 108| ohos.filemanagement.userfile_manager | AlbumKey | RELATIVE_PATH = "relative_path" | Added| 109| ohos.filemanagement.userfile_manager | AlbumKey | URI = "uri" | Added| 110| ohos.filemanagement.userfile_manager | ImageVideoKey | DATE_TAKEN = "date_taken" | Added| 111| ohos.filemanagement.userfile_manager | ImageVideoKey | HEIGHT = "height" | Added| 112| ohos.filemanagement.userfile_manager | ImageVideoKey | WIDTH = "width" | Added| 113| ohos.filemanagement.userfile_manager | ImageVideoKey | DURATION = "duration" | Added| 114| ohos.filemanagement.userfile_manager | ImageVideoKey | TITLE = "title" | Added| 115| ohos.filemanagement.userfile_manager | ImageVideoKey | DATE_MODIFIED = "date_modified" | Added| 116| ohos.filemanagement.userfile_manager | ImageVideoKey | DATE_ADDED = "date_added" | Added| 117| ohos.filemanagement.userfile_manager | ImageVideoKey | DISPLAY_NAME = "display_name" | Added| 118| ohos.filemanagement.userfile_manager | ImageVideoKey | RELATIVE_PATH = "relative_path" | Added| 119| ohos.filemanagement.userfile_manager | ImageVideoKey | URI = "uri" | Added| 120| ohos.filemanagement.userfile_manager | AudioKey | DURATION = "duration" | Added| 121| ohos.filemanagement.userfile_manager | AudioKey | AUDIOALBUM = "audio_album" | Added| 122| ohos.filemanagement.userfile_manager | AudioKey | ARTIST = "artist" | Added| 123| ohos.filemanagement.userfile_manager | AudioKey | TITLE = "title" | Added| 124| ohos.filemanagement.userfile_manager | AudioKey | DATE_MODIFIED = "date_modified" | Added| 125| ohos.filemanagement.userfile_manager | AudioKey | DATE_ADDED = "date_added" | Added| 126| ohos.filemanagement.userfile_manager | AudioKey | DISPLAY_NAME = "display_name" | Added| 127| ohos.filemanagement.userfile_manager | AudioKey | RELATIVE_PATH = "relative_path" | Added| 128| ohos.filemanagement.userfile_manager | AudioKey | URI = "uri" | Added| 129| ohos.filemanagement.userfile_manager | FileKey | TITLE = "title" | Added| 130| ohos.filemanagement.userfile_manager | FileKey | DATE_MODIFIED = "date_modified" | Added| 131| ohos.filemanagement.userfile_manager | FileKey | DATE_ADDED = "date_added" | Added| 132| ohos.filemanagement.userfile_manager | FileKey | DISPLAY_NAME = "display_name" | Added| 133| ohos.filemanagement.userfile_manager | FileKey | RELATIVE_PATH = "relative_path" | Added| 134| ohos.filemanagement.userfile_manager | FileKey | URI = "uri" | Added| 135| ohos.filemanagement.userfile_manager | FileAsset | isTrash(callback: AsyncCallback\<boolean>): void;<br>isTrash():Promise\<boolean>; | Added| 136| ohos.filemanagement.userfile_manager | FileAsset | trash(isTrash: boolean, callback: AsyncCallback\<void>): void;<br>trash(isTrash: boolean): Promise\<void>; | Added| 137| ohos.filemanagement.userfile_manager | FileAsset | isFavorite(callback: AsyncCallback\<boolean>): void;<br>isFavorite():Promise\<boolean>; | Added| 138| ohos.filemanagement.userfile_manager | FileAsset | favorite(isFavorite: boolean, callback: AsyncCallback\<void>): void;<br>favorite(isFavorite: boolean): Promise\<void>; | Added| 139| ohos.filemanagement.userfile_manager | FileAsset | getThumbnail(callback: AsyncCallback\<image.PixelMap>): void;<br>getThumbnail(size: Size, callback: AsyncCallback\<image.PixelMap>): void;<br>getThumbnail(size?: Size): Promise\<image.PixelMap>; | Added| 140| ohos.filemanagement.userfile_manager | FileAsset | close(fd: number, callback: AsyncCallback\<void>): void;<br>close(fd: number): Promise\<void>; | Added| 141| ohos.filemanagement.userfile_manager | FileAsset | open(mode: string, callback: AsyncCallback\<number>): void;<br>open(mode: string): Promise\<number>; | Added| 142| ohos.filemanagement.userfile_manager | FileAsset | commitModify(callback: AsyncCallback\<void>): void;<br>commitModify(): Promise\<void>; | Added| 143| ohos.filemanagement.userfile_manager | FileAsset | isDirectory(callback: AsyncCallback\<boolean>): void;<br>isDirectory():Promise\<boolean>; | Added| 144| ohos.filemanagement.userfile_manager | FileAsset | displayName: string; | Added| 145| ohos.filemanagement.userfile_manager | FileAsset | readonly mediaType: MediaType; | Added| 146| ohos.filemanagement.userfile_manager | FileAsset | readonly uri: string; | Added| 147| ohos.filemanagement.userfile_manager | MediaType | AUDIO | Added| 148| ohos.filemanagement.userfile_manager | MediaType | VIDEO | Added| 149| ohos.filemanagement.userfile_manager | MediaType | IMAGE | Added| 150| ohos.filemanagement.userfile_manager | MediaType | FILE = 0 | Added| 151| ohos.filemanagement.userfile_manager | userfile_manager | getUserFileMgr(): UserFileManager;<br>getUserFileMgr(context: Context): UserFileManager; | Added| 152| ohos.document | document | show(uri: string, type: string): Promise\<void>;<br>show(uri: string, type: string, callback: AsyncCallback\<void>): void; | Deprecated| 153| ohos.document | document | choose(types?: string[]): Promise\<string>;<br>choose(callback: AsyncCallback\<string>): void;<br>choose(types: string[], callback: AsyncCallback\<string>): void; | Deprecated| 154