openharmony 鸿蒙 js-apidiff-file-management

2022-12-22 浏览 (815)

文件管理子系统JS API变更

OpenHarmony 3.1 Release版本相较于OpenHarmony 3.0 LTS版本,文件管理子系统的API变更如下:

接口变更

模块名类名方法/属性/枚举/常量变更类型
ohos.statfsStatfsgetTotalBytes(path: string, callback: AsyncCallback<number>): void;
getTotalBytes(path: string): Promise<number>;
新增
ohos.statfsStatfsgetFreeBytes(path: string, callback: AsyncCallback<number>): void;
getFreeBytes(path: string): Promise<number>;
新增
ohos.fileioWatcherstop(): Promise<void>;
stop(callback: AsyncCallback<void>): void;
新增
ohos.fileioReadOutbuffer: ArrayBuffer;新增
ohos.fileioReadOutoffset: number;新增
ohos.fileioReadOutbytesRead: number;新增
ohos.fileioStreamread(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;
新增
ohos.fileioStreamwrite(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;
新增
ohos.fileioStreamflush(): Promise<void>;
flush(callback: AsyncCallback<void>): void;
新增
ohos.fileioStreamclose(): Promise<void>;
close(callback: AsyncCallback<void>): void;
新增
ohos.fileioDirclose(): Promise<void>;
close(callback: AsyncCallback<void>): void;
新增
ohos.fileioDirread(): Promise<Dirent>;
read(callback: AsyncCallback<Dirent>): void;
新增
ohos.fileiofileIOcreateWatcher(filename: string, events: number, callback: AsyncCallback<number>): Watcher;新增
ohos.fileiofileIOwrite(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;
新增
ohos.fileiofileIOunlink(path: string): Promise<void>;
unlink(path: string, callback: AsyncCallback<void>): void;
新增
ohos.fileiofileIOtruncate(path: string, len?: number): Promise<void>;
truncate(path: string, callback: AsyncCallback<void>): void;
truncate(path: string, len: number, callback: AsyncCallback<void>): void;
新增
ohos.fileiofileIOsymlinkSync(target: string, srcPath: string): void;新增
ohos.fileiofileIOsymlink(target: string, srcPath: string): Promise<void>;
symlink(target: string, srcPath: string, callback: AsyncCallback<void>): void;
新增
ohos.fileiofileIOstat(path: string): Promise<Stat>;
stat(path: string, callback: AsyncCallback<Stat>): void;
新增
ohos.fileiofileIOrmdir(path: string): Promise<void>;
rmdir(path: string, callback: AsyncCallback<void>): void;
新增
ohos.fileiofileIOrename(oldPath: string, newPath: string): Promise<void>;
rename(oldPath: string, newPath: string, callback: AsyncCallback<void>): void;
新增
ohos.fileiofileIOread(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;
新增
ohos.fileiofileIOreadTextSync(filePath: string, options?: { position?: number; length?: number; encoding?: string; }): string;新增
ohos.fileiofileIOreadText(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;
新增
ohos.fileiofileIOopendir(path: string): Promise<Dir>;
opendir(path: string, callback: AsyncCallback<Dir>): void;
新增
ohos.fileiofileIOopen(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;
新增
ohos.fileiofileIOmkdtempSync(prefix: string): string;新增
ohos.fileiofileIOmkdtemp(prefix: string): Promise<string>;
mkdtemp(prefix: string, callback: AsyncCallback<string>): void;
新增
ohos.fileiofileIOmkdir(path: string, mode?: number): Promise<void>;
mkdir(path: string, callback: AsyncCallback<void>): void;
mkdir(path: string, mode: number, callback: AsyncCallback<void>): void;
新增
ohos.fileiofileIOlstatSync(path: string): Stat;新增
ohos.fileiofileIOlstat(path: string): Promise<Stat>;
lstat(path: string, callback: AsyncCallback<Stat>): void;
新增
ohos.fileiofileIOlchownSync(path: string, uid: number, gid: number): void;新增
ohos.fileiofileIOlchown(path: string, uid: number, gid: number): Promise<void>;
lchown(path: string, uid: number, gid: number, callback: AsyncCallback<void>): void;
新增
ohos.fileiofileIOhash(path: string, algorithm: string): Promise<string>;
hash(path: string, algorithm: string, callback: AsyncCallback<string>): void;
新增
ohos.fileiofileIOfdopenStream(fd: number, mode: string): Promise<Stream>;
fdopenStream(fd: number, mode: string, callback: AsyncCallback<Stream>): void;
新增
ohos.fileiofileIOfchmod(fd: number, mode: number): Promise<void>;
fchmod(fd: number, mode: number, callback: AsyncCallback<void>): void;
新增
ohos.fileiofileIOfchown(fd: number, uid: number, gid: number): Promise<void>;
fchown(fd: number, uid: number, gid: number, callback: AsyncCallback<void>): void;
新增
ohos.fileiofileIOfdatasyncSync(fd: number): void;新增
ohos.fileiofileIOfdatasync(fd: number): Promise<void>;
fdatasync(fd: number, callback: AsyncCallback<void>): void;
新增
ohos.fileiofileIOfstat(fd: number): Promise<Stat>;
fstat(fd: number, callback: AsyncCallback<Stat>): void;
新增
ohos.fileiofileIOfsync(fd: number): Promise<void>;
fsync(fd: number, callback: AsyncCallback<void>): void;
新增
ohos.fileiofileIOftruncate(fd: number, len?: number): Promise<void>;
ftruncate(fd: number, callback: AsyncCallback<void>): void;
ftruncate(fd: number, len: number, callback: AsyncCallback<void>): void;
新增
ohos.fileiofileIOchmod(path: string, mode: number): Promise<void>;
chmod(path: string, mode: number, callback: AsyncCallback<void>): void;
新增
ohos.fileiofileIOchown(path: string, uid: number, gid: number): Promise<void>;
chown(path: string, uid: number, gid: number, callback: AsyncCallback<void>): void;
新增
ohos.fileiofileIOcreateStream(path: string, mode: string): Promise<Stream>;
createStream(path: string, mode: string, callback: AsyncCallback<Stream>): void;
新增
ohos.fileiofileIOcopyFile(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;
新增
ohos.fileiofileIOclose(fd: number): Promise<void>;
close(fd: number, callback: AsyncCallback<void>): void;
新增
ohos.fileiofileIOaccess(path: string, mode?: number): Promise<void>;
access(path: string, callback: AsyncCallback<void>): void;
access(path: string, mode: number, callback: AsyncCallback<void>): void;
新增
ohos.documentdocumentshow(uri: string, type: string): Promise<void>;
show(uri: string, type: string, callback: AsyncCallback<void>): void;
新增
ohos.documentdocumentchoose(types?: string[]): Promise<string>;
choose(callback: AsyncCallback<string>): void;
choose(types: string[], callback: AsyncCallback<string>): void;
新增

你可能感兴趣的鸿蒙文章

harmony 鸿蒙Readme

harmony 鸿蒙元能力子系统JS API变更

harmony 鸿蒙元能力子系统JS API变更

harmony 鸿蒙无障碍子系统JS API变更

harmony 鸿蒙帐号子系统JS API变更

harmony 鸿蒙ArkUI子系统JS API变更

harmony 鸿蒙电源服务子系统JS API变更

harmony 鸿蒙包管理子系统JS API变更

harmony 鸿蒙包管理子系统JS API变更

harmony 鸿蒙基础通信子系统JS API变更

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