openharmony 鸿蒙 changelogs-filemanagement

2023-06-24 浏览 (554)

File Management Subsystem Changelog

cl.filemanagement.1 environment Module Change

Moved the file management subsystem d.ts file to the file directory. The environment module supports error code processing.

Change Impact

If 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 processing.

Key API/Component Changes

Before the change, environment is imported from @ohos.environment:

import environment from '@ohos.environment';

Now, environment is imported from @ohos.file.environment:

import environment from '@ohos.file.environment';

cl.filemanagement.2 securityLabel Change

Moved the file management subsystem d.ts file to the file directory. The securityLabel module supports error code processing.

Change Impact

If 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 processing.

Key API/Component Changes

Before the change, securityLabel is imported from @ohos.securityLabel:

import securityLabel from '@ohos.securityLabel';

Now, securityLabel is imported from @ohos.file.securityLabel:

import securityLabel from '@ohos.file.securityLabel';

cl.filemanagement.3 fs Change

Changed the ino attribute type of Stat under fs.

Change Impact

The ino attribute type is changed from number to BigInt, to adapt to the inode range of all types of files in the file system.

Key API/Component Changes

The type of the ino attribute of Stat is changed from number to BigInt.

cl.filemanagement.4 fileAccess Change

Moved the file management subsystem d.ts file to the file directory. The fileAccess module supports error code processing.

Change Impact

If 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 processing.

Key API/Component Changes

Before the change, fileAccess is imported from @ohos.data.fileAccess:

import fileAccess from '@ohos.data.fileAccess';

Now, fileAccess is imported from @ohos.file.fileAccess:

import fileAccess from '@ohos.file.fileAccess';

cl.filemanagement.5 fileExtensionInfo Change

Moved the file management subsystem d.ts file to the file directory. The fileExtensionInfo module supports error code processing.

Change Impact

If 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 processing.

Key API/Component Changes

Before the change, fileExtensionInfo is imported from @ohos.fileExtensionInfo:

import fileExtensionInfo from '@ohos.fileExtensionInfo';

Now, fileExtensionInfo is imported from @ohos.file.fileExtensionInfo:

import fileExtensionInfo from '@ohos.file.fileExtensionInfo';

cl.filemanagement.6 storageStatistics Change

Moved the file management subsystem d.ts file to the file directory. The fileExtensionInfo module supports error code processing.

Change Impact

If 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 processing.

Key API/Component Changes

Before the change, storageStatistics was imported from @ohos.storageStatistics:

import storageStatistics from '@ohos.storageStatistics';

Now, storageStatistics is imported from @ohos.file.storageStatistics:

import storageStatistics from '@ohos.file.storageStatistics';

cl.filemanagement.7 volumeManager Change

Moved the file management subsystem d.ts file to the file directory. The fileExtensionInfo module supports error code processing.

Change Impact

If 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 processing.

Key API/Component Changes

Before the change, volumeManager was imported from @ohos.volumeManager:

import volumeManager from '@ohos.volumeManager';

Now, volumeManager is imported from @ohos.file.volumeManager:

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.

ModuleMethod/Attribute/Enum/ConstantChange Type
@ohos.fileiofunction access(path: string, mode?: number, callback?: AsyncCallback<void>): void |Promise<void>Deprecated
@ohos.fileiofunction accessSync(path: string, mode?: number): voidDeprecated
@ohos.file.fsfunction access(path: string, callback?: AsyncCallback<boolean>): void |Promise<boolean>Added
@ohos.file.fsfunction accessSync(path: string): booleanAdded
@ohos.fileiofunction close(fd: number, callback?: AsyncCallback<void>): void |Promise<void>Deprecated
@ohos.fileiofunction closeSync(fd: number): voidDeprecated
@ohos.file.fsfunction close(file: File |number, callback?: AsyncCallback<void>): void |Promise<void>Added
@ohos.file.fsfunction closeSync(file: File |number): voidAdded
@ohos.fileiofunction mkdir(path: string, mode?: number, callback?: AsyncCallback<void>): void |Promise<void>Deprecated
@ohos.fileiofunction mkdirSync(path: string, mode?: number): voidDeprecated
@ohos.file.fsfunction mkdir(path: string, callback?: AsyncCallback<void>): void |Promise<void>Added
@ohos.file.fsfunction mkdirSync(path: string): voidAdded
@ohos.fileiofunction readText(filePath: string, options?: { position?: number; length?: number; encoding?: string; }, callback?: AsyncCallback<string>): void |Promise<string>Deprecated
@ohos.fileiofunction readTextSync(filePath: string, options?: { position?: number; length?: number; encoding?: string; }): stringDeprecated
@ohos.file.fsfunction readText(filePath: string, options?: { offset?: number; length?: number; encoding?: string; }, callback?: AsyncCallback<string>): void |Promise<string>Added
@ohos.file.fsfunction readTextSync(filePath: string, options?: { offset?: number; length?: number; encoding?: string; }): stringAdded
@ohos.fileiofunction Stream.read(buffer: ArrayBuffer, options?: { offset?: number; length?: number; position?: number; }, callback?: AsyncCallback<ReadOut>): void |Promise<ReadOut>Deprecated
@ohos.fileiofunction Stream.readSync(buffer: ArrayBuffer, options?: { offset?: number; length?: number; position?: number; }): numberDeprecated
@ohos.file.fsfunction Stream.read(fd: number, buffer: ArrayBuffer, options?: { offset?: number; length?: number; }, callback?: AsyncCallback<number>): void |Promise<number>Added
@ohos.file.fsfunction Stream.readSync(fd: number, buffer: ArrayBuffer, options?: { offset?: number; length?: number; }): numberAdded
@ohos.fileiofunction Stream.write(buffer: ArrayBuffer |string, options?: { offset?: number; length?: number; position?: number; encoding?: string; }, callback?: AsyncCallback<number>): void |Promise<void>Deprecated
@ohos.fileiofunction Stream.writeSync(buffer: ArrayBuffer |string, options?: { offset?: number; length?: number; position?: number; encoding?: string; }): numberDeprecated
@ohos.file.fsfunction Stream.write(buffer: ArrayBuffer |string, options?: { offset?: number; length?: number; encoding?: string; }, callback?: AsyncCallback<number>): void |Promise<void>Added
@ohos.file.fsfunction Stream.writeSync(buffer: ArrayBuffer |string, options?: { offset?: number; length?: number; encoding?: string; }): numberAdded

Adaptation Guide

The APIs of @ohos.file.fs support unified exception handling. For details, see File Management.

你可能感兴趣的鸿蒙文章

harmony 鸿蒙Readme

harmony 鸿蒙Example Subsystem Changelog

harmony 鸿蒙Ability Framework Changelog

harmony 鸿蒙Account Subsystem Changelog

harmony 鸿蒙ArkUI Subsystem ChangeLog

harmony 鸿蒙Multimedia Subsystem Changelog

harmony 鸿蒙Common Library Subsystem Changelog

harmony 鸿蒙Distributed Data Management Subsystem JS API Changelog

harmony 鸿蒙Input Method Framework ChangeLog

harmony 鸿蒙File Management Subsystem Changelog

  • 所属分类: 后端技术
  • 本文标签: 软件 鸿蒙
  • 版权声明: 本文链接 https://seaxiang.com/blog/fb2e10c7741b4305a092d10f8692b4bd