• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# File Management Subsystem Changelog
2
3## cl.filemanagement.1 environment Module Change
4
5The file management subsystem **d.ts** file has been archived and moved to the **file** directory. The **environment** module supports error code handling.
6
7**Change Impact**
8
9If your application is developed based on earlier versions, note that the **d.ts** file location and the name of the module to be imported are changed. The **environment** module supports error code handling. See [Adaptation Guide](../v3.2-beta4/changelogs-filemanagement.md).
10
11**Key API/Component Changes**
12
13Before the change, **environment** is imported from **@ohos.environment**:
14
15```js
16import environment from '@ohos.environment';
17```
18
19Now, **environment** is imported from **@ohos.file.environment**:
20
21```js
22import environment from '@ohos.file.environment';
23```
24
25## cl.filemanagement.2 securityLabel Change
26
27Moved the file management subsystem **d.ts** file to the **file** directory. The **securityLabel** module supports error code handling.
28
29**Change Impact**
30
31If your application is developed based on earlier versions, note that the **d.ts** file location and the name of the module to be imported are changed. The **securityLabel** module supports error code handling. See [Adaptation Guide](../v3.2-beta4/changelogs-filemanagement.md).
32
33**Key API/Component Changes**
34
35Before the change, **securityLabel** is imported from **@ohos.securityLabel**:
36
37```js
38import securityLabel from '@ohos.securityLabel';
39```
40
41Now, **securityLabel** is imported from **@ohos.file.securityLabel**:
42
43```js
44import securityLabel from '@ohos.file.securityLabel';
45```
46
47## cl.filemanagement.3 fs Change
48
49Changed the **ino** attribute type of **Stat** under **fs**.
50
51**Change Impact**
52
53The **ino** attribute type is changed from number to BigInt, to adapt to the **inode** range of all types of files in the file system.
54
55**Key API/Component Changes**
56
57The type of the **ino** attribute of **Stat** is changed from number to BigInt.
58
59## cl.filemanagement.4 fileAccess Change
60
61Moved the file management subsystem **d.ts** file to the **file** directory. The **fileAccess** module supports error code handling.
62
63**Change Impact**
64
65If your application is developed based on earlier versions, note that the **d.ts** file location and the name of the module to be imported are changed. The **fileAccess** module supports error code handling. See [Adaptation Guide](../v3.2-beta4/changelogs-filemanagement.md).
66
67**Key API/Component Changes**
68
69Before the change, **fileAccess** is imported from **@ohos.data.fileAccess**:
70
71```js
72import fileAccess from '@ohos.data.fileAccess';
73```
74
75Now, **fileAccess** is imported from **@ohos.file.fileAccess**:
76
77```js
78import fileAccess from '@ohos.file.fileAccess';
79```
80
81## cl.filemanagement.5 fileExtensionInfo Change
82
83Moved the file management subsystem **d.ts** file to the **file** directory. The **fileExtensionInfo** module supports error code handling.
84
85**Change Impact**
86
87If your application is developed based on earlier versions, note that the **d.ts** file location and the name of the module to be imported are changed. The **fileExtensionInfo** module supports error code handling. See [Adaptation Guide](../v3.2-beta4/changelogs-filemanagement.md).
88
89**Key API/Component Changes**
90
91Before the change, **fileExtensionInfo** is imported from **@ohos.fileExtensionInfo**:
92
93```js
94import fileExtensionInfo from '@ohos.fileExtensionInfo';
95```
96
97Now, **fileExtensionInfo** is imported from **@ohos.file.fileExtensionInfo**:
98
99```js
100import fileExtensionInfo from '@ohos.file.fileExtensionInfo';
101```
102
103## cl.filemanagement.6 storageStatistics Change
104
105Moved the file management subsystem **d.ts** file to the **file** directory. The **fileExtensionInfo** module supports error code handling.
106
107**Change Impact**
108
109If your application is developed based on earlier versions, note that the **d.ts** file location and the name of the module to be imported are changed. The **storageStatistics** module supports error code handling. See [Adaptation Guide](../v3.2-beta4/changelogs-filemanagement.md).
110
111**Key API/Component Changes**
112
113Before the change, **storageStatistics** was imported from **@ohos.storageStatistics**:
114
115```js
116import storageStatistics from '@ohos.storageStatistics';
117```
118
119Now, **storageStatistics** is imported from **@ohos.file.storageStatistics**:
120
121```js
122import storageStatistics from '@ohos.file.storageStatistics';
123```
124
125## cl.filemanagement.7 volumeManager Change
126
127Moved the file management subsystem **d.ts** file to the **file** directory. The **fileExtensionInfo** module supports error code handling.
128
129**Change Impact**
130
131If your application is developed based on earlier versions, note that the **d.ts** file location and the name of the module to be imported are changed. The **volumeManager** module supports error code handling. See [Adaptation Guide](../v3.2-beta4/changelogs-filemanagement.md).
132
133**Key API/Component Changes**
134
135Before the change, **volumeManager** was imported from **@ohos.volumeManager**:
136
137```js
138import volumeManager from '@ohos.volumeManager';
139```
140
141Now, **volumeManager** is imported from **@ohos.file.volumeManager**:
142
143```js
144import volumeManager from '@ohos.file.volumeManager';
145```
146
147## cl.filemanagement.8 fileio API Changes
148
149Deprecated the **fileio** APIs, which do not return error codes; added APIs that return error codes.
150
151**Change Impact**
152
153For 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.
154
155**Key API/Component Changes**
156
157The 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.
158The API names remain unchanged.
159
160| Module                   | Method/Attribute/Enum/Constant                                         | Change Type|
161| ------------------------- | ------------------------------------------------------------ | -------- |
162| @ohos.fileio        |  **function** access(path: string, mode?: number, callback?: AsyncCallback\<void>): void \| Promise\<void> | Deprecated    |
163| @ohos.fileio        |  **function** accessSync(path: string, mode?: number): void | Deprecated    |
164| @ohos.file.fs |  **function**  access(path: string, callback?: AsyncCallback\<boolean>): void \| Promise\<boolean> | Added    |
165| @ohos.file.fs |  **function** accessSync(path: string): boolean | Added    |
166| @ohos.fileio        |  **function** close(fd: number, callback?: AsyncCallback\<void>): void \| Promise\<void> | Deprecated    |
167| @ohos.fileio        |  **function** closeSync(fd: number): void | Deprecated    |
168| @ohos.file.fs |  **function** close(file: File \| number, callback?: AsyncCallback\<void>): void \| Promise\<void> | Added    |
169| @ohos.file.fs |  **function** closeSync(file: File \| number): void | Added    |
170| @ohos.fileio        |  **function** mkdir(path: string, mode?: number, callback?: AsyncCallback\<void>): void \| Promise\<void> | Deprecated    |
171| @ohos.fileio        |  **function** mkdirSync(path: string, mode?: number): void | Deprecated    |
172| @ohos.file.fs |  **function** mkdir(path: string, callback?: AsyncCallback\<void>): void \| Promise\<void> | Added    |
173| @ohos.file.fs |  **function** mkdirSync(path: string): void | Added    |
174| @ohos.fileio        |  **function** readText(filePath: string, options?: { position?: number; length?: number; encoding?: string; }, callback?: AsyncCallback\<string>): void \| Promise\<string> | Deprecated    |
175| @ohos.fileio        |  **function** readTextSync(filePath: string, options?: { position?: number; length?: number; encoding?: string; }): string | Deprecated    |
176| @ohos.file.fs |  **function** readText(filePath: string, options?: { offset?: number; length?: number; encoding?: string; }, callback?: AsyncCallback\<string>): void \| Promise\<string> | Added    |
177| @ohos.file.fs |  **function** readTextSync(filePath: string, options?: { offset?: number; length?: number; encoding?: string; }): string | Added    |
178| @ohos.fileio        |  **function** Stream.read(buffer: ArrayBuffer, options?: { offset?: number; length?: number; position?: number; }, callback?: AsyncCallback\<ReadOut>): void \| Promise\<ReadOut> | Deprecated    |
179| @ohos.fileio        |  **function** Stream.readSync(buffer: ArrayBuffer, options?: { offset?: number; length?: number; position?: number; }): number | Deprecated    |
180| @ohos.file.fs |  **function** Stream.read(fd: number, buffer: ArrayBuffer, options?: { offset?: number; length?: number; }, callback?: AsyncCallback\<number>): void \| Promise\<number> | Added    |
181| @ohos.file.fs |  **function** Stream.readSync(fd: number, buffer: ArrayBuffer, options?: { offset?: number; length?: number; }): number | Added    |
182| @ohos.fileio        |  **function** Stream.write(buffer: ArrayBuffer \| string, options?: { offset?: number; length?: number; position?: number; encoding?: string; }, callback?: AsyncCallback\<number>): void \| Promise\<void> | Deprecated    |
183| @ohos.fileio        |  **function** Stream.writeSync(buffer: ArrayBuffer \| string, options?: { offset?: number; length?: number; position?: number; encoding?: string; }): number | Deprecated    |
184| @ohos.file.fs |  **function** Stream.write(buffer: ArrayBuffer \| string, options?: { offset?: number; length?: number; encoding?: string; }, callback?: AsyncCallback\<number>): void \| Promise\<void> | Added    |
185| @ohos.file.fs |  **function** Stream.writeSync(buffer: ArrayBuffer \| string, options?: { offset?: number; length?: number; encoding?: string; }): number | Added    |
186
187**Adaptation Guide**
188
189The APIs of @ohos.file.fs support unified exception handling. For details, see [File Management](../../../application-dev/reference/apis/js-apis-file-fs.md).
190