harmony 鸿蒙JS API Changes of the File Management Subsystem

  • 2023-02-03
  • 浏览 (520)

JS API Changes of the File Management Subsystem

The table below lists the APIs changes of the file management subsystem in OpenHarmony 3.1 Release over OpenHarmony 3.0 LTS.

API Changes

Module Class Method/Attribute/Enumeration/Constant Change Type
ohos.statfs Statfs getTotalBytes(path: string, callback: AsyncCallback<number>): void;
getTotalBytes(path: string): Promise<number>;
Added
ohos.statfs Statfs getFreeBytes(path: string, callback: AsyncCallback<number>): void;
getFreeBytes(path: string): Promise<number>;
Added
ohos.fileio Watcher stop(): Promise<void>;
stop(callback: AsyncCallback<void>): void;
Added
ohos.fileio ReadOut buffer: ArrayBuffer; Added
ohos.fileio ReadOut offset: number; Added
ohos.fileio ReadOut bytesRead: number; Added
ohos.fileio Stream read(buffer: ArrayBuffer, options?: { position?: number; offset?: number; length?: number; }): Promise<ReadOut>;
read(buffer: ArrayBuffer, callback: AsyncCallback<ReadOut>): void;
read(buffer: ArrayBuffer, options: { position?: number; offset?: number; length?: number; }, callback: AsyncCallback<ReadOut>): void;
Added
ohos.fileio Stream write(buffer: ArrayBuffer |string, options?: { offset?: number; length?: number; position?: number; encoding?: string; }): Promise<number>;
write(buffer: ArrayBuffer |string, callback: AsyncCallback<number>): void;
write(buffer: ArrayBuffer |string, options: { offset?: number; length?: number; position?: number; encoding?: string; }, callback: AsyncCallback<number>): void;
Added
ohos.fileio Stream flush(): Promise<void>;
flush(callback: AsyncCallback<void>): void;
Added
ohos.fileio Stream close(): Promise<void>;
close(callback: AsyncCallback<void>): void;
Added
ohos.fileio Dir close(): Promise<void>;
close(callback: AsyncCallback<void>): void;
Added
ohos.fileio Dir read(): Promise<Dirent>;
read(callback: AsyncCallback<Dirent>): void;
Added
ohos.fileio fileIO createWatcher(filename: string, events: number, callback: AsyncCallback<number>): Watcher; Added
ohos.fileio fileIO write(fd: number, buffer: ArrayBuffer |string, options?: { offset?: number; length?: number; position?: number; encoding?: string; }): Promise<number>;
write(fd: number, buffer: ArrayBuffer |string, callback: AsyncCallback<number>): void;
write(fd: number, buffer: ArrayBuffer |string, options: { offset?: number; length?: number; position?: number; encoding?: string; }, callback: AsyncCallback<number>): void;
Added
ohos.fileio fileIO unlink(path: string): Promise<void>;
unlink(path: string, callback: AsyncCallback<void>): void;
Added
ohos.fileio fileIO truncate(path: string, len?: number): Promise<void>;
truncate(path: string, callback: AsyncCallback<void>): void;
truncate(path: string, len: number, callback: AsyncCallback<void>): void;
Added
ohos.fileio fileIO symlinkSync(target: string, srcPath: string): void; Added
ohos.fileio fileIO symlink(target: string, srcPath: string): Promise<void>;
symlink(target: string, srcPath: string, callback: AsyncCallback<void>): void;
Added
ohos.fileio fileIO stat(path: string): Promise<Stat>;
stat(path: string, callback: AsyncCallback<Stat>): void;
Added
ohos.fileio fileIO rmdir(path: string): Promise<void>;
rmdir(path: string, callback: AsyncCallback<void>): void;
Added
ohos.fileio fileIO rename(oldPath: string, newPath: string): Promise<void>;
rename(oldPath: string, newPath: string, callback: AsyncCallback<void>): void;
Added
ohos.fileio fileIO read(fd: number, buffer: ArrayBuffer, options?: { offset?: number; length?: number; position?: number; }): Promise<ReadOut>
read(fd: number, buffer: ArrayBuffer, callback: AsyncCallback<ReadOut>): void;
read(fd: number, buffer: ArrayBuffer, options: { offset?: number; length?: number; position?: number; }, callback: AsyncCallback<ReadOut>): void;
Added
ohos.fileio fileIO readTextSync(filePath: string, options?: { position?: number; length?: number; encoding?: string; }): string; Added
ohos.fileio fileIO readText(filePath: string, options?: { position?: number; length?: number; encoding?: string; }): Promise<string>;
readText(filePath: string, options: { position?: number; length?: number; encoding?: string; }, callback: AsyncCallback<string>): void;
Added
ohos.fileio fileIO opendir(path: string): Promise<Dir>;
opendir(path: string, callback: AsyncCallback<Dir>): void;
Added
ohos.fileio fileIO open(path: string, flags?: number, mode?: number): Promise<number>;
open(path: string, callback: AsyncCallback<number>): void;
open(path: string, flags: number, callback: AsyncCallback<number>): void;
open(path: string, flags: number, mode: number, callback: AsyncCallback<number>): void;
Added
ohos.fileio fileIO mkdtempSync(prefix: string): string; Added
ohos.fileio fileIO mkdtemp(prefix: string): Promise<string>;
mkdtemp(prefix: string, callback: AsyncCallback<string>): void;
Added
ohos.fileio fileIO mkdir(path: string, mode?: number): Promise<void>;
mkdir(path: string, callback: AsyncCallback<void>): void;
mkdir(path: string, mode: number, callback: AsyncCallback<void>): void;
Added
ohos.fileio fileIO lstatSync(path: string): Stat; Added
ohos.fileio fileIO lstat(path: string): Promise<Stat>;
lstat(path: string, callback: AsyncCallback<Stat>): void;
Added
ohos.fileio fileIO lchownSync(path: string, uid: number, gid: number): void; Added
ohos.fileio fileIO lchown(path: string, uid: number, gid: number): Promise<void>;
lchown(path: string, uid: number, gid: number, callback: AsyncCallback<void>): void;
Added
ohos.fileio fileIO hash(path: string, algorithm: string): Promise<string>;
hash(path: string, algorithm: string, callback: AsyncCallback<string>): void;
Added
ohos.fileio fileIO fdopenStream(fd: number, mode: string): Promise<Stream>;
fdopenStream(fd: number, mode: string, callback: AsyncCallback<Stream>): void;
Added
ohos.fileio fileIO fchmod(fd: number, mode: number): Promise<void>;
fchmod(fd: number, mode: number, callback: AsyncCallback<void>): void;
Added
ohos.fileio fileIO fchown(fd: number, uid: number, gid: number): Promise<void>;
fchown(fd: number, uid: number, gid: number, callback: AsyncCallback<void>): void;
Added
ohos.fileio fileIO fdatasyncSync(fd: number): void; Added
ohos.fileio fileIO fdatasync(fd: number): Promise<void>;
fdatasync(fd: number, callback: AsyncCallback<void>): void;
Added
ohos.fileio fileIO fstat(fd: number): Promise<Stat>;
fstat(fd: number, callback: AsyncCallback<Stat>): void;
Added
ohos.fileio fileIO fsync(fd: number): Promise<void>;
fsync(fd: number, callback: AsyncCallback<void>): void;
Added
ohos.fileio fileIO ftruncate(fd: number, len?: number): Promise<void>;
ftruncate(fd: number, callback: AsyncCallback<void>): void;
ftruncate(fd: number, len: number, callback: AsyncCallback<void>): void;
Added
ohos.fileio fileIO chmod(path: string, mode: number): Promise<void>;
chmod(path: string, mode: number, callback: AsyncCallback<void>): void;
Added
ohos.fileio fileIO chown(path: string, uid: number, gid: number): Promise<void>;
chown(path: string, uid: number, gid: number, callback: AsyncCallback<void>): void;
Added
ohos.fileio fileIO createStream(path: string, mode: string): Promise<Stream>;
createStream(path: string, mode: string, callback: AsyncCallback<Stream>): void;
Added
ohos.fileio fileIO copyFile(src: string |number, dest: string |number, mode?: number): Promise<void>;
copyFile(src: string |number, dest: string |number, callback: AsyncCallback<void>): void;
copyFile(src: string |number, dest: string |number, mode: number, callback: AsyncCallback<void>): void;
Added
ohos.fileio fileIO close(fd: number): Promise<void>;
close(fd: number, callback: AsyncCallback<void>): void;
Added
ohos.fileio fileIO access(path: string, mode?: number): Promise<void>;
access(path: string, callback: AsyncCallback<void>): void;
access(path: string, mode: number, callback: AsyncCallback<void>): void;
Added
ohos.document document show(uri: string, type: string): Promise<void>;
show(uri: string, type: string, callback: AsyncCallback<void>): void;
Added
ohos.document document choose(types?: string[]): Promise<string>;
choose(callback: AsyncCallback<string>): void;
choose(types: string[], callback: AsyncCallback<string>): void;
Added

你可能感兴趣的鸿蒙文章

harmony 鸿蒙Readme

harmony 鸿蒙JS API Changes of the Ability Framework

harmony 鸿蒙JS API Changes of the Accessibility Subsystem

harmony 鸿蒙JS API Changes of the Account Subsystem

harmony 鸿蒙JS API Changes of the ArkUI Development Framework

harmony 鸿蒙JS API Changes of the Power Management Subsystem

harmony 鸿蒙JS API Changes of the Bundle Management Framework

harmony 鸿蒙JS API Changes of the Communication Subsystem

harmony 鸿蒙JS API Changes of the Compiler and Runtime Subsystem

harmony 鸿蒙JS API Changes of the DFX Subsystem

0  赞