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