diff --git a/en/release-notes/changelogs/v3.2-beta5/changelogs-filemanagement.md b/en/release-notes/changelogs/v3.2-beta5/changelogs-filemanagement.md index 200571e0f28b80358e87bf37d2e41a15c7b46454..d00dca123ceec5e5c29f48813731397a2133afe9 100644 --- a/en/release-notes/changelogs/v3.2-beta5/changelogs-filemanagement.md +++ b/en/release-notes/changelogs/v3.2-beta5/changelogs-filemanagement.md @@ -10,7 +10,7 @@ If your application is developed based on earlier versions, note that the **d.ts **Key API/Component Changes** -Before the change, **environment** was imported from **@ohos.environment**: +Before the change, **environment** is imported from **@ohos.environment**: ```js import environment from '@ohos.environment'; @@ -32,7 +32,7 @@ If your application is developed based on earlier versions, note that the **d.ts **Key API/Component Changes** -Before the change, **securityLabel** was imported from **@ohos.securityLabel**: +Before the change, **securityLabel** is imported from **@ohos.securityLabel**: ```js import securityLabel from '@ohos.securityLabel'; @@ -66,7 +66,7 @@ If your application is developed based on earlier versions, note that the **d.ts **Key API/Component Changes** -Before the change, **fileAccess** was imported from **@ohos.data.fileAccess**: +Before the change, **fileAccess** is imported from **@ohos.data.fileAccess**: ```js import fileAccess from '@ohos.data.fileAccess'; @@ -88,7 +88,7 @@ If your application is developed based on earlier versions, note that the **d.ts **Key API/Component Changes** -Before the change, **fileExtensionInfo** was imported from **@ohos.fileExtensionInfo**: +Before the change, **fileExtensionInfo** is imported from **@ohos.fileExtensionInfo**: ```js import fileExtensionInfo from '@ohos.fileExtensionInfo'; @@ -143,3 +143,47 @@ Now, **volumeManager** is imported from **@ohos.file.volumeManager**: ```js import volumeManager from '@ohos.file.volumeManager'; ``` + +## cl.filemanagement.8 fileio API Changes + +Deprecated the **fileio** APIs, which do not return error codes, and added APIs that return error codes. + +**Change Impact** + +For applications developed based on earlier versions, pay attention to the iterative update of deprecated APIs. The specifications of the new APIs are slightly adjusted. Pay attention to the usage of the new APIs. + +**Key API/Component Changes** + +The APIs of **@ohos.fileio** do not support error code handling and are deprecated. New APIs with minor changes in parameters are added in **@ohos.file.fs** to support unified error code handling specifications. The new APIs function the same as the original APIs. The following table lists the API changes. +The API names remain unchanged. + +| Module | Method/Attribute/Enum/Constant | Change Type| +| ------------------------- | ------------------------------------------------------------ | -------- | +| @ohos.fileio | **function** access(path: string, mode?: number, callback?: AsyncCallback\): void \| Promise\ | Deprecated | +| @ohos.fileio | **function** accessSync(path: string, mode?: number): void | Deprecated | +| @ohos.file.fs | **function** access(path: string, callback?: AsyncCallback\): void \| Promise\ | Added | +| @ohos.file.fs | **function** accessSync(path: string): boolean | Added | +| @ohos.fileio | **function** close(fd: number, callback?: AsyncCallback\): void \| Promise\ | Deprecated | +| @ohos.fileio | **function** closeSync(fd: number): void | Deprecated | +| @ohos.file.fs | **function** close(file: File \| number, callback?: AsyncCallback\): void \| Promise\ | Added | +| @ohos.file.fs | **function** closeSync(file: File \| number): void | Added | +| @ohos.fileio | **function** mkdir(path: string, mode?: number, callback?: AsyncCallback\): void \| Promise\ | Deprecated | +| @ohos.fileio | **function** mkdirSync(path: string, mode?: number): void | Deprecated | +| @ohos.file.fs | **function** mkdir(path: string, callback?: AsyncCallback\): void \| Promise\ | Added | +| @ohos.file.fs | **function** mkdirSync(path: string): void | Added | +| @ohos.fileio | **function** readText(filePath: string, options?: { position?: number; length?: number; encoding?: string; }, callback?: AsyncCallback\): void \| Promise\ | Deprecated | +| @ohos.fileio | **function** readTextSync(filePath: string, options?: { position?: number; length?: number; encoding?: string; }): string | Deprecated | +| @ohos.file.fs | **function** readText(filePath: string, options?: { offset?: number; length?: number; encoding?: string; }, callback?: AsyncCallback\): void \| Promise\ | Added | +| @ohos.file.fs | **function** readTextSync(filePath: string, options?: { offset?: number; length?: number; encoding?: string; }): string | Added | +| @ohos.fileio | **function** Stream.read(buffer: ArrayBuffer, options?: { offset?: number; length?: number; position?: number; }, callback?: AsyncCallback\): void \| Promise\ | Deprecated | +| @ohos.fileio | **function** Stream.readSync(buffer: ArrayBuffer, options?: { offset?: number; length?: number; position?: number; }): number | Deprecated | +| @ohos.file.fs | **function** Stream.read(fd: number, buffer: ArrayBuffer, options?: { offset?: number; length?: number; }, callback?: AsyncCallback\): void \| Promise\ | Added | +| @ohos.file.fs | **function** Stream.readSync(fd: number, buffer: ArrayBuffer, options?: { offset?: number; length?: number; }): number | Added | +| @ohos.fileio | **function** Stream.write(buffer: ArrayBuffer \| string, options?: { offset?: number; length?: number; position?: number; encoding?: string; }, callback?: AsyncCallback\): void \| Promise\ | Deprecated | +| @ohos.fileio | **function** Stream.writeSync(buffer: ArrayBuffer \| string, options?: { offset?: number; length?: number; position?: number; encoding?: string; }): number | Deprecated | +| @ohos.file.fs | **function** Stream.write(buffer: ArrayBuffer \| string, options?: { offset?: number; length?: number; encoding?: string; }, callback?: AsyncCallback\): void \| Promise\ | Added | +| @ohos.file.fs | **function** Stream.writeSync(buffer: ArrayBuffer \| string, options?: { offset?: number; length?: number; encoding?: string; }): number | Added | + +**Adaptation Guide** + +The APIs of @ohos.file.fs support unified exception handling. For details, see [File Management](../../../application-dev/reference/apis/js-apis-file-fs.md).