diff --git a/interfaces/kits/js/src/mod_environment/ani/ets/@ohos.file.environment.ets b/interfaces/kits/js/src/mod_environment/ani/ets/@ohos.file.environment.ets index 71b8e1c2dac3e5e36a47f44b92cdb0f47dd4591a..a39f7071394bd2f18dea79ef8b1b9b1d028dcce8 100644 --- a/interfaces/kits/js/src/mod_environment/ani/ets/@ohos.file.environment.ets +++ b/interfaces/kits/js/src/mod_environment/ani/ets/@ohos.file.environment.ets @@ -16,7 +16,7 @@ import { BusinessError, AsyncCallback } from '@ohos.base'; namespace Environment { - export function getStorageDataDir(): Promise { + export function getStorageDataDir_chinast_1(): Promise { return new Promise((resolve: (result: string) => void, reject: (e: BusinessError) => void): void => { let promise = taskpool.execute(EnvironmentImpl.getStorageDataDirSync); promise.then((ret: NullishType): void => { @@ -28,7 +28,7 @@ namespace Environment { }); } - export function getStorageDataDir(callback: AsyncCallback): void { + export function getStorageDataDir_chinast_2(callback: AsyncCallback): void { let promise = taskpool.execute(EnvironmentImpl.getStorageDataDirSync); promise.then((ret: NullishType): void => { let e = new BusinessError(); @@ -40,7 +40,9 @@ namespace Environment { }); } - export function getUserDataDir(): Promise { + overload getStorageDataDir {getStorageDataDir_chinast_1,getStorageDataDir_chinast_2} + + export function getUserDataDir_chinast_1(): Promise { return new Promise((resolve: (result: string) => void, reject: (e: BusinessError) => void): void => { let promise = taskpool.execute(EnvironmentImpl.getUserDataDirSync); promise.then((ret: NullishType): void => { @@ -51,7 +53,7 @@ namespace Environment { }); }); } - export function getUserDataDir(callback: AsyncCallback): void { + export function getUserDataDir_chinast_2(callback: AsyncCallback): void { let promise = taskpool.execute(EnvironmentImpl.getUserDataDirSync); promise.then((ret: NullishType): void => { let e = new BusinessError(); @@ -63,6 +65,9 @@ namespace Environment { }); } + overload getUserDataDir {getUserDataDir_chinast_1,getUserDataDir_chinast_2} + + export function getUserDownloadDir(): string { return EnvironmentImpl.getUserDownloadDirSync(); } diff --git a/interfaces/kits/js/src/mod_fs/ani/ets/@ohos.file.fs.ets b/interfaces/kits/js/src/mod_fs/ani/ets/@ohos.file.fs.ets index 610c1094f2232012805a85fa2e79617f263dd8a4..1f9c3c1101b36d2bb8d020a284bbba090d730329 100644 --- a/interfaces/kits/js/src/mod_fs/ani/ets/@ohos.file.fs.ets +++ b/interfaces/kits/js/src/mod_fs/ani/ets/@ohos.file.fs.ets @@ -39,7 +39,7 @@ namespace fileIo { export const SYNC = 0o4010000; } -function access(path: string, mode?: AccessModeType): Promise { +function access_chinast_1(path: string, mode?: AccessModeType): Promise { return new Promise((resolve: (result: boolean) => void, reject: (e: BusinessError) => void) => { let promise = taskpool.execute((path: string, mode?: AccessModeType): boolean => { return FileIoImpl.doAccessSync(path, mode); @@ -53,7 +53,7 @@ function access(path: string, mode?: AccessModeType): Promise { }); } -function access(path: string, callback: AsyncCallback): void { +function access_chinast_2(path: string, callback: AsyncCallback): void { let promise = taskpool.execute((path: string): boolean => { return FileIoImpl.doAccessSync(path); }, path); @@ -67,7 +67,7 @@ function access(path: string, callback: AsyncCallback): void { }); } -function access(path: string, mode: AccessModeType, flag: AccessFlagType): Promise { +function access_chinast_3(path: string, mode: AccessModeType, flag: AccessFlagType): Promise { return new Promise((resolve: (result: boolean) => void, reject: (e: BusinessError) => void) => { let promise = taskpool.execute((path: string, mode: AccessModeType, flag: AccessFlagType): boolean => { return FileIoImpl.doAccessSync(path, mode, flag); @@ -81,15 +81,19 @@ function access(path: string, mode: AccessModeType, flag: AccessFlagType): Promi }) } -function accessSync(path: string, mode?: AccessModeType): boolean { +overload access {access_chinast_1, access_chinast_2, access_chinast_3} + +function accessSync_chinast_1(path: string, mode?: AccessModeType): boolean { return FileIoImpl.doAccessSync(path, mode); } -function accessSync(path: string, mode: AccessModeType, flag: AccessFlagType): boolean { +function accessSync_chinast_2(path: string, mode: AccessModeType, flag: AccessFlagType): boolean { return FileIoImpl.doAccessSync(path, mode, flag); } -function close(file: number | File): Promise { +overload accessSync {accessSync_chinast_1, accessSync_chinast_2} + +function close_chinast_1(file: number | File): Promise { return new Promise((resolve: (result: undefined) => void, reject: (e: BusinessError) => void): void => { let promise = taskpool.execute((file: number | File): undefined => FileIoImpl.closeSync(file), file); promise.then((ret: NullishType): void => { @@ -100,7 +104,7 @@ function close(file: number | File): Promise { }); } -function close(file: number | File, callback: AsyncCallback): void { +function close_chinast_2(file: number | File, callback: AsyncCallback): void { let promise = taskpool.execute((file: number | File): undefined => FileIoImpl.closeSync(file), file); promise.then((ret: NullishType): void => { let e = new BusinessError(); @@ -111,6 +115,8 @@ function close(file: number | File, callback: AsyncCallback): void { }); } +overload close {close_chinast_1, close_chinast_2} + function closeSync(file: number | File): void { return FileIoImpl.closeSync(file) } @@ -164,7 +170,7 @@ function copyDirSync(src: string, dest: string, mode?: number): void { return FileIoImpl.copyDirSync(src, dest, mode); } -function copyDir(src: string, dest: string, mode?: number): Promise { +function copyDir_chinast_1(src: string, dest: string, mode?: number): Promise { return new Promise((resolve: (result: undefined) => void, reject: (e: BusinessError>) => void): void => { let promise = taskpool.execute((src: string, dest: string, mode?: number): undefined => @@ -177,7 +183,7 @@ function copyDir(src: string, dest: string, mode?: number): Promise { }); } -function copyDir(src: string, dest: string, callback: AsyncCallback>): void { +function copyDir_chinast_2(src: string, dest: string, callback: AsyncCallback>): void { let promise = taskpool.execute((src: string, dest: string): undefined => FileIoImpl.copyDirSync(src, dest), src, dest); promise.then((ret: NullishType): void => { @@ -190,7 +196,7 @@ function copyDir(src: string, dest: string, callback: AsyncCallback>): void { +function copyDir_chinast_3(src: string, dest: string, mode: number, callback: AsyncCallback>): void { let promise = taskpool.execute((src: string, dest: string, mode: number): undefined => FileIoImpl.copyDirSync(src, dest, mode), src, dest, mode); promise.then((ret: NullishType): void => { @@ -203,7 +209,7 @@ function copyDir(src: string, dest: string, mode: number, callback: AsyncCallbac }); } -function copyDir(arg0: Object, arg1: Object, arg2: NullishType, arg3: NullishType): void { +function copyDir_chinast_4(arg0: Object, arg1: Object, arg2: NullishType, arg3: NullishType): void { let src = arg0 as string; let dest = arg1 as string; if (typeof arg2 === 'number' && typeof arg3 === 'function') { @@ -224,7 +230,9 @@ function copyDir(arg0: Object, arg1: Object, arg2: NullishType, arg3: NullishTyp } } -function mkdirSync(path: string): void { +overload copyDir { copyDir_chinast_1,copyDir_chinast_2,copyDir_chinast_3,copyDir_chinast_4 } + +function mkdirSync_chinast_1(path: string): void { return FileIoImpl.mkdirSync(path) } @@ -232,7 +240,7 @@ function fdatasyncSync(fd: number): void { return FileIoImpl.fdatasyncSync(fd) } -function fdatasync(fd: number): Promise { +function fdatasync_chinast_1(fd: number): Promise { return new Promise((resolve: (result: undefined) => void, reject: (e: BusinessError) => void): void => { let promise = taskpool.execute((fd: number): undefined => FileIoImpl.fdatasyncSync(fd), fd); promise.then((ret: NullishType): void => { @@ -243,7 +251,7 @@ function fdatasync(fd: number): Promise { }); } -function fdatasync(fd: number, callback: AsyncCallback): void { +function fdatasync_chinast_2(fd: number, callback: AsyncCallback): void { let promise = taskpool.execute((fd: number): undefined => FileIoImpl.fdatasyncSync(fd), fd); promise.then((ret: NullishType): void => { let e = new BusinessError(); @@ -254,10 +262,14 @@ function fdatasync(fd: number, callback: AsyncCallback): void { }); } -function mkdirSync(path: string, recursion: boolean): void { +overload fdatasync {fdatasync_chinast_1, fdatasync_chinast_2} + +function mkdirSync_chinast_2(path: string, recursion: boolean): void { return FileIoImpl.mkdirSync(path, recursion) } +overload mkdirSync {mkdirSync_chinast_1, mkdirSync_chinast_2} + function mkdirSync1(path: string): undefined { FileIoImpl.mkdirSync(path); return undefined; @@ -268,7 +280,7 @@ function mkdirSync2(path: string, recursion: boolean): undefined { return undefined; } -function mkdir(path: string): Promise { +function mkdir_chinast_1(path: string): Promise { return new Promise((resolve: (result: undefined) => void, reject: (e: BusinessError) => void): void => { let promise = taskpool.execute((path: string): undefined => mkdirSync1(path), path); promise.then((ret: NullishType): void => { @@ -279,7 +291,7 @@ function mkdir(path: string): Promise { }); } -function mkdir(path: string, callback: AsyncCallback): void { +function mkdir_chinast_2(path: string, callback: AsyncCallback): void { let promise = taskpool.execute((path: string): undefined => mkdirSync1(path), path); promise.then((ret: NullishType): void => { let e = new BusinessError(); @@ -290,7 +302,7 @@ function mkdir(path: string, callback: AsyncCallback): void { }); } -function mkdir(path: string, recursion: boolean): Promise { +function mkdir_chinast_3(path: string, recursion: boolean): Promise { return new Promise((resolve: (result: undefined) => void, reject: (e: BusinessError) => void): void => { let promise = taskpool.execute((path: string, recursion: boolean): undefined => mkdirSync2(path, recursion), path, recursion); @@ -302,7 +314,7 @@ function mkdir(path: string, recursion: boolean): Promise { }); } -function mkdir(path: string, recursion: boolean, callback: AsyncCallback): void { +function mkdir_chinast_4(path: string, recursion: boolean, callback: AsyncCallback): void { let promise = taskpool.execute((path: string, recursion: boolean): undefined => mkdirSync2(path, recursion), path, recursion); promise.then((ret: NullishType): void => { @@ -314,11 +326,13 @@ function mkdir(path: string, recursion: boolean, callback: AsyncCallback): }); } +overload mkdir {mkdir_chinast_1, mkdir_chinast_2, mkdir_chinast_3, mkdir_chinast_4} + function moveDirSync(src: string, dest: string, mode?: number): void { return FileIoImpl.movedirSync(src, dest, mode) } -function moveDir(src: string, dest: string, mode?: number): Promise { +function moveDir_chinast_1(src: string, dest: string, mode?: number): Promise { return new Promise((resolve: (result: undefined) => void, reject: (e: BusinessError>) => void): void => { let promise = taskpool.execute((src: string, dest: string, mode?: number): undefined => { @@ -332,7 +346,7 @@ function moveDir(src: string, dest: string, mode?: number): Promise { }) } -function moveDir(src: string, dest: string, callback: AsyncCallback>): void { +function moveDir_chinast_2(src: string, dest: string, callback: AsyncCallback>): void { let promise = taskpool.execute((src: string, dest: string): undefined => { return FileIoImpl.movedirSync(src, dest); }, src, dest); @@ -346,7 +360,7 @@ function moveDir(src: string, dest: string, callback: AsyncCallback>): void { +function moveDir_chinast_3(src: string, dest: string, mode: number, callback: AsyncCallback>): void { let promise = taskpool.execute((src: string, dest: string, mode: number): undefined => { return FileIoImpl.movedirSync(src, dest, mode); }, src, dest, mode); @@ -360,7 +374,7 @@ function moveDir(src: string, dest: string, mode: number, callback: AsyncCallbac }); } -function moveDir(arg0: Object, arg1: Object, arg2: NullishType, arg3: NullishType): void { +function moveDir_chinast_4(arg0: Object, arg1: Object, arg2: NullishType, arg3: NullishType): void { let src = arg0 as string; let dest = arg1 as string; if (typeof arg2 === 'number' && typeof arg3 === 'function') { @@ -381,11 +395,13 @@ function moveDir(arg0: Object, arg1: Object, arg2: NullishType, arg3: NullishTyp } } +overload moveDir { moveDir_chinast_1,moveDir_chinast_2,moveDir_chinast_3,moveDir_chinast_4 } + function mkdtempSync(prefix: string): string { return FileIoImpl.mkdtempSync(prefix); } -function mkdtemp(prefix: string): Promise { +function mkdtemp_chinast_1(prefix: string): Promise { return new Promise((resolve: (result: string) => void, reject: (e: BusinessError) => void): void => { let promise = taskpool.execute((prefix: string): string => { return FileIoImpl.mkdtempSync(prefix); @@ -399,7 +415,7 @@ function mkdtemp(prefix: string): Promise { }); } -function mkdtemp(prefix: string, callback: AsyncCallback): void { +function mkdtemp_chinast_2(prefix: string, callback: AsyncCallback): void { let promise = taskpool.execute((prefix: string): string => { return FileIoImpl.mkdtempSync(prefix); }, prefix); @@ -413,11 +429,13 @@ function mkdtemp(prefix: string, callback: AsyncCallback): void { }); } +overload mkdtemp {mkdtemp_chinast_1, mkdtemp_chinast_2} + function moveFileSync(src: string, dest: string, mode?: number): void { return FileIoImpl.moveFileSync(src, dest, mode); } -function moveFile(src: string, dest: string, mode?: number): Promise { +function moveFile_chinast_1(src: string, dest: string, mode?: number): Promise { return new Promise((resolve: (result: undefined) => void, reject: (e: BusinessError) => void): void => { let promise = taskpool.execute((src: string, dest: string, mode?: number): undefined => { return FileIoImpl.moveFileSync(src, dest, mode); @@ -430,7 +448,7 @@ function moveFile(src: string, dest: string, mode?: number): Promise { }); } -function moveFile(src: string, dest: string, mode: number, callback: AsyncCallback): void { +function moveFile_chinast_2(src: string, dest: string, mode: number, callback: AsyncCallback): void { let promise = taskpool.execute((src: string, dest: string, mode: number): undefined => { return FileIoImpl.moveFileSync(src, dest, mode); }, src, dest, mode); @@ -443,7 +461,7 @@ function moveFile(src: string, dest: string, mode: number, callback: AsyncCallba }); } -function moveFile(src: string, dest: string, callback: AsyncCallback): void { +function moveFile_chinast_3(src: string, dest: string, callback: AsyncCallback): void { let promise = taskpool.execute((src: string, dest: string): undefined => { return FileIoImpl.moveFileSync(src, dest); }, src, dest); @@ -456,11 +474,13 @@ function moveFile(src: string, dest: string, callback: AsyncCallback): voi }); } +overload moveFile {moveFile_chinast_1, moveFile_chinast_2, moveFile_chinast_3} + function openSync(path: string, mode?: number): File { return FileIoImpl.openSync(path, mode); } -function open(path: String, mode?: number): Promise { +function open_chinast_1(path: String, mode?: number): Promise { return new Promise((resolve: (result: File) => void, reject: (e: BusinessError) => void) => { let promise = taskpool.execute((path: String, mode?: number): File => { return FileIoImpl.openSync(path, mode); @@ -474,7 +494,7 @@ function open(path: String, mode?: number): Promise { }); } -function open(path: String, mode: number, callback: AsyncCallback): void { +function open_chinast_2(path: String, mode: number, callback: AsyncCallback): void { let promise = taskpool.execute((path: String, mode: number): File => { return FileIoImpl.openSync(path, mode); }, path, mode); @@ -489,7 +509,7 @@ function open(path: String, mode: number, callback: AsyncCallback): }); } -function open(path: String, callback: AsyncCallback): void { +function open_chinast_3(path: String, callback: AsyncCallback): void { let promise = taskpool.execute((path: String): File => { return FileIoImpl.openSync(path); }, path); @@ -504,6 +524,8 @@ function open(path: String, callback: AsyncCallback): void { }); } +overload open {open_chinast_1, open_chinast_2, open_chinast_3} + function writeSync(fd: number, buffer: string | ArrayBuffer, options?: WriteOptions): number { return FileIoImpl.writeSync(fd, buffer, options); } @@ -555,7 +577,7 @@ function readSync(fd: number, buffer: ArrayBuffer, options?: ReadOptions): numbe return FileIoImpl.readSync(fd, buffer, options) } -function read(fd: number, buffer: ArrayBuffer, options?: ReadOptions): Promise { +function read_chinast_1(fd: number, buffer: ArrayBuffer, options?: ReadOptions): Promise { return new Promise((resolve: (result: number) => void, reject: (e: BusinessError) => void) => { let promise = taskpool.execute((fd: number, buffer: ArrayBuffer, options?: ReadOptions): number => { return FileIoImpl.readSync(fd, buffer, options) @@ -569,7 +591,7 @@ function read(fd: number, buffer: ArrayBuffer, options?: ReadOptions): Promise): void { +function read_chinast_2(fd: number, buffer: ArrayBuffer, callback: AsyncCallback): void { let promise = taskpool.execute((fd: number, buffer: ArrayBuffer): number => { return FileIoImpl.readSync(fd, buffer); }, fd, buffer); @@ -583,7 +605,7 @@ function read(fd: number, buffer: ArrayBuffer, callback: AsyncCallback): void { +function read_chinast_3(fd: number, buffer: ArrayBuffer, options: ReadOptions, callback: AsyncCallback): void { let promise = taskpool.execute((fd: number, buffer: ArrayBuffer, options: ReadOptions): number => { return FileIoImpl.readSync(fd, buffer, options); }, fd, buffer, options); @@ -597,11 +619,13 @@ function read(fd: number, buffer: ArrayBuffer, options: ReadOptions, callback: A }); } +overload read {read_chinast_1, read_chinast_2, read_chinast_3} + function readLinesSync(filePath: string, options?: Options): ReaderIterator { return FileIoImpl.readlinesSync(filePath, options) } -function readLines(filePath: string, options?: Options): Promise { +function readLines_chinast_1(filePath: string, options?: Options): Promise { return new Promise((resolve: (result: ReaderIterator) => void, reject: (e: BusinessError) => void) => { let promise = taskpool.execute((filePath: string, options?: Options): ReaderIterator => { @@ -616,7 +640,7 @@ function readLines(filePath: string, options?: Options): Promise }); } -function readLines(filePath: string, callback: AsyncCallback): void { +function readLines_chinast_2(filePath: string, callback: AsyncCallback): void { let promise = taskpool.execute((filePath: string): ReaderIterator => { return FileIoImpl.readlinesSync(filePath); }, filePath); @@ -631,7 +655,7 @@ function readLines(filePath: string, callback: AsyncCallback): v }); } -function readLines(filePath: string, options: Options, callback: AsyncCallback): void { +function readLines_chinast_3(filePath: string, options: Options, callback: AsyncCallback): void { let promise = taskpool.execute((filePath: string, options: Options): ReaderIterator => { return FileIoImpl.readlinesSync(filePath, options); }, filePath, options); @@ -646,11 +670,13 @@ function readLines(filePath: string, options: Options, callback: AsyncCallback { +function rmdir_chinast_1(path: string): Promise { return new Promise((resolve: (result: undefined) => void, reject: (e: BusinessError) => void): void => { let promise = taskpool.execute((path: string): void => FileIoImpl.rmdirSync(path), path); @@ -662,7 +688,7 @@ function rmdir(path: string): Promise { }); } -function rmdir(path: string, callback: AsyncCallback): void { +function rmdir_chinast_2(path: string, callback: AsyncCallback): void { let promise = taskpool.execute((path: string): void => FileIoImpl.rmdirSync(path), path); promise.then((ret: NullishType) => { let e = new BusinessError(); @@ -673,11 +699,13 @@ function rmdir(path: string, callback: AsyncCallback): void { }); } +overload rmdir {rmdir_chinast_1, rmdir_chinast_2} + function truncateSync(file: string | number, len?: number): void { return FileIoImpl.truncateSync(file, len) } -function truncate(file: string | number, len?: number): Promise { +function truncate_chinast_1(file: string | number, len?: number): Promise { return new Promise((resolve: (result: undefined) => void, reject: (e: BusinessError) => void): void => { let promise = taskpool.execute((file: string | number, len?: number): undefined => { return FileIoImpl.truncateSync(file, len); @@ -690,7 +718,7 @@ function truncate(file: string | number, len?: number): Promise { }) } -function truncate(file: string | number, callback: AsyncCallback): void { +function truncate_chinast_2(file: string | number, callback: AsyncCallback): void { let promise = taskpool.execute((file: string | number): undefined => { return FileIoImpl.truncateSync(file); }, file); @@ -703,7 +731,7 @@ function truncate(file: string | number, callback: AsyncCallback): void { }); } -function truncate(file: string | number, len: number, callback: AsyncCallback): void { +function truncate_chinast_3(file: string | number, len: number, callback: AsyncCallback): void { let promise = taskpool.execute((file: string | number, len: number): undefined => { return FileIoImpl.truncateSync(file, len); }, file, len); @@ -716,11 +744,13 @@ function truncate(file: string | number, len: number, callback: AsyncCallback { +function unlink_chinast_1(path: string): Promise { return new Promise((resolve: (result: undefined) => void, reject: (e: BusinessError) => void): void => { let promise = taskpool.execute((path: string): undefined => unlinkSync(path), path); @@ -732,7 +762,7 @@ function unlink(path: string): Promise { }); } -function unlink(path: string, callback: AsyncCallback): void { +function unlink_chinast_2(path: string, callback: AsyncCallback): void { let promise = taskpool.execute((path: string): undefined => unlinkSync(path), path); promise.then((ret: NullishType): void => { let e = new BusinessError(); @@ -743,7 +773,9 @@ function unlink(path: string, callback: AsyncCallback): void { }); } -function readText(filePath: string, options?: ReadTextOptions): Promise { +overload unlink {unlink_chinast_1, unlink_chinast_2} + +function readText_chinast_1(filePath: string, options?: ReadTextOptions): Promise { return new Promise((resolve: (result: string) => void, reject: (e: BusinessError) => void) => { let promise = taskpool.execute((filePath: string, options?: ReadTextOptions): string => { return FileIoImpl.readTextSync(filePath, options); @@ -757,7 +789,7 @@ function readText(filePath: string, options?: ReadTextOptions): Promise }); } -function readText(filePath: string, callback: AsyncCallback): void { +function readText_chinast_2(filePath: string, callback: AsyncCallback): void { let promise = taskpool.execute((filePath: string): string => { return FileIoImpl.readTextSync(filePath); }, filePath); @@ -771,7 +803,7 @@ function readText(filePath: string, callback: AsyncCallback): void { }); } -function readText(filePath: string, options: ReadTextOptions, callback: AsyncCallback): void { +function readText_chinast_3(filePath: string, options: ReadTextOptions, callback: AsyncCallback): void { let promise = taskpool.execute((filePath: string, options: ReadTextOptions): string => { return FileIoImpl.readTextSync(filePath, options); }, filePath, options); @@ -785,11 +817,13 @@ function readText(filePath: string, options: ReadTextOptions, callback: AsyncCal }); } +overload readText {readText_chinast_1, readText_chinast_2, readText_chinast_3} + function readTextSync(filePath: string, options?: ReadTextOptions): string { return FileIoImpl.readTextSync(filePath, options); } -function listFile(path: string, options?: ListFileOptions): Promise { +function listFile_chinast_1(path: string, options?: ListFileOptions): Promise { return new Promise((resolve: (result: string[]) => void, reject: (e: BusinessError) => void) => { let promise = taskpool.execute((path: string, options?: ListFileOptions): string[] => { return FileIoImpl.listFileSync(path, options); @@ -803,7 +837,7 @@ function listFile(path: string, options?: ListFileOptions): Promise { }); } -function listFile(path: string, callback: AsyncCallback): void { +function listFile_chinast_2(path: string, callback: AsyncCallback): void { let promise = taskpool.execute((path: string): string[] => { return FileIoImpl.listFileSync(path); }, path); @@ -817,7 +851,7 @@ function listFile(path: string, callback: AsyncCallback): void { }); } -function listFile(path: string, options: ListFileOptions, callback: AsyncCallback): void { +function listFile_chinast_3(path: string, options: ListFileOptions, callback: AsyncCallback): void { let promise = taskpool.execute((path: string, options: ListFileOptions): string[] => { return FileIoImpl.listFileSync(path, options); }, path, options); @@ -831,6 +865,8 @@ function listFile(path: string, options: ListFileOptions, callback: AsyncCallbac }); } +overload listFile {listFile_chinast_1, listFile_chinast_2, listFile_chinast_3} + function listFileSync(path: string, options?: ListFileOptions): string[] { return FileIoImpl.listFileSync(path, options); } @@ -843,7 +879,7 @@ function statSync(file: string | number): Stat { return FileIoImpl.statSync(file) } -function stat(file: string | number): Promise { +function stat_chinast_1(file: string | number): Promise { return new Promise((resolve: (result: Stat) => void, reject: (e: BusinessError) => void) => { let promise = taskpool.execute((file: string | number): Stat => { return FileIoImpl.statSync(file); @@ -857,7 +893,7 @@ function stat(file: string | number): Promise { }); } -function stat(file: string | number, callback: AsyncCallback): void { +function stat_chinast_2(file: string | number, callback: AsyncCallback): void { let p = taskpool.execute((file: string | number): Stat => { return FileIoImpl.statSync(file); }, file); @@ -871,11 +907,13 @@ function stat(file: string | number, callback: AsyncCallback): void }); } +overload stat {stat_chinast_1, stat_chinast_2} + function fsyncSync(fd: number): void { return FileIoImpl.fsyncSync(fd); } -function fsync(fd: number): Promise { +function fsync_chinast_1(fd: number): Promise { return new Promise((resolve: (result: undefined) => void, reject: (e: BusinessError) => void): void => { let promise = taskpool.execute((fd: number): undefined => { return FileIoImpl.fsyncSync(fd); @@ -888,7 +926,7 @@ function fsync(fd: number): Promise { }); } -function fsync(fd: number, callback: AsyncCallback): void { +function fsync_chinast_2(fd: number, callback: AsyncCallback): void { let promise = taskpool.execute((fd: number): undefined => { return FileIoImpl.fsyncSync(fd); }, fd); @@ -901,11 +939,13 @@ function fsync(fd: number, callback: AsyncCallback): void { }); } +overload fsync {fsync_chinast_1, fsync_chinast_2} + function symlinkSync(target: string, srcPath: string): void { return FileIoImpl.symlinkSync(target, srcPath); } -function symlink(target: string, srcPath: string): Promise { +function symlink_chinast_1(target: string, srcPath: string): Promise { return new Promise((resolve: (result: undefined) => void, reject: (e: BusinessError) => void): void => { let promise = taskpool.execute((target: string, srcPath: string): undefined => { @@ -922,7 +962,7 @@ function renameSync(oldPath: string, newPath: string): void { return FileIoImpl.renameSync(oldPath, newPath); } -function rename(oldPath: string, newPath: string): Promise { +function rename_chinast_1(oldPath: string, newPath: string): Promise { return new Promise((resolve: (result: undefined) => void, reject: (e: BusinessError) => void): void => { let promise = taskpool.execute((oldPath: string, newPath: string): undefined => { return FileIoImpl.renameSync(oldPath, newPath); @@ -935,7 +975,7 @@ function rename(oldPath: string, newPath: string): Promise { }); } -function rename(oldPath: string, newPath: string, callback: AsyncCallback): void { +function rename_chinast_2(oldPath: string, newPath: string, callback: AsyncCallback): void { let promise = taskpool.execute((oldPath: string, newPath: string): undefined => { return FileIoImpl.renameSync(oldPath, newPath); }, oldPath, newPath); @@ -948,12 +988,14 @@ function rename(oldPath: string, newPath: string, callback: AsyncCallback) }); } +overload rename {rename_chinast_1, rename_chinast_2} + function createRandomAccessFileSync(file: string | File, mode?: number, options?: RandomAccessFileOptions): RandomAccessFile { return FileIoImpl.createRandomAccessFileSync(file, mode, options); } -function createRandomAccessFile(file: string | File, mode?: number, +function createRandomAccessFile_chinast_1(file: string | File, mode?: number, options?: RandomAccessFileOptions): Promise { return new Promise((resolve: (result: RandomAccessFile) => void, reject: (e: BusinessError) => void) => { @@ -970,7 +1012,7 @@ function createRandomAccessFile(file: string | File, mode?: number, }); } -function fdopenStream(fd: number, mode: string): Promise { +function fdopenStream_chinast_1(fd: number, mode: string): Promise { return new Promise((resolve: (result: Stream) => void, reject: (e: BusinessError) => void) => { let promise = taskpool.execute((fd: number, mode: string): Stream => { return FileIoImpl.fdopenStreamSync(fd, mode); @@ -1000,7 +1042,7 @@ function setxattr(path: string, key: string, value: string): Promise { }); } -function createRandomAccessFile(file: string | File, callback: AsyncCallback): void { +function createRandomAccessFile_chinast_2(file: string | File, callback: AsyncCallback): void { let promise = taskpool.execute((file: string | File): RandomAccessFile => { return FileIoImpl.createRandomAccessFileSync(file); }, file); @@ -1015,7 +1057,7 @@ function createRandomAccessFile(file: string | File, callback: AsyncCallback): void { let promise = taskpool.execute((file: string | File, mode: number): RandomAccessFile => { return FileIoImpl.createRandomAccessFileSync(file, mode); @@ -1031,7 +1073,9 @@ function createRandomAccessFile(file: string | File, mode: number, }); } -function fdopenStream(fd: number, mode: string, callback: AsyncCallback): void { +overload createRandomAccessFile {createRandomAccessFile_chinast_1, createRandomAccessFile_chinast_2, createRandomAccessFile_chinast_3} + +function fdopenStream_chinast_2(fd: number, mode: string, callback: AsyncCallback): void { let promise = taskpool.execute((fd: number, mode: string): Stream => { return FileIoImpl.fdopenStreamSync(fd, mode); }, fd, mode); @@ -1046,11 +1090,13 @@ function fdopenStream(fd: number, mode: string, callback: AsyncCallback) }); } +overload fdopenStream {fdopenStream_chinast_1, fdopenStream_chinast_2} + function fdopenStreamSync(fd: number, mode: string): Stream { return FileIoImpl.fdopenStreamSync(fd, mode); } -function createStream(path: string, mode: string): Promise { +function createStream_chinast_1(path: string, mode: string): Promise { return new Promise((resolve: (result: Stream) => void, reject: (e: BusinessError) => void) => { let promise = taskpool.execute((path: string, mode: string): Stream => { return FileIoImpl.createStreamSync(path, mode); @@ -1064,7 +1110,7 @@ function createStream(path: string, mode: string): Promise { }); } -function createStream(path: string, mode: string, callback: AsyncCallback): void { +function createStream_chinast_2(path: string, mode: string, callback: AsyncCallback): void { let promise = taskpool.execute((path: string, mode: string): Stream => { return FileIoImpl.createStreamSync(path, mode); }, path, mode); @@ -1079,6 +1125,8 @@ function createStream(path: string, mode: string, callback: AsyncCallback): void { +function symlink_chinast_2(target: string, srcPath: string, callback: AsyncCallback): void { let promise = taskpool.execute((target: string, srcPath: string): undefined => { return FileIoImpl.symlinkSync(target, srcPath); }, target, srcPath); @@ -1108,6 +1156,8 @@ function symlink(target: string, srcPath: string, callback: AsyncCallback) }); } +overload symlink {symlink_chinast_1, symlink_chinast_2} + function utimes(path: string, mtime: number): void { return FileIoImpl.utimes(path, mtime); } @@ -1116,7 +1166,7 @@ function lstatSync(path: string): Stat { return FileIoImpl.lstatSync(path) } -function lstat(path: string): Promise { +function lstat_chinast_1(path: string): Promise { return new Promise((resolve: (result: Stat) => void, reject: (e: BusinessError) => void) => { let promise = taskpool.execute((path: string): Stat => { return FileIoImpl.lstatSync(path); @@ -1136,7 +1186,7 @@ function lstat(path: string): Promise { }); } -function lstat(path: string, callback: AsyncCallback): void { +function lstat_chinast_2(path: string, callback: AsyncCallback): void { let p = taskpool.execute((path: string): Stat => { return FileIoImpl.lstatSync(path); }, path); @@ -1155,7 +1205,10 @@ function lstat(path: string, callback: AsyncCallback): void { callback(e as BusinessError, new StatInner(0)); }); } -function copyFile(src: string | number, dest: string | number, mode?: number): Promise { + +overload lstat {lstat_chinast_1, lstat_chinast_2} + +function copyFile_chinast_1(src: string | number, dest: string | number, mode?: number): Promise { return new Promise((resolve: (result: undefined) => void, reject: (e: BusinessError) => void): void => { let promise = taskpool.execute((src: string | number, dest: string | number, mode?: number): undefined => FileIoImpl.copyFileSync(src, dest, mode), src, dest, mode); @@ -1167,7 +1220,7 @@ function copyFile(src: string | number, dest: string | number, mode?: number): P }); } -function copy(srcUri: string, destUri: string, options?: CopyOptions): Promise { +function copy_chinast_1(srcUri: string, destUri: string, options?: CopyOptions): Promise { return new Promise((resolve: (result: undefined) => void, reject: (e: BusinessError) => void): void => { let promise = taskpool.execute((srcUri: string, destUri: string, options?: CopyOptions): undefined => FileIoImpl.copySync(srcUri, destUri, options), srcUri, destUri, options); @@ -1179,7 +1232,7 @@ function copy(srcUri: string, destUri: string, options?: CopyOptions): Promise): void { +function copyFile_chinast_2(src: string | number, dest: string | number, mode: number, callback: AsyncCallback): void { let promise = taskpool.execute((src: string | number, dest: string | number, mode: number): undefined => FileIoImpl.copyFileSync(src, dest, mode), src, dest, mode); promise.then((ret: NullishType): void => { @@ -1191,7 +1244,7 @@ function copyFile(src: string | number, dest: string | number, mode: number, cal }); } -function copy(srcUri: string, destUri: string, options: CopyOptions, callback: AsyncCallback): void { +function copy_chinast_2(srcUri: string, destUri: string, options: CopyOptions, callback: AsyncCallback): void { let promise = taskpool.execute((srcUri: string, destUri: string, options: CopyOptions): undefined => FileIoImpl.copySync(srcUri, destUri, options), srcUri, destUri, options); promise.then((ret: NullishType): void => { @@ -1203,7 +1256,7 @@ function copy(srcUri: string, destUri: string, options: CopyOptions, callback: A }); } -function copyFile(src: string | number, dest: string | number, callback: AsyncCallback): void { +function copyFile_chinast_3(src: string | number, dest: string | number, callback: AsyncCallback): void { let promise = taskpool.execute((src: string | number, dest: string | number): undefined => FileIoImpl.copyFileSync(src, dest), src, dest); promise.then((ret: NullishType): void => { @@ -1215,7 +1268,9 @@ function copyFile(src: string | number, dest: string | number, callback: AsyncCa }); } -function copy(srcUri: string, destUri: string, callback: AsyncCallback): void { +overload copyFile {copyFile_chinast_1, copyFile_chinast_2, copyFile_chinast_3} + +function copy_chinast_3(srcUri: string, destUri: string, callback: AsyncCallback): void { let promise = taskpool.execute((srcUri: string, destUri: string): undefined => FileIoImpl.copySync(srcUri, destUri), srcUri, destUri); promise.then((ret: NullishType): void => { @@ -1227,6 +1282,8 @@ function copy(srcUri: string, destUri: string, callback: AsyncCallback): v }); } +overload copy {copy_chinast_1, copy_chinast_2, copy_chinast_3} + function lseek(fd: number, offset: number, whence?: WhenceType): number { return FileIoImpl.lseekSync(fd, offset, whence); } @@ -1312,13 +1369,15 @@ export interface RandomAccessFile { setFilePointer(filePointer: number): void; close(): void; - write(buffer: ArrayBuffer | string, options?: WriteOptions): Promise; - write(buffer: ArrayBuffer | string, callback: AsyncCallback): void; - write(buffer: ArrayBuffer | string, options: WriteOptions, callback: AsyncCallback): void; + write_chinast_1(buffer: ArrayBuffer | string, options?: WriteOptions): Promise; + write_chinast_2(buffer: ArrayBuffer | string, callback: AsyncCallback): void; + write_chinast_3(buffer: ArrayBuffer | string, options: WriteOptions, callback: AsyncCallback): void; + overload write { write_chinast_1, write_chinast_2,write_chinast_3 }; writeSync(buffer: ArrayBuffer | string, options?: WriteOptions): number; - read(buffer: ArrayBuffer, options?: ReadOptions): Promise; - read(buffer: ArrayBuffer, callback: AsyncCallback): void; - read(buffer: ArrayBuffer, options: ReadOptions, callback: AsyncCallback): void; + read_chinast_1(buffer: ArrayBuffer, options?: ReadOptions): Promise; + read_chinast_2(buffer: ArrayBuffer, callback: AsyncCallback): void; + read_chinast_3(buffer: ArrayBuffer, options: ReadOptions, callback: AsyncCallback): void; + overload read { read_chinast_1, read_chinast_2,read_chinast_3 }; readSync(buffer: ArrayBuffer, options?: ReadOptions): number; getReadStream(): ReadStream; getWriteStream(): WriteStream; @@ -1353,7 +1412,7 @@ export class RandomAccessFileInner implements RandomAccessFile { native writeSync0(buffer: ArrayBuffer | string, options?: WriteOptions): number; - write(buffer: ArrayBuffer | string, options?: WriteOptions): Promise { + write_chinast_1(buffer: ArrayBuffer | string, options?: WriteOptions): Promise { return new Promise((resolve: (result: number) => void, reject: (e: BusinessError) => void) => { let promise = taskpool.execute((buffer: ArrayBuffer | string, options?: WriteOptions): number => { return this.writeSync(buffer, options); @@ -1367,7 +1426,7 @@ export class RandomAccessFileInner implements RandomAccessFile { }); } - write(buffer: ArrayBuffer | string, options: WriteOptions, callback: AsyncCallback): void { + write_chinast_3(buffer: ArrayBuffer | string, options: WriteOptions, callback: AsyncCallback): void { let promise = taskpool.execute((buffer: ArrayBuffer | string, options: WriteOptions): number => { return this.writeSync(buffer, options); }, buffer, options); @@ -1381,7 +1440,7 @@ export class RandomAccessFileInner implements RandomAccessFile { }); } - write(buffer: ArrayBuffer | string, callback: AsyncCallback): void { + write_chinast_2(buffer: ArrayBuffer | string, callback: AsyncCallback): void { let promise = taskpool.execute((buffer: ArrayBuffer | string): number => { return this.writeSync(buffer); }, buffer); @@ -1395,6 +1454,8 @@ export class RandomAccessFileInner implements RandomAccessFile { }); } + overload write {write_chinast_1, write_chinast_2, write_chinast_3} + readSync(buffer: ArrayBuffer, options?: ReadOptions): number { const length = options ? this.readSync0(buffer, options) : this.readSync0(buffer); this.filePointer += (options?.offset?? 0) + length; @@ -1403,7 +1464,7 @@ export class RandomAccessFileInner implements RandomAccessFile { native readSync0(buffer: ArrayBuffer, options?: ReadOptions): number; - read(buffer: ArrayBuffer, options?: ReadOptions): Promise { + read_chinast_1(buffer: ArrayBuffer, options?: ReadOptions): Promise { return new Promise((resolve: (result: number) => void, reject: (e: BusinessError) => void) => { let promise = taskpool.execute((buffer: ArrayBuffer, options?: ReadOptions): number => { return this.readSync(buffer, options); @@ -1417,7 +1478,7 @@ export class RandomAccessFileInner implements RandomAccessFile { }); } - read(buffer: ArrayBuffer, options: ReadOptions, callback: AsyncCallback): void { + read_chinast_3(buffer: ArrayBuffer, options: ReadOptions, callback: AsyncCallback): void { let promise = taskpool.execute((buffer: ArrayBuffer, options: ReadOptions): number => { return this.readSync(buffer, options); }, buffer, options); @@ -1431,7 +1492,7 @@ export class RandomAccessFileInner implements RandomAccessFile { }); } - read(buffer: ArrayBuffer, callback: AsyncCallback): void { + read_chinast_2(buffer: ArrayBuffer, callback: AsyncCallback): void { let promise = taskpool.execute((buffer: ArrayBuffer): number => { return this.readSync(buffer); }, buffer); @@ -1444,6 +1505,7 @@ export class RandomAccessFileInner implements RandomAccessFile { callback(e as BusinessError, 0); }); } + overload read {read_chinast_1, read_chinast_2, read_chinast_3} native getReadStream(): ReadStream; native getWriteStream(): WriteStream; diff --git a/interfaces/kits/js/src/mod_hash/ani/ets/@ohos.file.hash.ets b/interfaces/kits/js/src/mod_hash/ani/ets/@ohos.file.hash.ets index c9b4d5840c1d53fd46ad87299c377187d33f7612..fe8a2a91327e9cf72750d6cc066c2baef6da14aa 100644 --- a/interfaces/kits/js/src/mod_hash/ani/ets/@ohos.file.hash.ets +++ b/interfaces/kits/js/src/mod_hash/ani/ets/@ohos.file.hash.ets @@ -17,7 +17,7 @@ import { BusinessError, AsyncCallback } from '@ohos.base'; import stream from '@ohos.util.stream'; export default namespace hash { - export function hash(path: string, algorithm: string): Promise { + export function hash_chinast_1(path: string, algorithm: string): Promise { return new Promise((resolve: (result: string) => void, reject: (e: BusinessError) => void) => { let promise = taskpool.execute(HashImpl.hashSync, path, algorithm); promise.then((ret: NullishType): void => { @@ -29,7 +29,7 @@ export default namespace hash { }); } - export function hash(path: string, algorithm: string, callback: AsyncCallback): void { + export function hash_chinast_2(path: string, algorithm: string, callback: AsyncCallback): void { let promise = taskpool.execute(HashImpl.hashSync, path, algorithm); promise.then((ret: NullishType) => { let e = new BusinessError(); @@ -41,6 +41,8 @@ export default namespace hash { }); } + overload hash {hash_chinast_1,hash_chinast_2} + export function createHash(algorithm: string): HashStream { return new HashStream(algorithm); } diff --git a/interfaces/kits/js/src/mod_securitylabel/ani/ets/@ohos.file.securityLabel.ets b/interfaces/kits/js/src/mod_securitylabel/ani/ets/@ohos.file.securityLabel.ets index 4f81cef3d8fc0f2c702d436507c7493149fb2cfb..76f00bdc638cbdd465abc71ed898e5be41ea7e8b 100644 --- a/interfaces/kits/js/src/mod_securitylabel/ani/ets/@ohos.file.securityLabel.ets +++ b/interfaces/kits/js/src/mod_securitylabel/ani/ets/@ohos.file.securityLabel.ets @@ -18,7 +18,7 @@ import { BusinessError, AsyncCallback } from '@ohos.base'; namespace securityLabel { export type DataLevel = 's0' | 's1' | 's2' | 's3' | 's4'; - export function setSecurityLabel(path: string, type: DataLevel): Promise { + export function setSecurityLabel_chinast_1(path: string, type: DataLevel): Promise { return new Promise((resolve: (result: undefined) => void, reject: (e: BusinessError) => void): void => { let promise = taskpool.execute((path: string, type: DataLevel): void => SecurityLabelImpl.setSecurityLabelSync(path, type), path, type); promise.then((ret: NullishType): void => { @@ -29,7 +29,7 @@ namespace securityLabel { }); } - export function setSecurityLabel(path: string, type: DataLevel, callback: AsyncCallback): void { + export function setSecurityLabel_chinast_2(path: string, type: DataLevel, callback: AsyncCallback): void { let promise = taskpool.execute((path: string, type: DataLevel): void => SecurityLabelImpl.setSecurityLabelSync(path, type), path, type); promise.then((ret: NullishType): void => { let e = new BusinessError(); @@ -40,11 +40,13 @@ namespace securityLabel { }); } + overload setSecurityLabel {setSecurityLabel_chinast_1, setSecurityLabel_chinast_2} + export function setSecurityLabelSync(path: string, type: DataLevel): void { return SecurityLabelImpl.setSecurityLabelSync(path, type); } - export function getSecurityLabel(path: string): Promise { + export function getSecurityLabel_chinast_1(path: string): Promise { return new Promise((resolve: (result: string) => void, reject: (e: BusinessError) => void): void => { let promise = taskpool.execute((path: string): string => SecurityLabelImpl.getSecurityLabelSync(path), path); promise.then((ret: NullishType): void => { @@ -56,7 +58,7 @@ namespace securityLabel { }); } - export function getSecurityLabel(path: string, callback: AsyncCallback): void { + export function getSecurityLabel_chinast_2(path: string, callback: AsyncCallback): void { let promise = taskpool.execute((path: string): string => SecurityLabelImpl.getSecurityLabelSync(path), path); promise.then((ret: NullishType): void => { let e = new BusinessError(); @@ -68,6 +70,8 @@ namespace securityLabel { }); } + overload getSecurityLabel {getSecurityLabel_chinast_1, getSecurityLabel_chinast_2} + export function getSecurityLabelSync(path: string): string { return SecurityLabelImpl.getSecurityLabelSync(path); } diff --git a/interfaces/kits/js/src/mod_statvfs/ani/ets/@ohos.file.statvfs.ets b/interfaces/kits/js/src/mod_statvfs/ani/ets/@ohos.file.statvfs.ets index f3c569c80543f18810ca4e4c0e31a8ff0fe81b7a..97fb931533ce2fcce041bcf2e692093f2f388f4e 100644 --- a/interfaces/kits/js/src/mod_statvfs/ani/ets/@ohos.file.statvfs.ets +++ b/interfaces/kits/js/src/mod_statvfs/ani/ets/@ohos.file.statvfs.ets @@ -20,7 +20,7 @@ namespace statfs { return StatvfsImpl.getFreeSizeSync(path); } - export function getFreeSize(path: string): Promise { + export function getFreeSize_chinast_1(path: string): Promise { return new Promise((resolve: (result: number) => void, reject: (e: BusinessError) => void): void => { let promise = taskpool.execute(StatvfsImpl.getFreeSizeSync, path); promise.then((ret: NullishType): void => { @@ -32,7 +32,7 @@ namespace statfs { }); } - export function getFreeSize(path: string, callback: AsyncCallback): void { + export function getFreeSize_chinast_2(path: string, callback: AsyncCallback): void { let promise = taskpool.execute(StatvfsImpl.getFreeSizeSync, path); promise.then((ret: NullishType): void => { let e = new BusinessError(); @@ -44,11 +44,13 @@ namespace statfs { }); } + overload getFreeSize {getFreeSize_chinast_1,getFreeSize_chinast_2} + export function getTotalSizeSync(path: string): number { return StatvfsImpl.getTotalSizeSync(path); } - export function getTotalSize(path: string): Promise { + export function getTotalSize_chinast_1(path: string): Promise { return new Promise((resolve: (result: number) => void, reject: (e: BusinessError) => void): void => { let promise = taskpool.execute(StatvfsImpl.getTotalSizeSync, path); promise.then((ret: NullishType): void => { @@ -60,7 +62,7 @@ namespace statfs { }); } - export function getTotalSize(path: string, callback: AsyncCallback): void { + export function getTotalSize_chinast_2(path: string, callback: AsyncCallback): void { let promise = taskpool.execute(StatvfsImpl.getTotalSizeSync, path); promise.then((ret: NullishType): void => { let e = new BusinessError(); @@ -71,6 +73,8 @@ namespace statfs { callback(e as BusinessError, 0); }); } + + overload getTotalSize {getTotalSize_chinast_1,getTotalSize_chinast_2} } export default statfs;