diff --git a/api/@ohos.file.fs.d.ts b/api/@ohos.file.fs.d.ts index eb6ddfa720b04c712cdd16f86a406c89a561999f..9bd22d71bbf6f15f1938c4708c2fa1d66d70dea1 100644 --- a/api/@ohos.file.fs.d.ts +++ b/api/@ohos.file.fs.d.ts @@ -21,8 +21,6 @@ import { AsyncCallback } from './@ohos.base'; import stream from './@ohos.util.stream'; -export default fileIo; - /** * FileIO * @@ -54,93 +52,11 @@ export default fileIo; * @syscap SystemCapability.FileManagement.File.FileIO * @crossplatform * @atomicservice - * @since 12 + * @since {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 */ declare namespace fileIo { - export { access }; - export { accessSync }; - export { close }; - export { closeSync }; - export { copy }; - export { copyDir }; - export { copyDirSync }; - export { copyFile }; - export { copyFileSync }; - export { createRandomAccessFile }; - export { createRandomAccessFileSync }; - export { createStream }; - export { createStreamSync }; - export { createReadStream }; - export { createWriteStream }; - export { createWatcher }; - export { dup }; - export { fdatasync }; - export { fdatasyncSync }; - export { fdopenStream }; - export { fdopenStreamSync }; - export { fsync }; - export { fsyncSync }; - export { getxattr }; - export { getxattrSync }; - export { listFile }; - export { listFileSync }; - export { lseek }; - export { lstat }; - export { lstatSync }; - export { mkdir }; - export { mkdirSync }; - export { mkdtemp }; - export { mkdtempSync }; - export { moveDir }; - export { moveDirSync }; - export { moveFile }; - export { moveFileSync }; - export { open }; - export { openSync }; - export { read }; - export { readSync }; - export { readLines }; - export { readLinesSync }; - export { readText }; - export { readTextSync }; - export { rename }; - export { renameSync }; - export { rmdir }; - export { rmdirSync }; - export { setxattr }; - export { setxattrSync }; - export { stat }; - export { statSync }; - export { symlink }; - export { symlinkSync }; - export { truncate }; - export { truncateSync }; - export { unlink }; - export { unlinkSync }; - export { utimes }; - export { write }; - export { writeSync }; - export { AccessModeType }; - export { AccessFlagType }; - export { File }; - export { OpenMode }; - export { RandomAccessFile }; - export { ReaderIterator }; - export { Stat }; - export { Stream }; - export { ReadStream }; - export { WriteStream }; - export { AtomicFile }; - export { Watcher }; - export { WhenceType }; - export { TaskSignal }; - export { connectDfs }; - export { disconnectDfs }; - export type { Progress }; - export type { CopyOptions }; - export type { ProgressListener }; - export type { DfsListeners }; - + /** * Mode Indicates the open flags. * @@ -163,7 +79,8 @@ declare namespace fileIo { * @syscap SystemCapability.FileManagement.File.FileIO * @crossplatform * @atomicservice - * @since 11 + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 */ namespace OpenMode { /** @@ -188,7 +105,8 @@ declare namespace fileIo { * @syscap SystemCapability.FileManagement.File.FileIO * @crossplatform * @atomicservice - * @since 11 + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 */ const READ_ONLY = 0o0; /** @@ -213,7 +131,8 @@ declare namespace fileIo { * @syscap SystemCapability.FileManagement.File.FileIO * @crossplatform * @atomicservice - * @since 11 + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 */ const WRITE_ONLY = 0o1; /** @@ -238,7 +157,8 @@ declare namespace fileIo { * @syscap SystemCapability.FileManagement.File.FileIO * @crossplatform * @atomicservice - * @since 11 + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 */ const READ_WRITE = 0o2; /** @@ -263,7 +183,8 @@ declare namespace fileIo { * @syscap SystemCapability.FileManagement.File.FileIO * @crossplatform * @atomicservice - * @since 11 + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 */ const CREATE = 0o100; /** @@ -288,7 +209,8 @@ declare namespace fileIo { * @syscap SystemCapability.FileManagement.File.FileIO * @crossplatform * @atomicservice - * @since 11 + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 */ const TRUNC = 0o1000; /** @@ -313,7 +235,8 @@ declare namespace fileIo { * @syscap SystemCapability.FileManagement.File.FileIO * @crossplatform * @atomicservice - * @since 11 + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 */ const APPEND = 0o2000; /** @@ -329,7 +252,8 @@ declare namespace fileIo { * @constant * @syscap SystemCapability.FileManagement.File.FileIO * @crossplatform - * @since 10 + * @since {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 */ const NONBLOCK = 0o4000; /** @@ -345,7 +269,8 @@ declare namespace fileIo { * @constant * @syscap SystemCapability.FileManagement.File.FileIO * @crossplatform - * @since 10 + * @since {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 */ const DIR = 0o200000; /** @@ -377,6452 +302,4215 @@ declare namespace fileIo { * @constant * @syscap SystemCapability.FileManagement.File.FileIO * @crossplatform - * @since 10 + * @since {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 */ const SYNC = 0o4010000; } -} - -/** - * Access file. - * - * @param { string } path - path. - * @returns { Promise } return Promise - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900023 - Text file busy - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 - */ -/** - * Access file. - * - * @param { string } path - path. - * @returns { Promise } Returns the file is accessible or not in promise mode. - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900023 - Text file busy - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @since 10 - */ -/** - * Access file. - * - * @param { string } path - path. - * @returns { Promise } Returns the file is accessible or not in promise mode. - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900023 - Text file busy - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice - * @since 11 - */ -/** - * Access file. - * - * @param { string } path - path. - * @param { AccessModeType } [mode = fs.AccessModeType.EXIST] - accessibility mode. - * @returns { Promise } Returns the file is accessible or not in promise mode. - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900023 - Text file busy - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice - * @since 12 - */ -declare function access(path: string, mode?: AccessModeType): Promise; - -/** - * Access file. - * - * @param { string } path - path. - * @param { AsyncCallback } callback - The callback is used to return the file is accessible or not. - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900023 - Text file busy - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 - */ -/** - * Access file. - * - * @param { string } path - path. - * @param { AsyncCallback } callback - The callback is used to return the file is accessible or not. - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900023 - Text file busy - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @since 10 - */ -/** - * Access file. - * - * @param { string } path - path. - * @param { AsyncCallback } callback - The callback is used to return the file is accessible or not. - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900023 - Text file busy - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice - * @since 11 - */ -declare function access(path: string, callback: AsyncCallback): void; - -/** - * Access file. - * - * @param { string } path - file path that needs to be checked whether the calling process can access. - * @param { AccessModeType } mode - accessibility mode. - * @param { AccessFlagType } flag - accessibility flag. - * @returns { Promise } Returns the file is accessible or not in promise mode. - * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; - *
2.Incorrect parameter types. - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900023 - Text file busy - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 12 - */ -declare function access(path: string, mode: AccessModeType, flag: AccessFlagType): Promise; -/** - * Access file with sync interface. - * - * @param { string } path - path. - * @returns { boolean } Returns the file is accessible or not. - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900023 - Text file busy - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 - */ -/** - * Access file with sync interface. - * - * @param { string } path - path. - * @returns { boolean } Returns the file is accessible or not. - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900023 - Text file busy - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @since 10 - */ -/** - * Access file with sync interface. - * - * @param { string } path - path. - * @returns { boolean } Returns the file is accessible or not. - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900023 - Text file busy - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice - * @since 11 - */ -/** - * - * Access file with sync interface. - * - * @param { string } path - path. - * @param { AccessModeType } [mode = fs.AccessModeType.EXIST] - accessibility mode. - * @returns { boolean } Returns the file is accessible or not. - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900023 - Text file busy - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice - * @since 12 - */ -declare function accessSync(path: string, mode?: AccessModeType): boolean; + /** + * Access file. + * + * @param { string } path - path. + * @returns { Promise } return Promise + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900023 - Text file busy + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + /** + * Access file. + * + * @param { string } path - path. + * @returns { Promise } Returns the file is accessible or not in promise mode. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900023 - Text file busy + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ + /** + * Access file. + * + * @param { string } path - path. + * @returns { Promise } Returns the file is accessible or not in promise mode. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900023 - Text file busy + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * Access file. + * + * @param { string } path - path. + * @param { AccessModeType } [mode = fs.AccessModeType.EXIST] - accessibility mode. + * @returns { Promise } Returns the file is accessible or not in promise mode. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900023 - Text file busy + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 + */ + function access(path: string, mode?: AccessModeType): Promise; -/** - * Access file with sync interface. - * - * @param { string } path - file path that needs to be checked whether the calling process can access. - * @param { AccessModeType } mode - accessibility mode. - * @param { AccessFlagType } flag - accessibility flag. - * @returns { boolean } Returns the file is accessible or not. - * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; - *
2.Incorrect parameter types. - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900023 - Text file busy - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 12 - */ -declare function accessSync(path: string, mode: AccessModeType, flag: AccessFlagType): boolean; + /** + * Access file. + * + * @param { string } path - path. + * @param { AsyncCallback } callback - The callback is used to return the file is accessible or not. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900023 - Text file busy + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + /** + * Access file. + * + * @param { string } path - path. + * @param { AsyncCallback } callback - The callback is used to return the file is accessible or not. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900023 - Text file busy + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ + /** + * Access file. + * + * @param { string } path - path. + * @param { AsyncCallback } callback - The callback is used to return the file is accessible or not. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900023 - Text file busy + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 + */ + function access(path: string, callback: AsyncCallback): void; -/** - * Close file or fd. - * - * @param { number | File } file - file object or fd. - * @returns { Promise } The promise returned by the function. - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 - */ -/** - * Close file or fd. - * - * @param { number | File } file - file object or fd. - * @returns { Promise } The promise returned by the function. - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @since 10 - */ -/** - * Close file or fd. - * - * @param { number | File } file - file object or fd. - * @returns { Promise } The promise returned by the function. - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice - * @since 11 - */ -declare function close(file: number | File): Promise; + /** + * Access file. + * + * @param { string } path - file path that needs to be checked whether the calling process can access. + * @param { AccessModeType } mode - accessibility mode. + * @param { AccessFlagType } flag - accessibility flag. + * @returns { Promise } Returns the file is accessible or not in promise mode. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameter types. + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900023 - Text file busy + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 + */ + function access(path: string, mode: AccessModeType, flag: AccessFlagType): Promise; -/** - * Close file or fd. - * - * @param { number | File } file - file object or fd. - * @param { AsyncCallback } callback - Return the callback function. - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 - */ -/** - * Close file or fd. - * - * @param { number | File } file - file object or fd. - * @param { AsyncCallback } callback - Return the callback function. - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @since 10 - */ -/** - * Close file or fd. - * - * @param { number | File } file - file object or fd. - * @param { AsyncCallback } callback - Return the callback function. - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice - * @since 11 - */ -declare function close(file: number | File, callback: AsyncCallback): void; - -/** - * Close file or fd with sync interface. - * - * @param { number | File } file - file object or fd. - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 - */ -/** - * Close file or fd with sync interface. - * - * @param { number | File } file - file object or fd. - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @since 10 - */ -/** - * Close file or fd with sync interface. - * - * @param { number | File } file - file object or fd. - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice - * @since 11 - */ -declare function closeSync(file: number | File): void; - -/** - * Copy file or directory. - * - * @param { string } srcUri - src uri. - * @param { string } destUri - dest uri. - * @param { CopyOptions } [options] - options. - * @returns { Promise } The promise returned by the function. - * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; - *
2.Incorrect parameter types. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900010 - Try again - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied by the file system - * @throws { BusinessError } 13900015 - File exists - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900021 - File table overflow - * @throws { BusinessError } 13900022 - Too many open files - * @throws { BusinessError } 13900024 - File too large - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900027 - Read-only file system - * @throws { BusinessError } 13900028 - Too many links - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900031 - Function not implemented - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900038 - Value too large for defined data type - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 11 - */ -/** - * Copy file or directory. - * - * @param { string } srcUri - src uri. - * @param { string } destUri - dest uri. - * @param { CopyOptions } [options] - options. - * @returns { Promise } The promise returned by the function. - * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; - *
2.Incorrect parameter types. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900010 - Try again - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied by the file system - * @throws { BusinessError } 13900015 - File exists - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900021 - File table overflow - * @throws { BusinessError } 13900022 - Too many open files - * @throws { BusinessError } 13900024 - File too large - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900027 - Read-only file system - * @throws { BusinessError } 13900028 - Too many links - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900031 - Function not implemented - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900038 - Value too large for defined data type - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @throws { BusinessError } 13900044 - Network is unreachable - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 12 - */ -declare function copy(srcUri: string, destUri: string, options?: CopyOptions): Promise; + /** + * Access file with sync interface. + * + * @param { string } path - path. + * @returns { boolean } Returns the file is accessible or not. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900023 - Text file busy + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + /** + * Access file with sync interface. + * + * @param { string } path - path. + * @returns { boolean } Returns the file is accessible or not. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900023 - Text file busy + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ + /** + * Access file with sync interface. + * + * @param { string } path - path. + * @returns { boolean } Returns the file is accessible or not. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900023 - Text file busy + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * + * Access file with sync interface. + * + * @param { string } path - path. + * @param { AccessModeType } [mode = fs.AccessModeType.EXIST] - accessibility mode. + * @returns { boolean } Returns the file is accessible or not. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900023 - Text file busy + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 + */ + function accessSync(path: string, mode?: AccessModeType): boolean; -/** - * Copy file or directory. - * - * @param { string } srcUri - src uri. - * @param { string } destUri - dest uri. - * @param { AsyncCallback } callback - Return the callback function. - * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; - *
2.Incorrect parameter types. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900010 - Try again - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied by the file system - * @throws { BusinessError } 13900015 - File exists - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900021 - File table overflow - * @throws { BusinessError } 13900022 - Too many open files - * @throws { BusinessError } 13900024 - File too large - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900027 - Read-only file system - * @throws { BusinessError } 13900028 - Too many links - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900031 - Function not implemented - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900038 - Value too large for defined data type - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 11 - */ -declare function copy(srcUri: string, destUri: string, callback: AsyncCallback): void; + /** + * Access file with sync interface. + * + * @param { string } path - file path that needs to be checked whether the calling process can access. + * @param { AccessModeType } mode - accessibility mode. + * @param { AccessFlagType } flag - accessibility flag. + * @returns { boolean } Returns the file is accessible or not. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameter types. + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900023 - Text file busy + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 + */ + function accessSync(path: string, mode: AccessModeType, flag: AccessFlagType): boolean; -/** - * Copy file or directory. - * - * @param { string } srcUri - src uri. - * @param { string } destUri - dest uri. - * @param { CopyOptions } options - options. - * @param { AsyncCallback } callback - Return the callback function. - * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; - *
2.Incorrect parameter types. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900010 - Try again - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied by the file system - * @throws { BusinessError } 13900015 - File exists - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900021 - File table overflow - * @throws { BusinessError } 13900022 - Too many open files - * @throws { BusinessError } 13900024 - File too large - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900027 - Read-only file system - * @throws { BusinessError } 13900028 - Too many links - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900031 - Function not implemented - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900038 - Value too large for defined data type - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 11 - */ -declare function copy(srcUri: string, destUri: string, options: CopyOptions, callback: AsyncCallback): void; + /** + * Close file or fd. + * + * @param { number | File } file - file object or fd. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + /** + * Close file or fd. + * + * @param { number | File } file - file object or fd. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ + /** + * Close file or fd. + * + * @param { number | File } file - file object or fd. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 + */ + function close(file: number | File): Promise; -/** - * Copy directory. - * - * @param { string } src - source path. - * @param { string } dest - destination path. - * @param { number } [mode = 0] - mode. - * @returns { Promise } The promise returned by the function. - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900010 - Try again - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900031 - Function not implemented - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900038 - Value too large for defined data type - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 10 - */ -/** - * Copy directory. - * - * @param { string } src - source path. - * @param { string } dest - destination path. - * @param { number } [mode = 0] - mode. - * @returns { Promise } The promise returned by the function. - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900010 - Try again - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900031 - Function not implemented - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900038 - Value too large for defined data type - * @throws { BusinessError } 13900042 - Unknown error - * @throws { BusinessError } 13900044 - Network is unreachable - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 12 - */ -declare function copyDir(src: string, dest: string, mode?: number): Promise; + /** + * Close file or fd. + * + * @param { number | File } file - file object or fd. + * @param { AsyncCallback } callback - Return the callback function. + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + /** + * Close file or fd. + * + * @param { number | File } file - file object or fd. + * @param { AsyncCallback } callback - Return the callback function. + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ + /** + * Close file or fd. + * + * @param { number | File } file - file object or fd. + * @param { AsyncCallback } callback - Return the callback function. + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 + */ + function close(file: number | File, callback: AsyncCallback): void; -/** - * Copy directory. - * - * @param { string } src - source path. - * @param { string } dest - destination path. - * @param { AsyncCallback } callback - Return the callback function. - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900010 - Try again - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900031 - Function not implemented - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900038 - Value too large for defined data type - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 10 - */ -declare function copyDir(src: string, dest: string, callback: AsyncCallback): void; - -/** - * Copy directory. - * - * @param { string } src - source path. - * @param { string } dest - destination path. - * @param { AsyncCallback> } callback - Return the callback function. - * @throws { BusinessError } 13900015 - File exists - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 10 - */ -declare function copyDir(src: string, dest: string, callback: AsyncCallback>): void; + /** + * Close file or fd with sync interface. + * + * @param { number | File } file - file object or fd. + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + /** + * Close file or fd with sync interface. + * + * @param { number | File } file - file object or fd. + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ + /** + * Close file or fd with sync interface. + * + * @param { number | File } file - file object or fd. + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 + */ + function closeSync(file: number | File): void; + /** + * Copy file or directory. + * + * @param { string } srcUri - src uri. + * @param { string } destUri - dest uri. + * @param { CopyOptions } [options] - options. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameter types. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied by the file system + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900021 - File table overflow + * @throws { BusinessError } 13900022 - Too many open files + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900028 - Too many links + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900031 - Function not implemented + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 11 + */ + /** + * Copy file or directory. + * + * @param { string } srcUri - src uri. + * @param { string } destUri - dest uri. + * @param { CopyOptions } [options] - options. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameter types. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied by the file system + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900021 - File table overflow + * @throws { BusinessError } 13900022 - Too many open files + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900028 - Too many links + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900031 - Function not implemented + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @throws { BusinessError } 13900044 - Network is unreachable + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 + */ + function copy(srcUri: string, destUri: string, options?: CopyOptions): Promise; -/** - * Copy directory. - * - * @param { string } src - source path. - * @param { string } dest - destination path. - * @param { number } mode - mode. - * @param { AsyncCallback } callback - Return the callback function. - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900010 - Try again - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900031 - Function not implemented - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900038 - Value too large for defined data type - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 10 - */ -declare function copyDir(src: string, dest: string, mode: number, callback: AsyncCallback): void; + /** + * Copy file or directory. + * + * @param { string } srcUri - src uri. + * @param { string } destUri - dest uri. + * @param { AsyncCallback } callback - Return the callback function. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameter types. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied by the file system + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900021 - File table overflow + * @throws { BusinessError } 13900022 - Too many open files + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900028 - Too many links + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900031 - Function not implemented + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 + */ + function copy(srcUri: string, destUri: string, callback: AsyncCallback): void; -/** - * Copy directory. - * - * @param { string } src - source path. - * @param { string } dest - destination path. - * @param { number } mode - mode. - * @param { AsyncCallback> } callback - Return the callback function. - * @throws { BusinessError } 13900015 - File exists - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 10 - */ -declare function copyDir(src: string, dest: string, mode: number, callback: AsyncCallback>): void; + /** + * Copy file or directory. + * + * @param { string } srcUri - src uri. + * @param { string } destUri - dest uri. + * @param { CopyOptions } options - options. + * @param { AsyncCallback } callback - Return the callback function. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameter types. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied by the file system + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900021 - File table overflow + * @throws { BusinessError } 13900022 - Too many open files + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900028 - Too many links + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900031 - Function not implemented + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 + */ + function copy(srcUri: string, destUri: string, options: CopyOptions, callback: AsyncCallback): void; -/** - * Copy directory with sync interface. - * - * @param { string } src - source path. - * @param { string } dest - destination path. - * @param { number } [mode = 0] - mode. - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900010 - Try again - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900015 - File exists - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900031 - Function not implemented - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900038 - Value too large for defined data type - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 10 - */ -/** - * Copy directory with sync interface. - * - * @param { string } src - source path. - * @param { string } dest - destination path. - * @param { number } [mode = 0] - mode. - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900010 - Try again - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900015 - File exists - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900031 - Function not implemented - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900038 - Value too large for defined data type - * @throws { BusinessError } 13900042 - Unknown error - * @throws { BusinessError } 13900044 - Network is unreachable - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 12 - */ -declare function copyDirSync(src: string, dest: string, mode?: number): void; + /** + * Copy directory. + * + * @param { string } src - source path. + * @param { string } dest - destination path. + * @param { number } [mode = 0] - mode. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900031 - Function not implemented + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 10 + */ + /** + * Copy directory. + * + * @param { string } src - source path. + * @param { string } dest - destination path. + * @param { number } [mode = 0] - mode. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900031 - Function not implemented + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900042 - Unknown error + * @throws { BusinessError } 13900044 - Network is unreachable + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 + */ + function copyDir(src: string, dest: string, mode?: number): Promise; -/** - * Copy file. - * - * @param { string | number } src - src. - * @param { string | number } dest - dest. - * @param { number } [mode = 0] - mode. - * @returns { Promise } The promise returned by the function. - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900010 - Try again - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900031 - Function not implemented - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900038 - Value too large for defined data type - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 - */ -/** - * Copy file. - * - * @param { string | number } src - src. - * @param { string | number } dest - dest. - * @param { number } [mode = 0] - mode. - * @returns { Promise } The promise returned by the function. - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900010 - Try again - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900031 - Function not implemented - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900038 - Value too large for defined data type - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @since 10 - */ -/** - * Copy file. - * - * @param { string | number } src - src. - * @param { string | number } dest - dest. - * @param { number } [mode = 0] - mode. - * @returns { Promise } The promise returned by the function. - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900010 - Try again - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900031 - Function not implemented - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900038 - Value too large for defined data type - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice - * @since 11 - */ -/** - * Copy file. - * - * @param { string | number } src - src. - * @param { string | number } dest - dest. - * @param { number } [mode = 0] - mode. - * @returns { Promise } The promise returned by the function. - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900010 - Try again - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900031 - Function not implemented - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900038 - Value too large for defined data type - * @throws { BusinessError } 13900042 - Unknown error - * @throws { BusinessError } 13900044 - Network is unreachable - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice - * @since 12 - */ -declare function copyFile(src: string | number, dest: string | number, mode?: number): Promise; + /** + * Copy directory. + * + * @param { string } src - source path. + * @param { string } dest - destination path. + * @param { AsyncCallback } callback - Return the callback function. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900031 - Function not implemented + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 + */ + function copyDir(src: string, dest: string, callback: AsyncCallback): void; -/** - * Copy file. - * - * @param { string | number } src - src. - * @param { string | number } dest - dest. - * @param { AsyncCallback } callback - Return the callback function. - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900010 - Try again - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900031 - Function not implemented - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900038 - Value too large for defined data type - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 - */ -/** - * Copy file. - * - * @param { string | number } src - src. - * @param { string | number } dest - dest. - * @param { AsyncCallback } callback - Return the callback function. - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900010 - Try again - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900031 - Function not implemented - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900038 - Value too large for defined data type - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @since 10 - */ -/** - * Copy file. - * - * @param { string | number } src - src. - * @param { string | number } dest - dest. - * @param { AsyncCallback } callback - Return the callback function. - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900010 - Try again - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900031 - Function not implemented - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900038 - Value too large for defined data type - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice - * @since 11 - */ -declare function copyFile(src: string | number, dest: string | number, callback: AsyncCallback): void; + /** + * Copy directory. + * + * @param { string } src - source path. + * @param { string } dest - destination path. + * @param { AsyncCallback> } callback - Return the callback function. + * @throws { BusinessError } 13900015 - File exists + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 + */ + function copyDir(src: string, dest: string, callback: AsyncCallback>): void; -/** - * Copy file. - * - * @param { string | number } src - src. - * @param { string | number } dest - dest. - * @param { number } [mode = 0] - mode. - * @param { AsyncCallback } callback - Return the callback function. - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900010 - Try again - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900031 - Function not implemented - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900038 - Value too large for defined data type - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 - */ -/** - * Copy file. - * - * @param { string | number } src - src. - * @param { string | number } dest - dest. - * @param { number } [mode = 0] - mode. - * @param { AsyncCallback } callback - Return the callback function. - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900010 - Try again - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900031 - Function not implemented - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900038 - Value too large for defined data type - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @since 10 - */ -/** - * Copy file. - * - * @param { string | number } src - src. - * @param { string | number } dest - dest. - * @param { number } [mode = 0] - mode. - * @param { AsyncCallback } callback - Return the callback function. - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900010 - Try again - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900031 - Function not implemented - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900038 - Value too large for defined data type - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice - * @since 11 - */ -declare function copyFile( - src: string | number, - dest: string | number, - mode: number, - callback: AsyncCallback -): void; -/** - * Copy file with sync interface. - * - * @param { string | number } src - src. - * @param { string | number } dest - dest. - * @param { number } [mode = 0] - mode. - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900010 - Try again - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900031 - Function not implemented - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900038 - Value too large for defined data type - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 - */ -/** - * Copy file with sync interface. - * - * @param { string | number } src - src. - * @param { string | number } dest - dest. - * @param { number } [mode = 0] - mode. - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900010 - Try again - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900031 - Function not implemented - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900038 - Value too large for defined data type - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @since 10 - */ -/** - * Copy file with sync interface. - * - * @param { string | number } src - src. - * @param { string | number } dest - dest. - * @param { number } [mode = 0] - mode. - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900010 - Try again - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900031 - Function not implemented - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900038 - Value too large for defined data type - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice - * @since 11 - */ -/** - * Copy file with sync interface. - * - * @param { string | number } src - src. - * @param { string | number } dest - dest. - * @param { number } [mode = 0] - mode. - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900010 - Try again - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900031 - Function not implemented - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900038 - Value too large for defined data type - * @throws { BusinessError } 13900042 - Unknown error - * @throws { BusinessError } 13900044 - Network is unreachable - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice - * @since 12 - */ -declare function copyFileSync(src: string | number, dest: string | number, mode?: number): void; - -/** - * Create class Stream. - * - * @param { string } path - path. - * @param { string } mode - mode. - * @returns { Promise } return Promise - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900006 - No such device or address - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900014 - Device or resource busy - * @throws { BusinessError } 13900015 - File exists - * @throws { BusinessError } 13900017 - No such device - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900022 - Too many open files - * @throws { BusinessError } 13900023 - Text file busy - * @throws { BusinessError } 13900024 - File too large - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900027 - Read-only file system - * @throws { BusinessError } 13900029 - Resource deadlock would occur - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900038 - Value too large for defined data type - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 - */ -/** - * Create class Stream. - * - * @param { string } path - path. - * @param { string } mode - mode. - * @returns { Promise } return Promise - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900006 - No such device or address - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900014 - Device or resource busy - * @throws { BusinessError } 13900015 - File exists - * @throws { BusinessError } 13900017 - No such device - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900022 - Too many open files - * @throws { BusinessError } 13900023 - Text file busy - * @throws { BusinessError } 13900024 - File too large - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900027 - Read-only file system - * @throws { BusinessError } 13900029 - Resource deadlock would occur - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900038 - Value too large for defined data type - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @throws { BusinessError } 13900044 - Network is unreachable - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 12 - */ -declare function createStream(path: string, mode: string): Promise; - -/** - * Create class Stream. - * - * @param { string } path - path. - * @param { string } mode - mode. - * @param { AsyncCallback } callback - callback. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900006 - No such device or address - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900014 - Device or resource busy - * @throws { BusinessError } 13900015 - File exists - * @throws { BusinessError } 13900017 - No such device - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900022 - Too many open files - * @throws { BusinessError } 13900023 - Text file busy - * @throws { BusinessError } 13900024 - File too large - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900027 - Read-only file system - * @throws { BusinessError } 13900029 - Resource deadlock would occur - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900038 - Value too large for defined data type - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 - */ -declare function createStream(path: string, mode: string, callback: AsyncCallback): void; - -/** - * Create class Stream with sync interface. - * - * @param { string } path - path. - * @param { string } mode - mode. - * @returns { Stream } createStream - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900006 - No such device or address - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900014 - Device or resource busy - * @throws { BusinessError } 13900015 - File exists - * @throws { BusinessError } 13900017 - No such device - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900022 - Too many open files - * @throws { BusinessError } 13900023 - Text file busy - * @throws { BusinessError } 13900024 - File too large - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900027 - Read-only file system - * @throws { BusinessError } 13900029 - Resource deadlock would occur - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900038 - Value too large for defined data type - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 - */ -/** - * Create class Stream with sync interface. - * - * @param { string } path - path. - * @param { string } mode - mode. - * @returns { Stream } createStream - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900006 - No such device or address - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900014 - Device or resource busy - * @throws { BusinessError } 13900015 - File exists - * @throws { BusinessError } 13900017 - No such device - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900022 - Too many open files - * @throws { BusinessError } 13900023 - Text file busy - * @throws { BusinessError } 13900024 - File too large - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900027 - Read-only file system - * @throws { BusinessError } 13900029 - Resource deadlock would occur - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900038 - Value too large for defined data type - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @throws { BusinessError } 13900044 - Network is unreachable - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 12 - */ -declare function createStreamSync(path: string, mode: string): Stream; - - -/** - * Create class RandomAccessFile. - * - * @param { string | File } file - file path, object. - * @param { number } [mode = OpenMode.READ_ONLY] - mode. - * @returns { Promise } Returns the RandomAccessFile object which has been created in promise mode. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900006 - No such device or address - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900014 - Device or resource busy - * @throws { BusinessError } 13900015 - File exists - * @throws { BusinessError } 13900017 - No such device - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900022 - Too many open files - * @throws { BusinessError } 13900023 - Text file busy - * @throws { BusinessError } 13900024 - File too large - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900027 - Read-only file system - * @throws { BusinessError } 13900029 - Resource deadlock would occur - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900038 - Value too large for defined data type - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 10 - */ -/** - * Create class RandomAccessFile. - * - * @param { string | File } file - file path, object. - * @param { number } [mode = OpenMode.READ_ONLY] - mode. - * @param { RandomAccessFileOptions } [options] - RandomAccessFile options - * @returns { Promise } Returns the RandomAccessFile object which has been created in promise mode. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900006 - No such device or address - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900014 - Device or resource busy - * @throws { BusinessError } 13900015 - File exists - * @throws { BusinessError } 13900017 - No such device - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900022 - Too many open files - * @throws { BusinessError } 13900023 - Text file busy - * @throws { BusinessError } 13900024 - File too large - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900027 - Read-only file system - * @throws { BusinessError } 13900029 - Resource deadlock would occur - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900038 - Value too large for defined data type - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @throws { BusinessError } 13900044 - Network is unreachable - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 12 - */ -declare function createRandomAccessFile(file: string | File, mode?: number, - options?: RandomAccessFileOptions): Promise; - -/** - * Create class RandomAccessFile. - * - * @param { string | File } file - file path, object. - * @param { AsyncCallback } callback - The callback is used to return the RandomAccessFile object which has been created. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900006 - No such device or address - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900014 - Device or resource busy - * @throws { BusinessError } 13900015 - File exists - * @throws { BusinessError } 13900017 - No such device - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900022 - Too many open files - * @throws { BusinessError } 13900023 - Text file busy - * @throws { BusinessError } 13900024 - File too large - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900027 - Read-only file system - * @throws { BusinessError } 13900029 - Resource deadlock would occur - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900038 - Value too large for defined data type - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 10 - */ -declare function createRandomAccessFile(file: string | File, callback: AsyncCallback): void; - -/** - * Create class RandomAccessFile. - * - * @param { string | File } file - file path, object. - * @param { number } [mode = OpenMode.READ_ONLY] - mode. - * @param { AsyncCallback } callback - The callback is used to return the RandomAccessFile object which has been created. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900006 - No such device or address - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900014 - Device or resource busy - * @throws { BusinessError } 13900015 - File exists - * @throws { BusinessError } 13900017 - No such device - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900022 - Too many open files - * @throws { BusinessError } 13900023 - Text file busy - * @throws { BusinessError } 13900024 - File too large - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900027 - Read-only file system - * @throws { BusinessError } 13900029 - Resource deadlock would occur - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900038 - Value too large for defined data type - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 10 - */ -declare function createRandomAccessFile(file: string | File, mode: number, callback: AsyncCallback): void; - -/** - * Create class RandomAccessFile with sync interface. - * - * @param { string | File } file - file path, object. - * @param { number } [mode = OpenMode.READ_ONLY] - mode. - * @returns { RandomAccessFile } Returns the RandomAccessFile object which has been created. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900006 - No such device or address - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900014 - Device or resource busy - * @throws { BusinessError } 13900015 - File exists - * @throws { BusinessError } 13900017 - No such device - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900022 - Too many open files - * @throws { BusinessError } 13900023 - Text file busy - * @throws { BusinessError } 13900024 - File too large - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900027 - Read-only file system - * @throws { BusinessError } 13900029 - Resource deadlock would occur - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900038 - Value too large for defined data type - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 10 - */ -/** - * Create class RandomAccessFile with sync interface. - * - * @param { string | File } file - file path, object. - * @param { number } [mode = OpenMode.READ_ONLY] - mode. - * @param { RandomAccessFileOptions } [options] - RandomAccessFile options - * @returns { RandomAccessFile } Returns the RandomAccessFile object which has been created. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900006 - No such device or address - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900014 - Device or resource busy - * @throws { BusinessError } 13900015 - File exists - * @throws { BusinessError } 13900017 - No such device - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900022 - Too many open files - * @throws { BusinessError } 13900023 - Text file busy - * @throws { BusinessError } 13900024 - File too large - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900027 - Read-only file system - * @throws { BusinessError } 13900029 - Resource deadlock would occur - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900038 - Value too large for defined data type - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @throws { BusinessError } 13900044 - Network is unreachable - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 12 - */ -declare function createRandomAccessFileSync(file: string | File, mode?: number, - options?: RandomAccessFileOptions): RandomAccessFile; - -/** - * Create file read stream. - * - * @param { string } path - file path. - * @param { ReadStreamOptions } [options] - Optional parameters for ReadStream. - * @returns { ReadStream } Returns the ReadStream object which has been created. - * @throws { BusinessError } 401 - Parameter error - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900017 - No such device - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900022 - Too many open files - * @throws { BusinessError } 13900024 - File too large - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900038 - Value too large for defined data type - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @throws { BusinessError } 13900044 - Network is unreachable - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 12 - */ -declare function createReadStream(path: string, options?: ReadStreamOptions): ReadStream; + /** + * Copy directory. + * + * @param { string } src - source path. + * @param { string } dest - destination path. + * @param { number } mode - mode. + * @param { AsyncCallback } callback - Return the callback function. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900031 - Function not implemented + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 + */ + function copyDir(src: string, dest: string, mode: number, callback: AsyncCallback): void; -/** - * Create file write stream. - * - * @param { string } path - file path. - * @param { WriteStreamOptions } [options] - Optional parameters for ReadStream. - * @returns { WriteStream } Returns the WriteStream object which has been created. - * @throws { BusinessError } 401 - Parameter error - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900015 - File exists - * @throws { BusinessError } 13900017 - No such device - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900022 - Too many open files - * @throws { BusinessError } 13900024 - File too large - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900027 - Read-only file system - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900038 - Value too large for defined data type - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 12 - */ -declare function createWriteStream(path: string, options?: WriteStreamOptions): WriteStream; + /** + * Copy directory. + * + * @param { string } src - source path. + * @param { string } dest - destination path. + * @param { number } mode - mode. + * @param { AsyncCallback> } callback - Return the callback function. + * @throws { BusinessError } 13900015 - File exists + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 + */ + function copyDir(src: string, dest: string, mode: number, callback: AsyncCallback>): void; -/** - * Create watcher to listen for file changes. - * - * @param { string } path - path. - * @param { number } events - listened events. - * @param { WatchEventListener } listener - Callback to invoke when an event of the specified type occurs. - * @returns { Watcher } Returns the Watcher object which has been created. - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900015 - File exists - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900021 - File table overflow - * @throws { BusinessError } 13900022 - Too many open files - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 10 - */ -declare function createWatcher(path: string, events: number, listener: WatchEventListener): Watcher; + /** + * Copy directory with sync interface. + * + * @param { string } src - source path. + * @param { string } dest - destination path. + * @param { number } [mode = 0] - mode. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900031 - Function not implemented + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 10 + */ + /** + * Copy directory with sync interface. + * + * @param { string } src - source path. + * @param { string } dest - destination path. + * @param { number } [mode = 0] - mode. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900031 - Function not implemented + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900042 - Unknown error + * @throws { BusinessError } 13900044 - Network is unreachable + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 + */ + function copyDirSync(src: string, dest: string, mode?: number): void; -/** - * Duplicate fd to File Object. - * - * @param { number } fd - fd. - * @returns { File } return File - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900014 - Device or resource busy - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900022 - Too many open files - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 10 - */ -declare function dup(fd: number): File; + /** + * Copy file. + * + * @param { string | number } src - src. + * @param { string | number } dest - dest. + * @param { number } [mode = 0] - mode. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900031 - Function not implemented + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + /** + * Copy file. + * + * @param { string | number } src - src. + * @param { string | number } dest - dest. + * @param { number } [mode = 0] - mode. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900031 - Function not implemented + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ + /** + * Copy file. + * + * @param { string | number } src - src. + * @param { string | number } dest - dest. + * @param { number } [mode = 0] - mode. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900031 - Function not implemented + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * Copy file. + * + * @param { string | number } src - src. + * @param { string | number } dest - dest. + * @param { number } [mode = 0] - mode. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900031 - Function not implemented + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900042 - Unknown error + * @throws { BusinessError } 13900044 - Network is unreachable + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 + */ + function copyFile(src: string | number, dest: string | number, mode?: number): Promise; -/** - * Synchronize file metadata. - * - * @param { number } fd - fd. - * @returns { Promise } The promise returned by the function. - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900027 - Read-only file system - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 - */ -/** - * Synchronize file metadata. - * - * @param { number } fd - fd. - * @returns { Promise } The promise returned by the function. - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900027 - Read-only file system - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @since 10 - */ -declare function fdatasync(fd: number): Promise; - -/** - * Synchronize file metadata. - * - * @param { number } fd - fd. - * @param { AsyncCallback } callback - Return the callback function. - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900027 - Read-only file system - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 - */ -/** - * Synchronize file metadata. - * - * @param { number } fd - fd. - * @param { AsyncCallback } callback - Return the callback function. - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900027 - Read-only file system - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @since 10 - */ -declare function fdatasync(fd: number, callback: AsyncCallback): void; - -/** - * Synchronize file metadata with sync interface. - * - * @param { number } fd - fd. - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900027 - Read-only file system - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 - */ -/** - * Synchronize file metadata with sync interface. - * - * @param { number } fd - fd. - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900027 - Read-only file system - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @since 10 - */ -declare function fdatasyncSync(fd: number): void; - -/** - * Create class Stream by using fd. - * - * @param { number } fd - fd. - * @param { string } mode - mode. - * @returns { Promise } Returns the Stream object in promise mode. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900006 - No such device or address - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900010 - Try again - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900014 - Device or resource busy - * @throws { BusinessError } 13900015 - File exists - * @throws { BusinessError } 13900017 - No such device - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900022 - Too many open files - * @throws { BusinessError } 13900023 - Text file busy - * @throws { BusinessError } 13900024 - File too large - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900027 - Read-only file system - * @throws { BusinessError } 13900029 - Resource deadlock would occur - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900038 - Value too large for defined data type - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 - */ -declare function fdopenStream(fd: number, mode: string): Promise; - -/** - * Create class Stream by using fd. - * - * @param { number } fd - fd. - * @param { string } mode - mode. - * @param { AsyncCallback } callback - The callback is used to return the Stream object. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900006 - No such device or address - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900010 - Try again - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900014 - Device or resource busy - * @throws { BusinessError } 13900015 - File exists - * @throws { BusinessError } 13900017 - No such device - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900022 - Too many open files - * @throws { BusinessError } 13900023 - Text file busy - * @throws { BusinessError } 13900024 - File too large - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900027 - Read-only file system - * @throws { BusinessError } 13900029 - Resource deadlock would occur - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900038 - Value too large for defined data type - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 - */ -declare function fdopenStream(fd: number, mode: string, callback: AsyncCallback): void; - -/** - * Create class Stream by using fd with sync interface. - * - * @param { number } fd - fd. - * @param { string } mode - mode. - * @returns { Stream } Returns the Stream object. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900006 - No such device or address - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900010 - Try again - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900014 - Device or resource busy - * @throws { BusinessError } 13900015 - File exists - * @throws { BusinessError } 13900017 - No such device - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900022 - Too many open files - * @throws { BusinessError } 13900023 - Text file busy - * @throws { BusinessError } 13900024 - File too large - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900027 - Read-only file system - * @throws { BusinessError } 13900029 - Resource deadlock would occur - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900038 - Value too large for defined data type - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 - */ -declare function fdopenStreamSync(fd: number, mode: string): Stream; - -/** - * Synchronize file. - * - * @param { number } fd - fd. - * @returns { Promise } The promise returned by the function. - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900027 - Read-only file system - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 - */ -/** - * Synchronize file. - * - * @param { number } fd - fd. - * @returns { Promise } The promise returned by the function. - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900027 - Read-only file system - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @since 10 - */ -declare function fsync(fd: number): Promise; - -/** - * Synchronize file. - * - * @param { number } fd - fd. - * @param { AsyncCallback } callback - Return the callback function. - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900027 - Read-only file system - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 - */ -/** - * Synchronize file. - * - * @param { number } fd - fd. - * @param { AsyncCallback } callback - Return the callback function. - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900027 - Read-only file system - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @since 10 - */ -declare function fsync(fd: number, callback: AsyncCallback): void; - -/** - * Synchronize file with sync interface. - * - * @param { number } fd - fd. - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900027 - Read-only file system - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 - */ -/** - * Synchronize file with sync interface. - * - * @param { number } fd - fd. - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900027 - Read-only file system - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @since 10 - */ -declare function fsyncSync(fd: number): void; - -/** - * List file. - * - * @param { string } path - path. - * @param { object } [options] - options. - * @returns { Promise } Returns an Array containing the name of files or directories that meet the filter criteria in promise mode. - * If present, Include the subdirectory structure. - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 - */ -/** - * List file. - * - * @param { string } path - path. - * @param { object } [options] - options. - * @returns { Promise } Returns an Array containing the name of files or directories that meet the filter criteria. - * If present, Include the subdirectory structure. - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @since 10 - */ -/** - * List file. - * - * @param { string } path - path. - * @param { ListFileOptions } [options] - options. - * @returns { Promise } Returns an Array containing the name of files or directories that meet the filter criteria. - * If present, Include the subdirectory structure. - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice - * @since 11 - */ -declare function listFile( - path: string, - options?: ListFileOptions -): Promise; - -/** - * List file. - * - * @param { string } path - path. - * @param { AsyncCallback } callback - The callback is used to return an Array containing the name of files or directories - * that meet the filter criteria in promise mode. If present, Include the subdirectory structure. - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 - */ -/** - * List file. - * - * @param { string } path - path. - * @param { AsyncCallback } callback - The callback is used to return an Array containing the name of files or directories - * that meet the filter criteria in promise mode. If present, Include the subdirectory structure. - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @since 10 - */ -/** - * List file. - * - * @param { string } path - path. - * @param { AsyncCallback } callback - The callback is used to return an Array containing the name of files or directories - * that meet the filter criteria in promise mode. If present, Include the subdirectory structure. - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice - * @since 11 - */ -declare function listFile(path: string, callback: AsyncCallback): void; - -/** - * List file. - * - * @param { string } path - path. - * @param { object } [options] - options. - * @param { AsyncCallback } callback - The callback is used to return an Array containing the name of files or directories - * that meet the filter criteria in promise mode. If present, Include the subdirectory structure. - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 - */ -/** - * List file. - * - * @param { string } path - path. - * @param { object } [options] - options. - * @param { AsyncCallback } callback - The callback is used to return an Array containing the name of files or directories - * that meet the filter criteria in promise mode. If present, Include the subdirectory structure. - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @since 10 - */ -/** - * List file. - * - * @param { string } path - path. - * @param { ListFileOptions } [options] - options. - * @param { AsyncCallback } callback - The callback is used to return an Array containing the name of files or directories - * that meet the filter criteria in promise mode. If present, Include the subdirectory structure. - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice - * @since 11 - */ -declare function listFile( - path: string, - options: ListFileOptions, - callback: AsyncCallback -): void; - -/** - * List file with sync interface. - * - * @param { string } path - path. - * @param { object } [options] - options. - * @returns { string[] } Returns an Array containing the name of files or directories that meet the filter criteria. - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 - */ -/** - * List file with sync interface. - * - * @param { string } path - path. - * @param { object } [options] - options. - * @returns { string[] } Returns an Array containing the name of files or directories that meet the filter criteria. - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @since 10 - */ -/** - * List file with sync interface. - * - * @param { string } path - path. - * @param { ListFileOptions } [options] - options. - * @returns { string[] } Returns an Array containing the name of files or directories that meet the filter criteria. - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice - * @since 11 - */ -declare function listFileSync( - path: string, - options?: ListFileOptions -): string[]; - -/** - * Reposition file offset. - * - * @param { number } fd - file descriptor. - * @param { number } offset - file offset. - * @param { WhenceType } [whence = WhenceType.SEEK_SET] - directive whence. - * @returns { number } Returns the file offset relative to starting position of file. - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900026 - Illegal seek - * @throws { BusinessError } 13900038 - Value too large for defined data type - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 11 - */ -/** - * Reposition file offset. - * - * @param { number } fd - file descriptor. - * @param { number } offset - file offset. - * @param { WhenceType } [whence = WhenceType.SEEK_SET] - directive whence. - * @returns { number } Returns the file offset relative to starting position of file. - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900026 - Illegal seek - * @throws { BusinessError } 13900038 - Value too large for defined data type - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @since 12 - */ -declare function lseek(fd: number, offset: number, whence?: WhenceType): number; - -/** - * Stat link file. - * - * @param { string } path - path. - * @returns { Promise } Returns the Stat object in promise mode. - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900038 - Value too large for defined data type - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 - */ -declare function lstat(path: string): Promise; - -/** - * Stat link file. - * - * @param { string } path - path. - * @param { AsyncCallback } callback - The callback is used to return the Stat object. - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900038 - Value too large for defined data type - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 - */ -declare function lstat(path: string, callback: AsyncCallback): void; - -/** - * Stat link file with sync interface. - * - * @param { string } path - path. - * @returns { Stat } Returns the Stat object. - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900038 - Value too large for defined data type - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 - */ -declare function lstatSync(path: string): Stat; - -/** - * Make dir. - * - * @param { string } path - path. - * @returns { Promise } The promise returned by the function. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900015 - File exists - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900028 - Too many links - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 - */ -/** - * Make dir. - * - * @param { string } path - path. - * @returns { Promise } The promise returned by the function. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900015 - File exists - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900028 - Too many links - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @since 10 - */ -/** - * Make dir. - * - * @param { string } path - path. - * @returns { Promise } The promise returned by the function. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900015 - File exists - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900028 - Too many links - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice - * @since 11 - */ -declare function mkdir(path: string): Promise; - -/** - * Make dir. - * - * @param { string } path - path. - * @param { boolean } recursion - whether to recursively make directory. - * @returns { Promise } The promise returned by the function. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900015 - File exists - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900028 - Too many links - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @atomicservice - * @since 11 - */ -declare function mkdir(path: string, recursion: boolean): Promise; - -/** - * Make dir. - * - * @param { string } path - path. - * @param { AsyncCallback } callback - Return the callback function. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900015 - File exists - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900028 - Too many links - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 - */ -/** - * Make dir. - * - * @param { string } path - path. - * @param { AsyncCallback } callback - Return the callback function. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900015 - File exists - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900028 - Too many links - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @since 10 - */ -/** - * Make dir. - * - * @param { string } path - path. - * @param { AsyncCallback } callback - Return the callback function. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900015 - File exists - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900028 - Too many links - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice - * @since 11 - */ -declare function mkdir(path: string, callback: AsyncCallback): void; - -/** - * Make dir. - * - * @param { string } path - path. - * @param { boolean } recursion - whether to recursively make directory. - * @param { AsyncCallback } callback - Return the callback function. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900015 - File exists - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900028 - Too many links - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @atomicservice - * @since 11 - */ -declare function mkdir(path: string, recursion: boolean, callback: AsyncCallback): void; - -/** - * Make dir with sync interface. - * - * @param { string } path - path. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900015 - File exists - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900028 - Too many links - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 - */ -/** - * Make dir with sync interface. - * - * @param { string } path - path. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900015 - File exists - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900028 - Too many links - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @since 10 - */ -/** - * Make dir with sync interface. - * - * @param { string } path - path. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900015 - File exists - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900028 - Too many links - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice - * @since 11 - */ -declare function mkdirSync(path: string): void; - -/** - * Make dir with sync interface. - * - * @param { string } path - path. - * @param { boolean } recursion - whether to recursively make directory. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900015 - File exists - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900028 - Too many links - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @atomicservice - * @since 11 - */ -declare function mkdirSync(path: string, recursion: boolean): void; - -/** - * Make temp dir. - * - * @param { string } prefix - dir prefix. - * @returns { Promise } Returns the path to the new directory in promise mode. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900015 - File exists - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900028 - Too many links - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 - */ -/** - * Make temp dir. - * - * @param { string } prefix - dir prefix. - * @returns { Promise } Returns the path to the new directory in promise mode. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900015 - File exists - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900028 - Too many links - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @since 10 - */ -declare function mkdtemp(prefix: string): Promise; - -/** - * Make temp dir. - * - * @param { string } prefix - dir prefix. - * @param { AsyncCallback } callback - The callback is used to return the path to the new directory. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900015 - File exists - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900028 - Too many links - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 - */ -/** - * Make temp dir. - * - * @param { string } prefix - dir prefix. - * @param { AsyncCallback } callback - The callback is used to return the path to the new directory. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900015 - File exists - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900028 - Too many links - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @since 10 - */ -declare function mkdtemp(prefix: string, callback: AsyncCallback): void; - -/** - * Make temp dir with sync interface. - * - * @param { string } prefix - dir prefix. - * @returns { string } Returns the path to the new directory. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900015 - File exists - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900028 - Too many links - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 - */ -/** - * Make temp dir with sync interface. - * - * @param { string } prefix - dir prefix. - * @returns { string } Returns the path to the new directory. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900015 - File exists - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900028 - Too many links - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @since 10 - */ -declare function mkdtempSync(prefix: string): string; - -/** - * Move directory. - * - * @param { string } src - source file path. - * @param { string } dest - destination file path. - * @param { number } [mode = 0] - move mode when duplicate file name exists. - * @returns { Promise } The promise returned by the function. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900014 - Device or resource busy - * @throws { BusinessError } 13900015 - File exists - * @throws { BusinessError } 13900016 - Cross-device link - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900027 - Read-only file system - * @throws { BusinessError } 13900028 - Too many links - * @throws { BusinessError } 13900032 - Directory not empty - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 10 - */ -declare function moveDir(src: string, dest: string, mode?: number): Promise; - -/** - * Move directory. - * - * @param { string } src - source file path. - * @param { string } dest - destination file path. - * @param { AsyncCallback } callback - Return the callback function. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900014 - Device or resource busy - * @throws { BusinessError } 13900016 - Cross-device link - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900027 - Read-only file system - * @throws { BusinessError } 13900028 - Too many links - * @throws { BusinessError } 13900032 - Directory not empty - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 10 - */ -declare function moveDir(src: string, dest: string, callback: AsyncCallback): void; - -/** - * Move directory. - * - * @param { string } src - source file path. - * @param { string } dest - destination file path. - * @param { AsyncCallback> } callback - Return the callback function. - * @throws { BusinessError } 13900015 - File exists - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 10 - */ -declare function moveDir(src: string, dest: string, callback: AsyncCallback>): void; - -/** - * Move directory. - * - * @param { string } src - source file path. - * @param { string } dest - destination file path. - * @param { number } mode - move mode when duplicate file name exists. - * @param { AsyncCallback } callback - Return the callback function. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900014 - Device or resource busy - * @throws { BusinessError } 13900016 - Cross-device link - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900027 - Read-only file system - * @throws { BusinessError } 13900028 - Too many links - * @throws { BusinessError } 13900032 - Directory not empty - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 10 - */ -declare function moveDir(src: string, dest: string, mode: number, callback: AsyncCallback): void; - -/** - * Move directory. - * - * @param { string } src - source file path. - * @param { string } dest - destination file path. - * @param { number } mode - move mode when duplicate file name exists. - * @param { AsyncCallback> } callback - Return the callback function. - * @throws { BusinessError } 13900015 - File exists - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 10 - */ -declare function moveDir(src: string, dest: string, mode: number, callback: AsyncCallback>): void; - -/** - * Move directory with sync interface. - * - * @param { string } src - source file path. - * @param { string } dest - destination file path. - * @param { number } [mode = 0] - move mode when duplicate file name exists. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900014 - Device or resource busy - * @throws { BusinessError } 13900015 - File exists - * @throws { BusinessError } 13900016 - Cross-device link - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900027 - Read-only file system - * @throws { BusinessError } 13900028 - Too many links - * @throws { BusinessError } 13900032 - Directory not empty - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 10 - */ -declare function moveDirSync(src: string, dest: string, mode?: number): void; - -/** - * Move file. - * - * @param { string } src - source file path. - * @param { string } dest - destination file path. - * @param { number } [mode = 0] - move mode when duplicate file name exists. - * @returns { Promise } The promise returned by the function. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900014 - Device or resource busy - * @throws { BusinessError } 13900015 - File exists - * @throws { BusinessError } 13900016 - Cross-device link - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900027 - Read-only file system - * @throws { BusinessError } 13900028 - Too many links - * @throws { BusinessError } 13900032 - Directory not empty - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 - */ -/** - * Move file. - * - * @param { string } src - source file path. - * @param { string } dest - destination file path. - * @param { number } [mode = 0] - move mode when duplicate file name exists. - * @returns { Promise } The promise returned by the function. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900014 - Device or resource busy - * @throws { BusinessError } 13900015 - File exists - * @throws { BusinessError } 13900016 - Cross-device link - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900027 - Read-only file system - * @throws { BusinessError } 13900028 - Too many links - * @throws { BusinessError } 13900032 - Directory not empty - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @since 10 - */ -declare function moveFile(src: string, dest: string, mode?: number): Promise; - -/** - * Move file. - * - * @param { string } src - source file path. - * @param { string } dest - destination file path. - * @param { AsyncCallback } callback - Return the callback function. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900014 - Device or resource busy - * @throws { BusinessError } 13900015 - File exists - * @throws { BusinessError } 13900016 - Cross-device link - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900027 - Read-only file system - * @throws { BusinessError } 13900028 - Too many links - * @throws { BusinessError } 13900032 - Directory not empty - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 - */ -/** - * Move file. - * - * @param { string } src - source file path. - * @param { string } dest - destination file path. - * @param { AsyncCallback } callback - Return the callback function. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900014 - Device or resource busy - * @throws { BusinessError } 13900015 - File exists - * @throws { BusinessError } 13900016 - Cross-device link - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900027 - Read-only file system - * @throws { BusinessError } 13900028 - Too many links - * @throws { BusinessError } 13900032 - Directory not empty - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @since 10 - */ -declare function moveFile(src: string, dest: string, callback: AsyncCallback): void; - -/** - * Move file. - * - * @param { string } src - source file path. - * @param { string } dest - destination file path. - * @param { number } [mode = 0] - move mode when duplicate file name exists. - * @param { AsyncCallback } callback - Return the callback function. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900014 - Device or resource busy - * @throws { BusinessError } 13900015 - File exists - * @throws { BusinessError } 13900016 - Cross-device link - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900027 - Read-only file system - * @throws { BusinessError } 13900028 - Too many links - * @throws { BusinessError } 13900032 - Directory not empty - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 - */ -/** - * Move file. - * - * @param { string } src - source file path. - * @param { string } dest - destination file path. - * @param { number } [mode = 0] - move mode when duplicate file name exists. - * @param { AsyncCallback } callback - Return the callback function. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900014 - Device or resource busy - * @throws { BusinessError } 13900015 - File exists - * @throws { BusinessError } 13900016 - Cross-device link - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900027 - Read-only file system - * @throws { BusinessError } 13900028 - Too many links - * @throws { BusinessError } 13900032 - Directory not empty - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @since 10 - */ -declare function moveFile(src: string, dest: string, mode: number, callback: AsyncCallback): void; - -/** - * Move file with sync interface. - * - * @param { string } src - source file path. - * @param { string } dest - destination file path. - * @param { number } [mode = 0] - move mode when duplicate file name exists. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900014 - Device or resource busy - * @throws { BusinessError } 13900015 - File exists - * @throws { BusinessError } 13900016 - Cross-device link - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900027 - Read-only file system - * @throws { BusinessError } 13900028 - Too many links - * @throws { BusinessError } 13900032 - Directory not empty - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 - */ -/** - * Move file with sync interface. - * - * @param { string } src - source file path. - * @param { string } dest - destination file path. - * @param { number } [mode = 0] - move mode when duplicate file name exists. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900014 - Device or resource busy - * @throws { BusinessError } 13900015 - File exists - * @throws { BusinessError } 13900016 - Cross-device link - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900027 - Read-only file system - * @throws { BusinessError } 13900028 - Too many links - * @throws { BusinessError } 13900032 - Directory not empty - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @since 10 - */ -declare function moveFileSync(src: string, dest: string, mode?: number): void; + /** + * Copy file. + * + * @param { string | number } src - src. + * @param { string | number } dest - dest. + * @param { AsyncCallback } callback - Return the callback function. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900031 - Function not implemented + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + /** + * Copy file. + * + * @param { string | number } src - src. + * @param { string | number } dest - dest. + * @param { AsyncCallback } callback - Return the callback function. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900031 - Function not implemented + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ + /** + * Copy file. + * + * @param { string | number } src - src. + * @param { string | number } dest - dest. + * @param { AsyncCallback } callback - Return the callback function. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900031 - Function not implemented + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 + */ + function copyFile(src: string | number, dest: string | number, callback: AsyncCallback): void; -/** - * Open file. - * - * @param { string } path - path. - * @param { number } [mode = OpenMode.READ_ONLY] - mode. - * @returns { Promise } Returns the File object in Promise mode to record the file descriptor. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900006 - No such device or address - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900014 - Device or resource busy - * @throws { BusinessError } 13900015 - File exists - * @throws { BusinessError } 13900017 - No such device - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900022 - Too many open files - * @throws { BusinessError } 13900023 - Text file busy - * @throws { BusinessError } 13900024 - File too large - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900027 - Read-only file system - * @throws { BusinessError } 13900029 - Resource deadlock would occur - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900038 - Value too large for defined data type - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 - */ -/** - * Open file. - * - * @param { string } path - path. - * @param { number } [mode = OpenMode.READ_ONLY] - mode. - * @returns { Promise } Returns the File object in Promise mode to record the file descriptor. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900006 - No such device or address - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900014 - Device or resource busy - * @throws { BusinessError } 13900015 - File exists - * @throws { BusinessError } 13900017 - No such device - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900022 - Too many open files - * @throws { BusinessError } 13900023 - Text file busy - * @throws { BusinessError } 13900024 - File too large - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900027 - Read-only file system - * @throws { BusinessError } 13900029 - Resource deadlock would occur - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900038 - Value too large for defined data type - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @since 10 - */ -/** - * Open file. - * - * @param { string } path - path. - * @param { number } [mode = OpenMode.READ_ONLY] - mode. - * @returns { Promise } Returns the File object in Promise mode to record the file descriptor. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900006 - No such device or address - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900014 - Device or resource busy - * @throws { BusinessError } 13900015 - File exists - * @throws { BusinessError } 13900017 - No such device - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900022 - Too many open files - * @throws { BusinessError } 13900023 - Text file busy - * @throws { BusinessError } 13900024 - File too large - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900027 - Read-only file system - * @throws { BusinessError } 13900029 - Resource deadlock would occur - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900038 - Value too large for defined data type - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice - * @since 11 - */ -/** - * Open file. - * - * @param { string } path - path. - * @param { number } [mode = OpenMode.READ_ONLY] - mode. - * @returns { Promise } Returns the File object in Promise mode to record the file descriptor. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900006 - No such device or address - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900014 - Device or resource busy - * @throws { BusinessError } 13900015 - File exists - * @throws { BusinessError } 13900017 - No such device - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900022 - Too many open files - * @throws { BusinessError } 13900023 - Text file busy - * @throws { BusinessError } 13900024 - File too large - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900027 - Read-only file system - * @throws { BusinessError } 13900029 - Resource deadlock would occur - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900038 - Value too large for defined data type - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @throws { BusinessError } 13900044 - Network is unreachable - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice - * @since 12 - */ -declare function open(path: string, mode?: number): Promise; + /** + * Copy file. + * + * @param { string | number } src - src. + * @param { string | number } dest - dest. + * @param { number } [mode = 0] - mode. + * @param { AsyncCallback } callback - Return the callback function. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900031 - Function not implemented + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + /** + * Copy file. + * + * @param { string | number } src - src. + * @param { string | number } dest - dest. + * @param { number } [mode = 0] - mode. + * @param { AsyncCallback } callback - Return the callback function. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900031 - Function not implemented + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ + /** + * Copy file. + * + * @param { string | number } src - src. + * @param { string | number } dest - dest. + * @param { number } [mode = 0] - mode. + * @param { AsyncCallback } callback - Return the callback function. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900031 - Function not implemented + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 + */ + function copyFile( + src: string | number, + dest: string | number, + mode: number, + callback: AsyncCallback + ): void; -/** - * Open file. - * - * @param { string } path - path. - * @param { AsyncCallback } callback - The callback is used to return the File object to record the file descriptor. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900006 - No such device or address - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900014 - Device or resource busy - * @throws { BusinessError } 13900015 - File exists - * @throws { BusinessError } 13900017 - No such device - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900022 - Too many open files - * @throws { BusinessError } 13900023 - Text file busy - * @throws { BusinessError } 13900024 - File too large - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900027 - Read-only file system - * @throws { BusinessError } 13900029 - Resource deadlock would occur - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900038 - Value too large for defined data type - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 - */ -/** - * Open file. - * - * @param { string } path - path. - * @param { AsyncCallback } callback - The callback is used to return the File object to record the file descriptor. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900006 - No such device or address - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900014 - Device or resource busy - * @throws { BusinessError } 13900015 - File exists - * @throws { BusinessError } 13900017 - No such device - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900022 - Too many open files - * @throws { BusinessError } 13900023 - Text file busy - * @throws { BusinessError } 13900024 - File too large - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900027 - Read-only file system - * @throws { BusinessError } 13900029 - Resource deadlock would occur - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900038 - Value too large for defined data type - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @since 10 - */ -/** - * Open file. - * - * @param { string } path - path. - * @param { AsyncCallback } callback - The callback is used to return the File object to record the file descriptor. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900006 - No such device or address - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900014 - Device or resource busy - * @throws { BusinessError } 13900015 - File exists - * @throws { BusinessError } 13900017 - No such device - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900022 - Too many open files - * @throws { BusinessError } 13900023 - Text file busy - * @throws { BusinessError } 13900024 - File too large - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900027 - Read-only file system - * @throws { BusinessError } 13900029 - Resource deadlock would occur - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900038 - Value too large for defined data type - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice - * @since 11 - */ -declare function open(path: string, callback: AsyncCallback): void; + /** + * Copy file with sync interface. + * + * @param { string | number } src - src. + * @param { string | number } dest - dest. + * @param { number } [mode = 0] - mode. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900031 - Function not implemented + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + /** + * Copy file with sync interface. + * + * @param { string | number } src - src. + * @param { string | number } dest - dest. + * @param { number } [mode = 0] - mode. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900031 - Function not implemented + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ + /** + * Copy file with sync interface. + * + * @param { string | number } src - src. + * @param { string | number } dest - dest. + * @param { number } [mode = 0] - mode. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900031 - Function not implemented + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * Copy file with sync interface. + * + * @param { string | number } src - src. + * @param { string | number } dest - dest. + * @param { number } [mode = 0] - mode. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900031 - Function not implemented + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900042 - Unknown error + * @throws { BusinessError } 13900044 - Network is unreachable + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 + */ + function copyFileSync(src: string | number, dest: string | number, mode?: number): void; -/** - * Open file. - * - * @param { string } path - path. - * @param { number } [mode = OpenMode.READ_ONLY] - mode. - * @param { AsyncCallback } callback - The callback is used to return the File object to record the file descriptor. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900006 - No such device or address - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900014 - Device or resource busy - * @throws { BusinessError } 13900015 - File exists - * @throws { BusinessError } 13900017 - No such device - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900022 - Too many open files - * @throws { BusinessError } 13900023 - Text file busy - * @throws { BusinessError } 13900024 - File too large - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900027 - Read-only file system - * @throws { BusinessError } 13900029 - Resource deadlock would occur - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900038 - Value too large for defined data type - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 - */ -/** - * Open file. - * - * @param { string } path - path. - * @param { number } [mode = OpenMode.READ_ONLY] - mode. - * @param { AsyncCallback } callback - The callback is used to return the File object to record the file descriptor. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900006 - No such device or address - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900014 - Device or resource busy - * @throws { BusinessError } 13900015 - File exists - * @throws { BusinessError } 13900017 - No such device - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900022 - Too many open files - * @throws { BusinessError } 13900023 - Text file busy - * @throws { BusinessError } 13900024 - File too large - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900027 - Read-only file system - * @throws { BusinessError } 13900029 - Resource deadlock would occur - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900038 - Value too large for defined data type - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @since 10 - */ -/** - * Open file. - * - * @param { string } path - path. - * @param { number } [mode = OpenMode.READ_ONLY] - mode. - * @param { AsyncCallback } callback - The callback is used to return the File object to record the file descriptor. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900006 - No such device or address - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900014 - Device or resource busy - * @throws { BusinessError } 13900015 - File exists - * @throws { BusinessError } 13900017 - No such device - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900022 - Too many open files - * @throws { BusinessError } 13900023 - Text file busy - * @throws { BusinessError } 13900024 - File too large - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900027 - Read-only file system - * @throws { BusinessError } 13900029 - Resource deadlock would occur - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900038 - Value too large for defined data type - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice - * @since 11 - */ -declare function open(path: string, mode: number, callback: AsyncCallback): void; + /** + * Create class Stream. + * + * @param { string } path - path. + * @param { string } mode - mode. + * @returns { Promise } return Promise + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900006 - No such device or address + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900017 - No such device + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900022 - Too many open files + * @throws { BusinessError } 13900023 - Text file busy + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900029 - Resource deadlock would occur + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + /** + * Create class Stream. + * + * @param { string } path - path. + * @param { string } mode - mode. + * @returns { Promise } return Promise + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900006 - No such device or address + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900017 - No such device + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900022 - Too many open files + * @throws { BusinessError } 13900023 - Text file busy + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900029 - Resource deadlock would occur + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @throws { BusinessError } 13900044 - Network is unreachable + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 + */ + function createStream(path: string, mode: string): Promise; -/** - * Open file with sync interface. - * - * @param { string } path - path. - * @param { number } [mode = OpenMode.READ_ONLY] - mode. - * @returns { File } Returns the File object to record the file descriptor. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900006 - No such device or address - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900014 - Device or resource busy - * @throws { BusinessError } 13900015 - File exists - * @throws { BusinessError } 13900017 - No such device - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900022 - Too many open files - * @throws { BusinessError } 13900023 - Text file busy - * @throws { BusinessError } 13900024 - File too large - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900027 - Read-only file system - * @throws { BusinessError } 13900029 - Resource deadlock would occur - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900038 - Value too large for defined data type - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 - */ -/** - * Open file with sync interface. - * - * @param { string } path - path. - * @param { number } [mode = OpenMode.READ_ONLY] - mode. - * @returns { File } Returns the File object to record the file descriptor. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900006 - No such device or address - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900014 - Device or resource busy - * @throws { BusinessError } 13900015 - File exists - * @throws { BusinessError } 13900017 - No such device - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900022 - Too many open files - * @throws { BusinessError } 13900023 - Text file busy - * @throws { BusinessError } 13900024 - File too large - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900027 - Read-only file system - * @throws { BusinessError } 13900029 - Resource deadlock would occur - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900038 - Value too large for defined data type - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @since 10 - */ -/** - * Open file with sync interface. - * - * @param { string } path - path. - * @param { number } [mode = OpenMode.READ_ONLY] - mode. - * @returns { File } Returns the File object to record the file descriptor. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900006 - No such device or address - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900014 - Device or resource busy - * @throws { BusinessError } 13900015 - File exists - * @throws { BusinessError } 13900017 - No such device - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900022 - Too many open files - * @throws { BusinessError } 13900023 - Text file busy - * @throws { BusinessError } 13900024 - File too large - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900027 - Read-only file system - * @throws { BusinessError } 13900029 - Resource deadlock would occur - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900038 - Value too large for defined data type - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice - * @since 11 - */ -/** - * Open file with sync interface. - * - * @param { string } path - path. - * @param { number } [mode = OpenMode.READ_ONLY] - mode. - * @returns { File } Returns the File object to record the file descriptor. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900006 - No such device or address - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900014 - Device or resource busy - * @throws { BusinessError } 13900015 - File exists - * @throws { BusinessError } 13900017 - No such device - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900022 - Too many open files - * @throws { BusinessError } 13900023 - Text file busy - * @throws { BusinessError } 13900024 - File too large - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900027 - Read-only file system - * @throws { BusinessError } 13900029 - Resource deadlock would occur - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900038 - Value too large for defined data type - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @throws { BusinessError } 13900044 - Network is unreachable - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice - * @since 12 - */ -declare function openSync(path: string, mode?: number): File; + /** + * Create class Stream. + * + * @param { string } path - path. + * @param { string } mode - mode. + * @param { AsyncCallback } callback - callback. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900006 - No such device or address + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900017 - No such device + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900022 - Too many open files + * @throws { BusinessError } 13900023 - Text file busy + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900029 - Resource deadlock would occur + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 + */ + function createStream(path: string, mode: string, callback: AsyncCallback): void; -/** - * Read file. - * - * @param { number } fd - file descriptor. - * @param { ArrayBuffer } buffer - buffer. - * @param { object } [options] - options. - * @returns { Promise } Returns the number of file bytes read to buffer in promise mode. - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900010 - Try again - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 - */ -/** - * Read file. - * - * @param { number } fd - file descriptor. - * @param { ArrayBuffer } buffer - buffer. - * @param { object } [options] - options. - * @returns { Promise } Returns the number of file bytes read to buffer in promise mode. - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900010 - Try again - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @since 10 - */ -/** - * Read file. - * - * @param { number } fd - file descriptor. - * @param { ArrayBuffer } buffer - buffer. - * @param { ReadOptions } [options] - options. - * @returns { Promise } Returns the number of file bytes read to buffer in promise mode. - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900010 - Try again - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice - * @since 11 - */ -/** - * Read file. - * - * @param { number } fd - file descriptor. - * @param { ArrayBuffer } buffer - buffer. - * @param { ReadOptions } [options] - options. - * @returns { Promise } Returns the number of file bytes read to buffer in promise mode. - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900010 - Try again - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900042 - Unknown error - * @throws { BusinessError } 13900044 - Network is unreachable - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice - * @since 12 - */ -declare function read( - fd: number, - buffer: ArrayBuffer, - options?: ReadOptions -): Promise; + /** + * Create class Stream with sync interface. + * + * @param { string } path - path. + * @param { string } mode - mode. + * @returns { Stream } createStream + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900006 - No such device or address + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900017 - No such device + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900022 - Too many open files + * @throws { BusinessError } 13900023 - Text file busy + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900029 - Resource deadlock would occur + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + /** + * Create class Stream with sync interface. + * + * @param { string } path - path. + * @param { string } mode - mode. + * @returns { Stream } createStream + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900006 - No such device or address + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900017 - No such device + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900022 - Too many open files + * @throws { BusinessError } 13900023 - Text file busy + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900029 - Resource deadlock would occur + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @throws { BusinessError } 13900044 - Network is unreachable + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 + */ + function createStreamSync(path: string, mode: string): Stream; -/** - * Read file. - * - * @param { number } fd - file descriptor. - * @param { ArrayBuffer } buffer - buffer. - * @param { AsyncCallback } callback - The callback is used to return the number of file bytes read to buffer. - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900010 - Try again - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 - */ -/** - * Read file. - * - * @param { number } fd - file descriptor. - * @param { ArrayBuffer } buffer - buffer. - * @param { AsyncCallback } callback - The callback is used to return the number of file bytes read to buffer. - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900010 - Try again - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @since 10 - */ -/** - * Read file. - * - * @param { number } fd - file descriptor. - * @param { ArrayBuffer } buffer - buffer. - * @param { AsyncCallback } callback - The callback is used to return the number of file bytes read to buffer. - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900010 - Try again - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice - * @since 11 - */ -declare function read(fd: number, buffer: ArrayBuffer, callback: AsyncCallback): void; -/** - * Read file. - * - * @param { number } fd - file descriptor. - * @param { ArrayBuffer } buffer - buffer. - * @param { object } [options] - options. - * @param { AsyncCallback } callback - The callback is used to return the number of file bytes read to buffer. - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900010 - Try again - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 - */ -/** - * Read file. - * - * @param { number } fd - file descriptor. - * @param { ArrayBuffer } buffer - buffer. - * @param { object } [options] - options. - * @param { AsyncCallback } callback - The callback is used to return the number of file bytes read to buffer. - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900010 - Try again - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @since 10 - */ -/** - * Read file. - * - * @param { number } fd - file descriptor. - * @param { ArrayBuffer } buffer - buffer. - * @param { ReadOptions } [options] - options. - * @param { AsyncCallback } callback - The callback is used to return the number of file bytes read to buffer. - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900010 - Try again - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice - * @since 11 - */ -declare function read( - fd: number, - buffer: ArrayBuffer, - options: ReadOptions, - callback: AsyncCallback -): void; + /** + * Create class RandomAccessFile. + * + * @param { string | File } file - file path, object. + * @param { number } [mode = OpenMode.READ_ONLY] - mode. + * @returns { Promise } Returns the RandomAccessFile object which has been created in promise mode. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900006 - No such device or address + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900017 - No such device + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900022 - Too many open files + * @throws { BusinessError } 13900023 - Text file busy + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900029 - Resource deadlock would occur + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 10 + */ + /** + * Create class RandomAccessFile. + * + * @param { string | File } file - file path, object. + * @param { number } [mode = OpenMode.READ_ONLY] - mode. + * @param { RandomAccessFileOptions } [options] - RandomAccessFile options + * @returns { Promise } Returns the RandomAccessFile object which has been created in promise mode. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900006 - No such device or address + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900017 - No such device + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900022 - Too many open files + * @throws { BusinessError } 13900023 - Text file busy + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900029 - Resource deadlock would occur + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @throws { BusinessError } 13900044 - Network is unreachable + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 + */ + function createRandomAccessFile(file: string | File, mode?: number, + options?: RandomAccessFileOptions): Promise; -/** - * Read file with sync interface. - * - * @param { number } fd - file descriptor. - * @param { ArrayBuffer } buffer - buffer. - * @param { object } [options] - options. - * @returns { number } Returns the number of file bytes read to buffer. - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900010 - Try again - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 - */ -/** - * Read file with sync interface. - * - * @param { number } fd - file descriptor. - * @param { ArrayBuffer } buffer - buffer. - * @param { object } [options] - options. - * @returns { number } Returns the number of file bytes read to buffer. - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900010 - Try again - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @since 10 - */ -/** - * Read file with sync interface. - * - * @param { number } fd - file descriptor. - * @param { ArrayBuffer } buffer - buffer. - * @param { ReadOptions } [options] - options. - * @returns { number } Returns the number of file bytes read to buffer. - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900010 - Try again - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice - * @since 11 - */ -/** - * Read file with sync interface. - * - * @param { number } fd - file descriptor. - * @param { ArrayBuffer } buffer - buffer. - * @param { ReadOptions } [options] - options. - * @returns { number } Returns the number of file bytes read to buffer. - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900010 - Try again - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900042 - Unknown error - * @throws { BusinessError } 13900044 - Network is unreachable - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice - * @since 12 - */ -declare function readSync( - fd: number, - buffer: ArrayBuffer, - options?: ReadOptions -): number; + /** + * Create class RandomAccessFile. + * + * @param { string | File } file - file path, object. + * @param { AsyncCallback } callback - The callback is used to return the RandomAccessFile object which has been created. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900006 - No such device or address + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900017 - No such device + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900022 - Too many open files + * @throws { BusinessError } 13900023 - Text file busy + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900029 - Resource deadlock would occur + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 + */ + function createRandomAccessFile(file: string | File, callback: AsyncCallback): void; -/** - * Read content line by line. - * - * @param { string } filePath - file path. - * @param { Options } [options] - optional parameters - * @returns { Promise } Returns the iterator object in promise mode. - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900015 - File exists - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900022 - Too many open files - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900027 - Read-only file system - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 11 - */ -/** - * Read content line by line. - * - * @param { string } filePath - file path. - * @param { Options } [options] - optional parameters - * @returns { Promise } Returns the iterator object in promise mode. - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900015 - File exists - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900022 - Too many open files - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900027 - Read-only file system - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @throws { BusinessError } 13900044 - Network is unreachable - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 12 - */ -declare function readLines(filePath: string, options?: Options): Promise; + /** + * Create class RandomAccessFile. + * + * @param { string | File } file - file path, object. + * @param { number } [mode = OpenMode.READ_ONLY] - mode. + * @param { AsyncCallback } callback - The callback is used to return the RandomAccessFile object which has been created. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900006 - No such device or address + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900017 - No such device + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900022 - Too many open files + * @throws { BusinessError } 13900023 - Text file busy + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900029 - Resource deadlock would occur + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 + */ + function createRandomAccessFile(file: string | File, mode: number, callback: AsyncCallback): void; + + /** + * Create class RandomAccessFile with sync interface. + * + * @param { string | File } file - file path, object. + * @param { number } [mode = OpenMode.READ_ONLY] - mode. + * @returns { RandomAccessFile } Returns the RandomAccessFile object which has been created. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900006 - No such device or address + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900017 - No such device + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900022 - Too many open files + * @throws { BusinessError } 13900023 - Text file busy + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900029 - Resource deadlock would occur + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 10 + */ + /** + * Create class RandomAccessFile with sync interface. + * + * @param { string | File } file - file path, object. + * @param { number } [mode = OpenMode.READ_ONLY] - mode. + * @param { RandomAccessFileOptions } [options] - RandomAccessFile options + * @returns { RandomAccessFile } Returns the RandomAccessFile object which has been created. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900006 - No such device or address + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900017 - No such device + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900022 - Too many open files + * @throws { BusinessError } 13900023 - Text file busy + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900029 - Resource deadlock would occur + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @throws { BusinessError } 13900044 - Network is unreachable + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 + */ + function createRandomAccessFileSync(file: string | File, mode?: number, + options?: RandomAccessFileOptions): RandomAccessFile; -/** - * Read content line by line. - * - * @param { string } filePath - file path. - * @param { AsyncCallback } callback - The callback is used to return the iterator object. - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900015 - File exists - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900022 - Too many open files - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900027 - Read-only file system - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 11 - */ -declare function readLines(filePath: string, callback: AsyncCallback): void; + /** + * Create file read stream. + * + * @param { string } path - file path. + * @param { ReadStreamOptions } [options] - Optional parameters for ReadStream. + * @returns { ReadStream } Returns the ReadStream object which has been created. + * @throws { BusinessError } 401 - Parameter error + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900017 - No such device + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900022 - Too many open files + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @throws { BusinessError } 13900044 - Network is unreachable + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 + */ + function createReadStream(path: string, options?: ReadStreamOptions): ReadStream; -/** - * Read content line by line. - * - * @param { string } filePath - file path. - * @param { Options } options - optional parameters - * @param { AsyncCallback } callback - The callback is used to return the iterator object. - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900015 - File exists - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900022 - Too many open files - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900027 - Read-only file system - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 11 - */ -declare function readLines(filePath: string, options: Options, callback: AsyncCallback): void; + /** + * Create file write stream. + * + * @param { string } path - file path. + * @param { WriteStreamOptions } [options] - Optional parameters for ReadStream. + * @returns { WriteStream } Returns the WriteStream object which has been created. + * @throws { BusinessError } 401 - Parameter error + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900017 - No such device + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900022 - Too many open files + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 + */ + function createWriteStream(path: string, options?: WriteStreamOptions): WriteStream; -/** - * Read content line by line with sync interface. - * - * @param { string } filePath - file path. - * @param { Options } [options] - optional parameters - * @returns { ReaderIterator } Returns the iterator object. - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900015 - File exists - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900022 - Too many open files - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900027 - Read-only file system - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 11 - */ -/** - * Read content line by line with sync interface. - * - * @param { string } filePath - file path. - * @param { Options } [options] - optional parameters - * @returns { ReaderIterator } Returns the iterator object. - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900015 - File exists - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900022 - Too many open files - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900027 - Read-only file system - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @throws { BusinessError } 13900044 - Network is unreachable - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 12 - */ -declare function readLinesSync(filePath: string, options?: Options): ReaderIterator; + /** + * Create watcher to listen for file changes. + * + * @param { string } path - path. + * @param { number } events - listened events. + * @param { WatchEventListener } listener - Callback to invoke when an event of the specified type occurs. + * @returns { Watcher } Returns the Watcher object which has been created. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900021 - File table overflow + * @throws { BusinessError } 13900022 - Too many open files + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 10 + */ + function createWatcher(path: string, events: number, listener: WatchEventListener): Watcher; -/** - * Read text. - * - * @param { string } filePath - file path. - * @param { object } [options] - options. - * @returns { Promise } Returns the contents of the read file in promise mode. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900010 - Try again - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900024 - File too large - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 - */ -/** - * Read text. - * - * @param { string } filePath - file path. - * @param { object } [options] - options. - * @returns { Promise } Returns the contents of the read file in promise mode. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900010 - Try again - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900024 - File too large - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @since 10 - */ -/** - * Read text. - * - * @param { string } filePath - file path. - * @param { ReadTextOptions } [options] - options. - * @returns { Promise } Returns the contents of the read file in promise mode. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900010 - Try again - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900024 - File too large - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice - * @since 11 - */ -/** - * Read text. - * - * @param { string } filePath - file path. - * @param { ReadTextOptions } [options] - options. - * @returns { Promise } Returns the contents of the read file in promise mode. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900010 - Try again - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900024 - File too large - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @throws { BusinessError } 13900044 - Network is unreachable - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice - * @since 12 - */ -declare function readText( - filePath: string, - options?: ReadTextOptions -): Promise; + /** + * Duplicate fd to File Object. + * + * @param { number } fd - fd. + * @returns { File } return File + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900022 - Too many open files + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 + */ + function dup(fd: number): File; -/** - * Read text. - * - * @param { string } filePath - file path. - * @param { AsyncCallback } callback - The callback is used to return the contents of the read file. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900010 - Try again - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900024 - File too large - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 - */ -/** - * Read text. - * - * @param { string } filePath - file path. - * @param { AsyncCallback } callback - The callback is used to return the contents of the read file. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900010 - Try again - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900024 - File too large - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @since 10 - */ -/** - * Read text. - * - * @param { string } filePath - file path. - * @param { AsyncCallback } callback - The callback is used to return the contents of the read file. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900010 - Try again - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900024 - File too large - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice - * @since 11 - */ -declare function readText(filePath: string, callback: AsyncCallback): void; + /** + * Synchronize file metadata. + * + * @param { number } fd - fd. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + /** + * Synchronize file metadata. + * + * @param { number } fd - fd. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 + */ + function fdatasync(fd: number): Promise; -/** - * Read text. - * - * @param { string } filePath - file path. - * @param { object } [options] - options. - * @param { AsyncCallback } callback - The callback is used to return the contents of the read file. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900010 - Try again - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900024 - File too large - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 - */ -/** - * Read text. - * - * @param { string } filePath - file path. - * @param { object } [options] - options. - * @param { AsyncCallback } callback - The callback is used to return the contents of the read file. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900010 - Try again - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900024 - File too large - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @since 10 - */ -/** - * Read text. - * - * @param { string } filePath - file path. - * @param { ReadTextOptions } [options] - options. - * @param { AsyncCallback } callback - The callback is used to return the contents of the read file. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900010 - Try again - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900024 - File too large - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice - * @since 11 - */ -declare function readText( - filePath: string, - options: ReadTextOptions, - callback: AsyncCallback -): void; + /** + * Synchronize file metadata. + * + * @param { number } fd - fd. + * @param { AsyncCallback } callback - Return the callback function. + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + /** + * Synchronize file metadata. + * + * @param { number } fd - fd. + * @param { AsyncCallback } callback - Return the callback function. + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 + */ + function fdatasync(fd: number, callback: AsyncCallback): void; -/** - * Read text with sync interface. - * - * @param { string } filePath - file path. - * @param { object } [options] - options. - * @returns { string } Returns the contents of the read file. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900010 - Try again - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900024 - File too large - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 - */ -/** - * Read text with sync interface. - * - * @param { string } filePath - file path. - * @param { object } [options] - options. - * @returns { string } Returns the contents of the read file. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900010 - Try again - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900024 - File too large - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @since 10 - */ -/** - * Read text with sync interface. - * - * @param { string } filePath - file path. - * @param { ReadTextOptions } [options] - options. - * @returns { string } Returns the contents of the read file. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900010 - Try again - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900024 - File too large - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice - * @since 11 - */ -/** - * Read text with sync interface. - * - * @param { string } filePath - file path. - * @param { ReadTextOptions } [options] - options. - * @returns { string } Returns the contents of the read file. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900010 - Try again - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900024 - File too large - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @throws { BusinessError } 13900044 - Network is unreachable - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice - * @since 12 - */ -declare function readTextSync( - filePath: string, - options?: ReadTextOptions -): string; + /** + * Synchronize file metadata with sync interface. + * + * @param { number } fd - fd. + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + /** + * Synchronize file metadata with sync interface. + * + * @param { number } fd - fd. + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 + */ + function fdatasyncSync(fd: number): void; -/** - * Rename file. - * - * @param { string } oldPath - oldPath. - * @param { string } newPath - newPath. - * @returns { Promise } The promise returned by the function. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900014 - Device or resource busy - * @throws { BusinessError } 13900015 - File exists - * @throws { BusinessError } 13900016 - Cross-device link - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900027 - Read-only file system - * @throws { BusinessError } 13900028 - Too many links - * @throws { BusinessError } 13900032 - Directory not empty - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 - */ -/** - * Rename file. - * - * @param { string } oldPath - oldPath. - * @param { string } newPath - newPath. - * @returns { Promise } The promise returned by the function. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900014 - Device or resource busy - * @throws { BusinessError } 13900015 - File exists - * @throws { BusinessError } 13900016 - Cross-device link - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900027 - Read-only file system - * @throws { BusinessError } 13900028 - Too many links - * @throws { BusinessError } 13900032 - Directory not empty - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @since 10 - */ -/** - * Rename file. - * - * @param { string } oldPath - oldPath. - * @param { string } newPath - newPath. - * @returns { Promise } The promise returned by the function. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900014 - Device or resource busy - * @throws { BusinessError } 13900015 - File exists - * @throws { BusinessError } 13900016 - Cross-device link - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900027 - Read-only file system - * @throws { BusinessError } 13900028 - Too many links - * @throws { BusinessError } 13900032 - Directory not empty - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice - * @since 11 - */ -declare function rename(oldPath: string, newPath: string): Promise; + /** + * Create class Stream by using fd. + * + * @param { number } fd - fd. + * @param { string } mode - mode. + * @returns { Promise } Returns the Stream object in promise mode. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900006 - No such device or address + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900017 - No such device + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900022 - Too many open files + * @throws { BusinessError } 13900023 - Text file busy + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900029 - Resource deadlock would occur + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 + */ + function fdopenStream(fd: number, mode: string): Promise; -/** - * Rename file. - * - * @param { string } oldPath - oldPath. - * @param { string } newPath - newPath. - * @param { AsyncCallback } callback - Returns the callback function. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900014 - Device or resource busy - * @throws { BusinessError } 13900015 - File exists - * @throws { BusinessError } 13900016 - Cross-device link - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900027 - Read-only file system - * @throws { BusinessError } 13900028 - Too many links - * @throws { BusinessError } 13900032 - Directory not empty - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 - */ -/** - * Rename file. - * - * @param { string } oldPath - oldPath. - * @param { string } newPath - newPath. - * @param { AsyncCallback } callback - Returns the callback function. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900014 - Device or resource busy - * @throws { BusinessError } 13900015 - File exists - * @throws { BusinessError } 13900016 - Cross-device link - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900027 - Read-only file system - * @throws { BusinessError } 13900028 - Too many links - * @throws { BusinessError } 13900032 - Directory not empty - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @since 10 - */ -/** - * Rename file. - * - * @param { string } oldPath - oldPath. - * @param { string } newPath - newPath. - * @param { AsyncCallback } callback - Returns the callback function. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900014 - Device or resource busy - * @throws { BusinessError } 13900015 - File exists - * @throws { BusinessError } 13900016 - Cross-device link - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900027 - Read-only file system - * @throws { BusinessError } 13900028 - Too many links - * @throws { BusinessError } 13900032 - Directory not empty - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice - * @since 11 - */ -declare function rename(oldPath: string, newPath: string, callback: AsyncCallback): void; + /** + * Create class Stream by using fd. + * + * @param { number } fd - fd. + * @param { string } mode - mode. + * @param { AsyncCallback } callback - The callback is used to return the Stream object. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900006 - No such device or address + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900017 - No such device + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900022 - Too many open files + * @throws { BusinessError } 13900023 - Text file busy + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900029 - Resource deadlock would occur + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 + */ + function fdopenStream(fd: number, mode: string, callback: AsyncCallback): void; -/** - * Rename file with sync interface. - * - * @param { string } oldPath - oldPath. - * @param { string } newPath - newPath. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900014 - Device or resource busy - * @throws { BusinessError } 13900015 - File exists - * @throws { BusinessError } 13900016 - Cross-device link - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900027 - Read-only file system - * @throws { BusinessError } 13900028 - Too many links - * @throws { BusinessError } 13900032 - Directory not empty - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 - */ -/** - * Rename file with sync interface. - * - * @param { string } oldPath - oldPath. - * @param { string } newPath - newPath. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900014 - Device or resource busy - * @throws { BusinessError } 13900015 - File exists - * @throws { BusinessError } 13900016 - Cross-device link - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900027 - Read-only file system - * @throws { BusinessError } 13900028 - Too many links - * @throws { BusinessError } 13900032 - Directory not empty - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @since 10 - */ -/** - * Rename file with sync interface. - * - * @param { string } oldPath - oldPath. - * @param { string } newPath - newPath. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900014 - Device or resource busy - * @throws { BusinessError } 13900015 - File exists - * @throws { BusinessError } 13900016 - Cross-device link - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900027 - Read-only file system - * @throws { BusinessError } 13900028 - Too many links - * @throws { BusinessError } 13900032 - Directory not empty - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice - * @since 11 - */ -declare function renameSync(oldPath: string, newPath: string): void; + /** + * Create class Stream by using fd with sync interface. + * + * @param { number } fd - fd. + * @param { string } mode - mode. + * @returns { Stream } Returns the Stream object. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900006 - No such device or address + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900017 - No such device + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900022 - Too many open files + * @throws { BusinessError } 13900023 - Text file busy + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900029 - Resource deadlock would occur + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 + */ + function fdopenStreamSync(fd: number, mode: string): Stream; -/** - * Delete dir. - * - * @param { string } path - path. - * @returns { Promise } The promise returned by the function. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900014 - Device or resource busy - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900027 - Read-only file system1 - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900032 - Directory not empty - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 - */ -/** - * Delete dir. - * - * @param { string } path - path. - * @returns { Promise } The promise returned by the function. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900014 - Device or resource busy - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900027 - Read-only file system1 - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900032 - Directory not empty - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @since 10 - */ -/** - * Delete dir. - * - * @param { string } path - path. - * @returns { Promise } The promise returned by the function. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900014 - Device or resource busy - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900027 - Read-only file system1 - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900032 - Directory not empty - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice - * @since 11 - */ -declare function rmdir(path: string): Promise; + /** + * Synchronize file. + * + * @param { number } fd - fd. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + /** + * Synchronize file. + * + * @param { number } fd - fd. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 + */ + function fsync(fd: number): Promise; -/** - * Delete dir. - * - * @param { string } path - path. - * @param { AsyncCallback } callback - Return the callback function. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900014 - Device or resource busy - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900027 - Read-only file system1 - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900032 - Directory not empty - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 - */ -/** - * Delete dir. - * - * @param { string } path - path. - * @param { AsyncCallback } callback - Return the callback function. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900014 - Device or resource busy - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900027 - Read-only file system1 - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900032 - Directory not empty - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @since 10 - */ -/** - * Delete dir. - * - * @param { string } path - path. - * @param { AsyncCallback } callback - Return the callback function. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900014 - Device or resource busy - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900027 - Read-only file system1 - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900032 - Directory not empty - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice - * @since 11 - */ -declare function rmdir(path: string, callback: AsyncCallback): void; + /** + * Synchronize file. + * + * @param { number } fd - fd. + * @param { AsyncCallback } callback - Return the callback function. + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + /** + * Synchronize file. + * + * @param { number } fd - fd. + * @param { AsyncCallback } callback - Return the callback function. + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 + */ + function fsync(fd: number, callback: AsyncCallback): void; -/** - * Delete dir with sync interface. - * - * @param { string } path - path. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900014 - Device or resource busy - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900027 - Read-only file system1 - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900032 - Directory not empty - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 - */ -/** - * Delete dir with sync interface. - * - * @param { string } path - path. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900014 - Device or resource busy - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900027 - Read-only file system1 - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900032 - Directory not empty - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @since 10 - */ -/** - * Delete dir with sync interface. - * - * @param { string } path - path. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900014 - Device or resource busy - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900027 - Read-only file system1 - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900032 - Directory not empty - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice - * @since 11 - */ -declare function rmdirSync(path: string): void; + /** + * Synchronize file with sync interface. + * + * @param { number } fd - fd. + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + /** + * Synchronize file with sync interface. + * + * @param { number } fd - fd. + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 + */ + function fsyncSync(fd: number): void; -/** - * Get file information. - * - * @param { string | number } file - path or file descriptor. - * @returns { Promise } Returns the Stat object in promise mode. - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900031 - Function not implemented - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900038 - Value too large for defined data type - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 - */ -/** - * Get file information. - * - * @param { string | number } file - path or file descriptor. - * @returns { Promise } Returns the Stat object in promise mode. - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900031 - Function not implemented - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900038 - Value too large for defined data type - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @since 10 - */ -/** - * Get file information. - * - * @param { string | number } file - path or file descriptor. - * @returns { Promise } Returns the Stat object in promise mode. - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900031 - Function not implemented - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900038 - Value too large for defined data type - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice - * @since 11 - */ -declare function stat(file: string | number): Promise; + /** + * List file. + * + * @param { string } path - path. + * @param { object } [options] - options. + * @returns { Promise } Returns an Array containing the name of files or directories that meet the filter criteria in promise mode. + * If present, Include the subdirectory structure. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + /** + * List file. + * + * @param { string } path - path. + * @param { object } [options] - options. + * @returns { Promise } Returns an Array containing the name of files or directories that meet the filter criteria. + * If present, Include the subdirectory structure. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ + /** + * List file. + * + * @param { string } path - path. + * @param { ListFileOptions } [options] - options. + * @returns { Promise } Returns an Array containing the name of files or directories that meet the filter criteria. + * If present, Include the subdirectory structure. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 + */ + function listFile( + path: string, + options?: ListFileOptions + ): Promise; -/** - * Get file information. - * - * @param { string | number } file - path or file descriptor. - * @param { AsyncCallback } callback - The callback is used to return the Stat object. - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900031 - Function not implemented - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900038 - Value too large for defined data type - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 - */ -/** - * Get file information. - * - * @param { string | number } file - path or file descriptor. - * @param { AsyncCallback } callback - The callback is used to return the Stat object. - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900031 - Function not implemented - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900038 - Value too large for defined data type - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @since 10 - */ -/** - * Get file information. - * - * @param { string | number } file - path or file descriptor. - * @param { AsyncCallback } callback - The callback is used to return the Stat object. - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900031 - Function not implemented - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900038 - Value too large for defined data type - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice - * @since 11 - */ -declare function stat(file: string | number, callback: AsyncCallback): void; + /** + * List file. + * + * @param { string } path - path. + * @param { AsyncCallback } callback - The callback is used to return an Array containing the name of files or directories + * that meet the filter criteria in promise mode. If present, Include the subdirectory structure. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + /** + * List file. + * + * @param { string } path - path. + * @param { AsyncCallback } callback - The callback is used to return an Array containing the name of files or directories + * that meet the filter criteria in promise mode. If present, Include the subdirectory structure. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ + /** + * List file. + * + * @param { string } path - path. + * @param { AsyncCallback } callback - The callback is used to return an Array containing the name of files or directories + * that meet the filter criteria in promise mode. If present, Include the subdirectory structure. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 + */ + function listFile(path: string, callback: AsyncCallback): void; -/** - * Get file information with sync interface. - * - * @param { string | number } file - path or file descriptor. - * @returns { Stat } Returns the Stat object. - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900031 - Function not implemented - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900038 - Value too large for defined data type - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 - */ -/** - * Get file information with sync interface. - * - * @param { string | number } file - path or file descriptor. - * @returns { Stat } Returns the Stat object. - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900031 - Function not implemented - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900038 - Value too large for defined data type - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @since 10 - */ -/** - * Get file information with sync interface. - * - * @param { string | number } file - path or file descriptor. - * @returns { Stat } Returns the Stat object. - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900031 - Function not implemented - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900038 - Value too large for defined data type - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice - * @since 11 - */ -declare function statSync(file: string | number): Stat; + /** + * List file. + * + * @param { string } path - path. + * @param { object } [options] - options. + * @param { AsyncCallback } callback - The callback is used to return an Array containing the name of files or directories + * that meet the filter criteria in promise mode. If present, Include the subdirectory structure. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + /** + * List file. + * + * @param { string } path - path. + * @param { object } [options] - options. + * @param { AsyncCallback } callback - The callback is used to return an Array containing the name of files or directories + * that meet the filter criteria in promise mode. If present, Include the subdirectory structure. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ + /** + * List file. + * + * @param { string } path - path. + * @param { ListFileOptions } [options] - options. + * @param { AsyncCallback } callback - The callback is used to return an Array containing the name of files or directories + * that meet the filter criteria in promise mode. If present, Include the subdirectory structure. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 + */ + function listFile( + path: string, + options: ListFileOptions, + callback: AsyncCallback + ): void; -/** - * Link file. - * - * @param { string } target - target. - * @param { string } srcPath - srcPath. - * @returns { Promise } The promise returned by the function. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900015 - File exists - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900027 - Read-only file system - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 - */ -declare function symlink(target: string, srcPath: string): Promise; + /** + * List file with sync interface. + * + * @param { string } path - path. + * @param { object } [options] - options. + * @returns { string[] } Returns an Array containing the name of files or directories that meet the filter criteria. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + /** + * List file with sync interface. + * + * @param { string } path - path. + * @param { object } [options] - options. + * @returns { string[] } Returns an Array containing the name of files or directories that meet the filter criteria. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ + /** + * List file with sync interface. + * + * @param { string } path - path. + * @param { ListFileOptions } [options] - options. + * @returns { string[] } Returns an Array containing the name of files or directories that meet the filter criteria. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 + */ + function listFileSync( + path: string, + options?: ListFileOptions + ): string[]; -/** - * Link file. - * - * @param { string } target - target. - * @param { string } srcPath - srcPath. - * @param { AsyncCallback } callback - Return the callback function. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900015 - File exists - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900027 - Read-only file system - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 - */ -declare function symlink(target: string, srcPath: string, callback: AsyncCallback): void; + /** + * Reposition file offset. + * + * @param { number } fd - file descriptor. + * @param { number } offset - file offset. + * @param { WhenceType } [whence = WhenceType.SEEK_SET] - directive whence. + * @returns { number } Returns the file offset relative to starting position of file. + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900026 - Illegal seek + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 11 + */ + /** + * Reposition file offset. + * + * @param { number } fd - file descriptor. + * @param { number } offset - file offset. + * @param { WhenceType } [whence = WhenceType.SEEK_SET] - directive whence. + * @returns { number } Returns the file offset relative to starting position of file. + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900026 - Illegal seek + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 + */ + function lseek(fd: number, offset: number, whence?: WhenceType): number; -/** - * Link file with sync interface. - * - * @param { string } target - target. - * @param { string } srcPath - srcPath. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900015 - File exists - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900027 - Read-only file system - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 - */ -declare function symlinkSync(target: string, srcPath: string): void; + /** + * Stat link file. + * + * @param { string } path - path. + * @returns { Promise } Returns the Stat object in promise mode. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 + */ + function lstat(path: string): Promise; + + /** + * Stat link file. + * + * @param { string } path - path. + * @param { AsyncCallback } callback - The callback is used to return the Stat object. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 + */ + function lstat(path: string, callback: AsyncCallback): void; -/** - * Truncate file. - * - * @param { string | number } file - path or file descriptor. - * @param { number } [len = 0] - len. - * @returns { Promise } The promise returned by the function. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900023 - Text file busy - * @throws { BusinessError } 13900024 - File too large - * @throws { BusinessError } 13900027 - Read-only file system - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 - */ -/** - * Truncate file. - * - * @param { string | number } file - path or file descriptor. - * @param { number } [len = 0] - len. - * @returns { Promise } The promise returned by the function. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900023 - Text file busy - * @throws { BusinessError } 13900024 - File too large - * @throws { BusinessError } 13900027 - Read-only file system - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @since 10 - */ -/** - * Truncate file. - * - * @param { string | number } file - path or file descriptor. - * @param { number } [len = 0] - len. - * @returns { Promise } The promise returned by the function. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900023 - Text file busy - * @throws { BusinessError } 13900024 - File too large - * @throws { BusinessError } 13900027 - Read-only file system - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice - * @since 11 - */ -declare function truncate(file: string | number, len?: number): Promise; + /** + * Stat link file with sync interface. + * + * @param { string } path - path. + * @returns { Stat } Returns the Stat object. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 + */ + function lstatSync(path: string): Stat; -/** - * Truncate file. - * - * @param { string | number } file - path or file descriptor. - * @param { AsyncCallback } callback - Return the callback function. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900023 - Text file busy - * @throws { BusinessError } 13900024 - File too large - * @throws { BusinessError } 13900027 - Read-only file system - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 - */ -/** - * Truncate file. - * - * @param { string | number } file - path or file descriptor. - * @param { AsyncCallback } callback - Return the callback function. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900023 - Text file busy - * @throws { BusinessError } 13900024 - File too large - * @throws { BusinessError } 13900027 - Read-only file system - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @since 10 - */ -/** - * Truncate file. - * - * @param { string | number } file - path or file descriptor. - * @param { AsyncCallback } callback - Return the callback function. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900023 - Text file busy - * @throws { BusinessError } 13900024 - File too large - * @throws { BusinessError } 13900027 - Read-only file system - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice - * @since 11 - */ -declare function truncate(file: string | number, callback: AsyncCallback): void; + /** + * Make dir. + * + * @param { string } path - path. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900028 - Too many links + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + /** + * Make dir. + * + * @param { string } path - path. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900028 - Too many links + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ + /** + * Make dir. + * + * @param { string } path - path. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900028 - Too many links + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 + */ + function mkdir(path: string): Promise; -/** - * Truncate file. - * - * @param { string | number } file - path or file descriptor. - * @param { number } [len = 0] - len. - * @param { AsyncCallback } callback - Return the callback function. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900023 - Text file busy - * @throws { BusinessError } 13900024 - File too large - * @throws { BusinessError } 13900027 - Read-only file system - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 - */ -/** - * Truncate file. - * - * @param { string | number } file - path or file descriptor. - * @param { number } [len = 0] - len. - * @param { AsyncCallback } callback - Return the callback function. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900023 - Text file busy - * @throws { BusinessError } 13900024 - File too large - * @throws { BusinessError } 13900027 - Read-only file system - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @since 10 - */ -/** - * Truncate file. - * - * @param { string | number } file - path or file descriptor. - * @param { number } [len = 0] - len. - * @param { AsyncCallback } callback - Return the callback function. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900023 - Text file busy - * @throws { BusinessError } 13900024 - File too large - * @throws { BusinessError } 13900027 - Read-only file system - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice - * @since 11 - */ -declare function truncate(file: string | number, len: number, callback: AsyncCallback): void; + /** + * Make dir. + * + * @param { string } path - path. + * @param { boolean } recursion - whether to recursively make directory. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900028 - Too many links + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @atomicservice + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 + */ + function mkdir(path: string, recursion: boolean): Promise; -/** - * Truncate file with sync interface. - * - * @param { string | number } file - path or file descriptor. - * @param { number } [len = 0] - len. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900023 - Text file busy - * @throws { BusinessError } 13900024 - File too large - * @throws { BusinessError } 13900027 - Read-only file system - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 - */ -/** - * Truncate file with sync interface. - * - * @param { string | number } file - path or file descriptor. - * @param { number } [len = 0] - len. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900023 - Text file busy - * @throws { BusinessError } 13900024 - File too large - * @throws { BusinessError } 13900027 - Read-only file system - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @since 10 - */ -/** - * Truncate file with sync interface. - * - * @param { string | number } file - path or file descriptor. - * @param { number } [len = 0] - len. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900023 - Text file busy - * @throws { BusinessError } 13900024 - File too large - * @throws { BusinessError } 13900027 - Read-only file system - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice - * @since 11 - */ -declare function truncateSync(file: string | number, len?: number): void; + /** + * Make dir. + * + * @param { string } path - path. + * @param { AsyncCallback } callback - Return the callback function. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900028 - Too many links + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + /** + * Make dir. + * + * @param { string } path - path. + * @param { AsyncCallback } callback - Return the callback function. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900028 - Too many links + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ + /** + * Make dir. + * + * @param { string } path - path. + * @param { AsyncCallback } callback - Return the callback function. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900028 - Too many links + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 + */ + function mkdir(path: string, callback: AsyncCallback): void; -/** - * Delete file. - * - * @param { string } path - path. - * @returns { Promise } The promise returned by the function. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900014 - Device or resource busy - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900027 - Read-only file system - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 - */ -/** - * Delete file. - * - * @param { string } path - path. - * @returns { Promise } The promise returned by the function. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900014 - Device or resource busy - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900027 - Read-only file system - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @since 10 - */ -/** - * Delete file. - * - * @param { string } path - path. - * @returns { Promise } The promise returned by the function. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900014 - Device or resource busy - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900027 - Read-only file system - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice - * @since 11 - */ -declare function unlink(path: string): Promise; + /** + * Make dir. + * + * @param { string } path - path. + * @param { boolean } recursion - whether to recursively make directory. + * @param { AsyncCallback } callback - Return the callback function. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900028 - Too many links + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @atomicservice + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 + */ + function mkdir(path: string, recursion: boolean, callback: AsyncCallback): void; -/** - * Delete file. - * - * @param { string } path - path. - * @param { AsyncCallback } callback - Return the callback function. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900014 - Device or resource busy - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900027 - Read-only file system - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 - */ -/** - * Delete file. - * - * @param { string } path - path. - * @param { AsyncCallback } callback - Return the callback function. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900014 - Device or resource busy - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900027 - Read-only file system - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @since 10 - */ -/** - * Delete file. - * - * @param { string } path - path. - * @param { AsyncCallback } callback - Return the callback function. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900014 - Device or resource busy - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900027 - Read-only file system - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice - * @since 11 - */ -declare function unlink(path: string, callback: AsyncCallback): void; + /** + * Make dir with sync interface. + * + * @param { string } path - path. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900028 - Too many links + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + /** + * Make dir with sync interface. + * + * @param { string } path - path. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900028 - Too many links + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ + /** + * Make dir with sync interface. + * + * @param { string } path - path. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900028 - Too many links + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 + */ + function mkdirSync(path: string): void; -/** - * Delete file with sync interface. - * - * @param { string } path - path. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900014 - Device or resource busy - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900027 - Read-only file system - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 - */ -/** - * Delete file with sync interface. - * - * @param { string } path - path. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900014 - Device or resource busy - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900027 - Read-only file system - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @since 10 - */ -/** - * Delete file with sync interface. - * - * @param { string } path - path. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900014 - Device or resource busy - * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900027 - Read-only file system - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice - * @since 11 - */ -declare function unlinkSync(path: string): void; + /** + * Make dir with sync interface. + * + * @param { string } path - path. + * @param { boolean } recursion - whether to recursively make directory. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900028 - Too many links + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @atomicservice + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 + */ + function mkdirSync(path: string, recursion: boolean): void; -/** - * Change file mtime. - * - * @param { string } path - path. - * @param { number } mtime - last modification time - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900027 - Read-only file system - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 11 - */ -/** - * Change file mtime. - * - * @param { string } path - path. - * @param { number } mtime - last modification time - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900027 - Read-only file system - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @since 12 - */ -declare function utimes(path: string, mtime: number): void; + /** + * Make temp dir. + * + * @param { string } prefix - dir prefix. + * @returns { Promise } Returns the path to the new directory in promise mode. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900028 - Too many links + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + /** + * Make temp dir. + * + * @param { string } prefix - dir prefix. + * @returns { Promise } Returns the path to the new directory in promise mode. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900028 - Too many links + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 + */ + function mkdtemp(prefix: string): Promise; -/** - * Write file. - * - * @param { number } fd - file descriptor. - * @param { ArrayBuffer | string } buffer - buffer. - * @param { object } [options] - options. - * @returns { Promise } Returns the number of bytes written to the file in promise mode. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900010 - Try again - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900024 - File too large - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 - */ -/** - * Write file. - * - * @param { number } fd - file descriptor. - * @param { ArrayBuffer | string } buffer - buffer. - * @param { object } [options] - options. - * @returns { Promise } Returns the number of bytes written to the file in promise mode. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900010 - Try again - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900024 - File too large - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @since 10 - */ -/** - * Write file. - * - * @param { number } fd - file descriptor. - * @param { ArrayBuffer | string } buffer - buffer. - * @param { WriteOptions } [options] - options. - * @returns { Promise } Returns the number of bytes written to the file in promise mode. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900010 - Try again - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900024 - File too large - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice - * @since 11 - */ -declare function write( - fd: number, - buffer: ArrayBuffer | string, - options?: WriteOptions -): Promise; + /** + * Make temp dir. + * + * @param { string } prefix - dir prefix. + * @param { AsyncCallback } callback - The callback is used to return the path to the new directory. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900028 - Too many links + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + /** + * Make temp dir. + * + * @param { string } prefix - dir prefix. + * @param { AsyncCallback } callback - The callback is used to return the path to the new directory. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900028 - Too many links + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 + */ + function mkdtemp(prefix: string, callback: AsyncCallback): void; + + /** + * Make temp dir with sync interface. + * + * @param { string } prefix - dir prefix. + * @returns { string } Returns the path to the new directory. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900028 - Too many links + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + /** + * Make temp dir with sync interface. + * + * @param { string } prefix - dir prefix. + * @returns { string } Returns the path to the new directory. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900028 - Too many links + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 + */ + function mkdtempSync(prefix: string): string; -/** - * Write file. - * - * @param { number } fd - file descriptor. - * @param { ArrayBuffer | string } buffer - buffer. - * @param { AsyncCallback } callback - The callback is used to return the number of bytes written to the file. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900010 - Try again - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900024 - File too large - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 - */ -/** - * Write file. - * - * @param { number } fd - file descriptor. - * @param { ArrayBuffer | string } buffer - buffer. - * @param { AsyncCallback } callback - The callback is used to return the number of bytes written to the file. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900010 - Try again - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900024 - File too large - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @since 10 - */ -/** - * Write file. - * - * @param { number } fd - file descriptor. - * @param { ArrayBuffer | string } buffer - buffer. - * @param { AsyncCallback } callback - The callback is used to return the number of bytes written to the file. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900010 - Try again - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900024 - File too large - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice - * @since 11 - */ -declare function write(fd: number, buffer: ArrayBuffer | string, callback: AsyncCallback): void; + /** + * Move directory. + * + * @param { string } src - source file path. + * @param { string } dest - destination file path. + * @param { number } [mode = 0] - move mode when duplicate file name exists. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900016 - Cross-device link + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900028 - Too many links + * @throws { BusinessError } 13900032 - Directory not empty + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 + */ + function moveDir(src: string, dest: string, mode?: number): Promise; -/** - * Write file. - * - * @param { number } fd - file descriptor. - * @param { ArrayBuffer | string } buffer - buffer. - * @param { object } [options] - options. - * @param { AsyncCallback } callback - The callback is used to return the number of bytes written to the file. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900010 - Try again - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900024 - File too large - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 - */ -/** - * Write file. - * - * @param { number } fd - file descriptor. - * @param { ArrayBuffer | string } buffer - buffer. - * @param { object } [options] - options. - * @param { AsyncCallback } callback - The callback is used to return the number of bytes written to the file. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900010 - Try again - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900024 - File too large - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @since 10 - */ -/** - * Write file. - * - * @param { number } fd - file descriptor. - * @param { ArrayBuffer | string } buffer - buffer. - * @param { WriteOptions } [options] - options. - * @param { AsyncCallback } callback - The callback is used to return the number of bytes written to the file. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900010 - Try again - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900024 - File too large - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice - * @since 11 - */ -declare function write( - fd: number, - buffer: ArrayBuffer | string, - options: WriteOptions, - callback: AsyncCallback -): void; + /** + * Move directory. + * + * @param { string } src - source file path. + * @param { string } dest - destination file path. + * @param { AsyncCallback } callback - Return the callback function. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900016 - Cross-device link + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900028 - Too many links + * @throws { BusinessError } 13900032 - Directory not empty + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 + */ + function moveDir(src: string, dest: string, callback: AsyncCallback): void; -/** - * Write file with sync interface. - * - * @param { number } fd - file descriptor. - * @param { ArrayBuffer | string } buffer - buffer. - * @param { object } [options] - options. - * @returns { number } Returns the number of bytes written to the file. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900010 - Try again - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900024 - File too large - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 - */ -/** - * Write file with sync interface. - * - * @param { number } fd - file descriptor. - * @param { ArrayBuffer | string } buffer - buffer. - * @param { object } [options] - options. - * @returns { number } Returns the number of bytes written to the file. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900010 - Try again - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900024 - File too large - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @since 10 - */ -/** - * Write file with sync interface. - * - * @param { number } fd - file descriptor. - * @param { ArrayBuffer | string } buffer - buffer. - * @param { WriteOptions } [options] - options. - * @returns { number } Returns the number of bytes written to the file. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900010 - Try again - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900024 - File too large - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice - * @since 11 - */ -declare function writeSync( - fd: number, - buffer: ArrayBuffer | string, - options?: WriteOptions -): number; + /** + * Move directory. + * + * @param { string } src - source file path. + * @param { string } dest - destination file path. + * @param { AsyncCallback> } callback - Return the callback function. + * @throws { BusinessError } 13900015 - File exists + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 + */ + function moveDir(src: string, dest: string, callback: AsyncCallback>): void; -/** - * Connect Distributed File System. - * - * @permission ohos.permission.DISTRIBUTED_DATASYNC - * @param { string } networkId - The networkId of device. - * @param { DfsListeners } listeners - The listeners of Distributed File System. - * @returns { Promise } The promise returned by the function. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - The parameter check failed.Possible causes:1.Mandatory parameters are left unspecified; - *
2.Incorrect parameter types. - * @throws { BusinessError } 13900045 - Connection failed. - * @throws { BusinessError } 13900046 - Software caused connection abort. - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 12 - */ -declare function connectDfs(networkId: string, listeners: DfsListeners): Promise; + /** + * Move directory. + * + * @param { string } src - source file path. + * @param { string } dest - destination file path. + * @param { number } mode - move mode when duplicate file name exists. + * @param { AsyncCallback } callback - Return the callback function. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900016 - Cross-device link + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900028 - Too many links + * @throws { BusinessError } 13900032 - Directory not empty + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 + */ + function moveDir(src: string, dest: string, mode: number, callback: AsyncCallback): void; -/** - * Disconnect Distributed File System. - * - * @permission ohos.permission.DISTRIBUTED_DATASYNC - * @param { string } networkId - The networkId of device. - * @returns { Promise } The promise returned by the function. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 401 - The parameter check failed.Possible causes:1.Mandatory parameters are left unspecified; - *
2.Incorrect parameter types. - * @throws { BusinessError } 13600004 - Unmount failed. - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 12 - */ -declare function disconnectDfs(networkId: string): Promise; + /** + * Move directory. + * + * @param { string } src - source file path. + * @param { string } dest - destination file path. + * @param { number } mode - move mode when duplicate file name exists. + * @param { AsyncCallback> } callback - Return the callback function. + * @throws { BusinessError } 13900015 - File exists + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 + */ + function moveDir(src: string, dest: string, mode: number, callback: AsyncCallback>): void; -/** - * Set extended attributes information of the file. - * - * @param { string } path - path. - * @param { string } key - the key of extended attribute. - * @param { string } value - the value of extended attribute. - * @returns { Promise } The promise returned by the function. - * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; - *
2.Incorrect parameter types. - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900031 - Function not implemented - * @throws { BusinessError } 13900038 - Value too large for defined data type - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 12 - */ -declare function setxattr(path: string, key: string, value: string): Promise; + /** + * Move directory with sync interface. + * + * @param { string } src - source file path. + * @param { string } dest - destination file path. + * @param { number } [mode = 0] - move mode when duplicate file name exists. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900016 - Cross-device link + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900028 - Too many links + * @throws { BusinessError } 13900032 - Directory not empty + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 + */ + function moveDirSync(src: string, dest: string, mode?: number): void; -/** - * Set extended attributes information of the file. - * - * @param { string } path - path. - * @param { string } key - the key of extended attribute. - * @param { string } value - the value of extended attribute. - * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; - *
2.Incorrect parameter types. - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900011 - Out of memory - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900031 - Function not implemented - * @throws { BusinessError } 13900038 - Value too large for defined data type - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 12 - */ + /** + * Move file. + * + * @param { string } src - source file path. + * @param { string } dest - destination file path. + * @param { number } [mode = 0] - move mode when duplicate file name exists. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900016 - Cross-device link + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900028 - Too many links + * @throws { BusinessError } 13900032 - Directory not empty + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + /** + * Move file. + * + * @param { string } src - source file path. + * @param { string } dest - destination file path. + * @param { number } [mode = 0] - move mode when duplicate file name exists. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900016 - Cross-device link + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900028 - Too many links + * @throws { BusinessError } 13900032 - Directory not empty + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 + */ + function moveFile(src: string, dest: string, mode?: number): Promise; + + /** + * Move file. + * + * @param { string } src - source file path. + * @param { string } dest - destination file path. + * @param { AsyncCallback } callback - Return the callback function. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900016 - Cross-device link + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900028 - Too many links + * @throws { BusinessError } 13900032 - Directory not empty + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + /** + * Move file. + * + * @param { string } src - source file path. + * @param { string } dest - destination file path. + * @param { AsyncCallback } callback - Return the callback function. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900016 - Cross-device link + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900028 - Too many links + * @throws { BusinessError } 13900032 - Directory not empty + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 + */ + function moveFile(src: string, dest: string, callback: AsyncCallback): void; -declare function setxattrSync(path: string, key: string, value: string): void; + /** + * Move file. + * + * @param { string } src - source file path. + * @param { string } dest - destination file path. + * @param { number } [mode = 0] - move mode when duplicate file name exists. + * @param { AsyncCallback } callback - Return the callback function. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900016 - Cross-device link + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900028 - Too many links + * @throws { BusinessError } 13900032 - Directory not empty + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + /** + * Move file. + * + * @param { string } src - source file path. + * @param { string } dest - destination file path. + * @param { number } [mode = 0] - move mode when duplicate file name exists. + * @param { AsyncCallback } callback - Return the callback function. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900016 - Cross-device link + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900028 - Too many links + * @throws { BusinessError } 13900032 - Directory not empty + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 + */ + function moveFile(src: string, dest: string, mode: number, callback: AsyncCallback): void; -/** - * Get extended attributes information of the file. - * - * @param { string } path - path. - * @param { string } key - the key of extended attribute. - * @returns { Promise } The promise returned by the function. - * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; - *
2.Incorrect parameter types. - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900007 - Arg list too long - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900031 - Function not implemented - * @throws { BusinessError } 13900037 - No data available - * @throws { BusinessError } 13900038 - Value too large for defined data type - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 12 - */ -declare function getxattr(path: string, key: string): Promise; + /** + * Move file with sync interface. + * + * @param { string } src - source file path. + * @param { string } dest - destination file path. + * @param { number } [mode = 0] - move mode when duplicate file name exists. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900016 - Cross-device link + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900028 - Too many links + * @throws { BusinessError } 13900032 - Directory not empty + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + /** + * Move file with sync interface. + * + * @param { string } src - source file path. + * @param { string } dest - destination file path. + * @param { number } [mode = 0] - move mode when duplicate file name exists. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900016 - Cross-device link + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900028 - Too many links + * @throws { BusinessError } 13900032 - Directory not empty + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 + */ + function moveFileSync(src: string, dest: string, mode?: number): void; -/** - * Get extended attributes information of the file with sync interface. - * - * @param { string } path - path. - * @param { string } key - the key of extended attribute. - * @returns { string } Return the value of extended attribute. - * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; - *
2.Incorrect parameter types. - * @throws { BusinessError } 13900002 - No such file or directory - * @throws { BusinessError } 13900007 - Arg list too long - * @throws { BusinessError } 13900012 - Permission denied - * @throws { BusinessError } 13900031 - Function not implemented - * @throws { BusinessError } 13900037 - No data available - * @throws { BusinessError } 13900038 - Value too large for defined data type - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 12 - */ -declare function getxattrSync(path: string, key: string): string; + /** + * Open file. + * + * @param { string } path - path. + * @param { number } [mode = OpenMode.READ_ONLY] - mode. + * @returns { Promise } Returns the File object in Promise mode to record the file descriptor. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900006 - No such device or address + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900017 - No such device + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900022 - Too many open files + * @throws { BusinessError } 13900023 - Text file busy + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900029 - Resource deadlock would occur + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + /** + * Open file. + * + * @param { string } path - path. + * @param { number } [mode = OpenMode.READ_ONLY] - mode. + * @returns { Promise } Returns the File object in Promise mode to record the file descriptor. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900006 - No such device or address + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900017 - No such device + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900022 - Too many open files + * @throws { BusinessError } 13900023 - Text file busy + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900029 - Resource deadlock would occur + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ + /** + * Open file. + * + * @param { string } path - path. + * @param { number } [mode = OpenMode.READ_ONLY] - mode. + * @returns { Promise } Returns the File object in Promise mode to record the file descriptor. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900006 - No such device or address + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900017 - No such device + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900022 - Too many open files + * @throws { BusinessError } 13900023 - Text file busy + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900029 - Resource deadlock would occur + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * Open file. + * + * @param { string } path - path. + * @param { number } [mode = OpenMode.READ_ONLY] - mode. + * @returns { Promise } Returns the File object in Promise mode to record the file descriptor. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900006 - No such device or address + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900017 - No such device + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900022 - Too many open files + * @throws { BusinessError } 13900023 - Text file busy + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900029 - Resource deadlock would occur + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @throws { BusinessError } 13900044 - Network is unreachable + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 + */ + function open(path: string, mode?: number): Promise; + + /** + * Open file. + * + * @param { string } path - path. + * @param { AsyncCallback } callback - The callback is used to return the File object to record the file descriptor. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900006 - No such device or address + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900017 - No such device + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900022 - Too many open files + * @throws { BusinessError } 13900023 - Text file busy + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900029 - Resource deadlock would occur + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + /** + * Open file. + * + * @param { string } path - path. + * @param { AsyncCallback } callback - The callback is used to return the File object to record the file descriptor. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900006 - No such device or address + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900017 - No such device + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900022 - Too many open files + * @throws { BusinessError } 13900023 - Text file busy + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900029 - Resource deadlock would occur + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ + /** + * Open file. + * + * @param { string } path - path. + * @param { AsyncCallback } callback - The callback is used to return the File object to record the file descriptor. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900006 - No such device or address + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900017 - No such device + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900022 - Too many open files + * @throws { BusinessError } 13900023 - Text file busy + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900029 - Resource deadlock would occur + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 + */ + function open(path: string, callback: AsyncCallback): void; -/** - * Progress data of copyFile - * - * @typedef Progress - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 11 - */ -interface Progress { /** - * @type { number } - * @readonly + * Open file. + * + * @param { string } path - path. + * @param { number } [mode = OpenMode.READ_ONLY] - mode. + * @param { AsyncCallback } callback - The callback is used to return the File object to record the file descriptor. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900006 - No such device or address + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900017 - No such device + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900022 - Too many open files + * @throws { BusinessError } 13900023 - Text file busy + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900029 - Resource deadlock would occur + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 11 + * @since 9 + */ + /** + * Open file. + * + * @param { string } path - path. + * @param { number } [mode = OpenMode.READ_ONLY] - mode. + * @param { AsyncCallback } callback - The callback is used to return the File object to record the file descriptor. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900006 - No such device or address + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900017 - No such device + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900022 - Too many open files + * @throws { BusinessError } 13900023 - Text file busy + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900029 - Resource deadlock would occur + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ + /** + * Open file. + * + * @param { string } path - path. + * @param { number } [mode = OpenMode.READ_ONLY] - mode. + * @param { AsyncCallback } callback - The callback is used to return the File object to record the file descriptor. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900006 - No such device or address + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900017 - No such device + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900022 - Too many open files + * @throws { BusinessError } 13900023 - Text file busy + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900029 - Resource deadlock would occur + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 */ - readonly processedSize: number; + function open(path: string, mode: number, callback: AsyncCallback): void; /** - * @type { number } - * @readonly + * Open file with sync interface. + * + * @param { string } path - path. + * @param { number } [mode = OpenMode.READ_ONLY] - mode. + * @returns { File } Returns the File object to record the file descriptor. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900006 - No such device or address + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900017 - No such device + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900022 - Too many open files + * @throws { BusinessError } 13900023 - Text file busy + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900029 - Resource deadlock would occur + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + /** + * Open file with sync interface. + * + * @param { string } path - path. + * @param { number } [mode = OpenMode.READ_ONLY] - mode. + * @returns { File } Returns the File object to record the file descriptor. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900006 - No such device or address + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900017 - No such device + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900022 - Too many open files + * @throws { BusinessError } 13900023 - Text file busy + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900029 - Resource deadlock would occur + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ + /** + * Open file with sync interface. + * + * @param { string } path - path. + * @param { number } [mode = OpenMode.READ_ONLY] - mode. + * @returns { File } Returns the File object to record the file descriptor. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900006 - No such device or address + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900017 - No such device + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900022 - Too many open files + * @throws { BusinessError } 13900023 - Text file busy + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900029 - Resource deadlock would occur + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice * @since 11 */ - readonly totalSize: number; -} + /** + * Open file with sync interface. + * + * @param { string } path - path. + * @param { number } [mode = OpenMode.READ_ONLY] - mode. + * @returns { File } Returns the File object to record the file descriptor. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900006 - No such device or address + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900017 - No such device + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900022 - Too many open files + * @throws { BusinessError } 13900023 - Text file busy + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900029 - Resource deadlock would occur + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @throws { BusinessError } 13900044 - Network is unreachable + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 + */ + function openSync(path: string, mode?: number): File; -/** - * Task signal. - * - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 12 - */ -export class TaskSignal { /** - * Cancel the copy task in progress. + * Read file. * + * @param { number } fd - file descriptor. + * @param { ArrayBuffer } buffer - buffer. + * @param { object } [options] - options. + * @returns { Promise } Returns the number of file bytes read to buffer in promise mode. + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor * @throws { BusinessError } 13900010 - Try again - * @throws { BusinessError } 13900012 - Permission denied by the file system - * @throws { BusinessError } 13900043 - No task can be canceled. + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 12 + * @since 9 */ - cancel(): void; - /** - * Subscribe the cancel event of current task. + * Read file. * - * @returns { Promise } Return the result of the cancel event. + * @param { number } fd - file descriptor. + * @param { ArrayBuffer } buffer - buffer. + * @param { object } [options] - options. + * @returns { Promise } Returns the number of file bytes read to buffer in promise mode. * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900034 - Operation would block * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 12 + * @crossplatform + * @since 10 */ - onCancel(): Promise; -} - -/** - * Get options of copy - * - * @typedef CopyOptions - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 11 - */ -interface CopyOptions { /** - * Listener of copy progress + * Read file. * - * @type { ?ProgressListener } + * @param { number } fd - file descriptor. + * @param { ArrayBuffer } buffer - buffer. + * @param { ReadOptions } [options] - options. + * @returns { Promise } Returns the number of file bytes read to buffer in promise mode. + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice * @since 11 */ - progressListener?: ProgressListener; /** - * Cancel signal of copy. + * Read file. * - * @type { ?TaskSignal } + * @param { number } fd - file descriptor. + * @param { ArrayBuffer } buffer - buffer. + * @param { ReadOptions } [options] - options. + * @returns { Promise } Returns the number of file bytes read to buffer in promise mode. + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900042 - Unknown error + * @throws { BusinessError } 13900044 - Network is unreachable * @syscap SystemCapability.FileManagement.File.FileIO - * @since 12 + * @crossplatform + * @atomicservice + * @since {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 */ - copySignal?: TaskSignal; -} - -/** - * Listener of copy progress. - * - * @typedef { function } ProgressListener - * @param { Progress } progress - indicates the progress data of copyFile - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 11 - */ -type ProgressListener = (progress: Progress) => void; + function read( + fd: number, + buffer: ArrayBuffer, + options?: ReadOptions + ): Promise; -/** - * File object. - * - * @interface File - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 - */ -/** - * File object. - * - * @interface File - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @since 10 - */ -/** - * File object. - * - * @interface File - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice - * @since 11 - */ -declare interface File { /** - * @type { number } - * @readonly + * Read file. + * + * @param { number } fd - file descriptor. + * @param { ArrayBuffer } buffer - buffer. + * @param { AsyncCallback } callback - The callback is used to return the number of file bytes read to buffer. + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO * @since 9 */ /** - * @type { number } - * @readonly + * Read file. + * + * @param { number } fd - file descriptor. + * @param { ArrayBuffer } buffer - buffer. + * @param { AsyncCallback } callback - The callback is used to return the number of file bytes read to buffer. + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO * @crossplatform * @since 10 */ /** - * @type { number } - * @readonly + * Read file. + * + * @param { number } fd - file descriptor. + * @param { ArrayBuffer } buffer - buffer. + * @param { AsyncCallback } callback - The callback is used to return the number of file bytes read to buffer. + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO * @crossplatform * @atomicservice - * @since 11 + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 */ - readonly fd: number; + function read(fd: number, buffer: ArrayBuffer, callback: AsyncCallback): void; /** - * File path - * - * @type { string } - * @readonly + * Read file. + * + * @param { number } fd - file descriptor. + * @param { ArrayBuffer } buffer - buffer. + * @param { object } [options] - options. + * @param { AsyncCallback } callback - The callback is used to return the number of file bytes read to buffer. + * @throws { BusinessError } 13900004 - Interrupted system call * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900034 - Operation would block * @throws { BusinessError } 13900042 - Unknown error - * @throws { BusinessError } 14300002 - Invalid URI * @syscap SystemCapability.FileManagement.File.FileIO - * @since 10 + * @since 9 */ - readonly path: string; - /** - * File name - * - * @type { string } - * @readonly + * Read file. + * + * @param { number } fd - file descriptor. + * @param { ArrayBuffer } buffer - buffer. + * @param { object } [options] - options. + * @param { AsyncCallback } callback - The callback is used to return the number of file bytes read to buffer. + * @throws { BusinessError } 13900004 - Interrupted system call * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900034 - Operation would block * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform * @since 10 */ - readonly name: string; - /** - * Get parent path of file. + * Read file. * - * @returns { string } Return the parent path of file. + * @param { number } fd - file descriptor. + * @param { ArrayBuffer } buffer - buffer. + * @param { ReadOptions } [options] - options. + * @param { AsyncCallback } callback - The callback is used to return the number of file bytes read to buffer. + * @throws { BusinessError } 13900004 - Interrupted system call * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900034 - Operation would block * @throws { BusinessError } 13900042 - Unknown error - * @throws { BusinessError } 14300002 - Invalid URI * @syscap SystemCapability.FileManagement.File.FileIO - * @since 11 + * @crossplatform + * @atomicservice + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 */ - getParent(): string; + function read( + fd: number, + buffer: ArrayBuffer, + options: ReadOptions, + callback: AsyncCallback + ): void; /** - * Lock file with blocking method. + * Read file with sync interface. * - * @param { boolean } exclusive - whether lock is exclusive. - * @returns { Promise } The promise returned by the function. + * @param { number } fd - file descriptor. + * @param { ArrayBuffer } buffer - buffer. + * @param { object } [options] - options. + * @returns { number } Returns the number of file bytes read to buffer. * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900019 - Is a directory * @throws { BusinessError } 13900020 - Invalid argument * @throws { BusinessError } 13900034 - Operation would block * @throws { BusinessError } 13900042 - Unknown error - * @throws { BusinessError } 13900043 - No record locks available * @syscap SystemCapability.FileManagement.File.FileIO * @since 9 */ - lock(exclusive?: boolean): Promise; - /** - * Lock file with blocking method. + * Read file with sync interface. * - * @param { AsyncCallback } callback - Return the callback function. + * @param { number } fd - file descriptor. + * @param { ArrayBuffer } buffer - buffer. + * @param { object } [options] - options. + * @returns { number } Returns the number of file bytes read to buffer. * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900019 - Is a directory * @throws { BusinessError } 13900020 - Invalid argument * @throws { BusinessError } 13900034 - Operation would block * @throws { BusinessError } 13900042 - Unknown error - * @throws { BusinessError } 13900043 - No record locks available * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 + * @crossplatform + * @since 10 */ - lock(callback: AsyncCallback): void; - /** - * Lock file with blocking method. + * Read file with sync interface. * - * @param { boolean } exclusive - whether lock is exclusive. - * @param { AsyncCallback } callback - Return the callback function. + * @param { number } fd - file descriptor. + * @param { ArrayBuffer } buffer - buffer. + * @param { ReadOptions } [options] - options. + * @returns { number } Returns the number of file bytes read to buffer. * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900019 - Is a directory * @throws { BusinessError } 13900020 - Invalid argument * @throws { BusinessError } 13900034 - Operation would block * @throws { BusinessError } 13900042 - Unknown error - * @throws { BusinessError } 13900043 - No record locks available * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 + * @crossplatform + * @atomicservice + * @since 11 */ - lock(exclusive: boolean, callback: AsyncCallback): void; - /** - * Try to lock file with returning results immediately. + * Read file with sync interface. * - * @param { boolean } exclusive - whether lock is exclusive. + * @param { number } fd - file descriptor. + * @param { ArrayBuffer } buffer - buffer. + * @param { ReadOptions } [options] - options. + * @returns { number } Returns the number of file bytes read to buffer. * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900019 - Is a directory * @throws { BusinessError } 13900020 - Invalid argument * @throws { BusinessError } 13900034 - Operation would block * @throws { BusinessError } 13900042 - Unknown error - * @throws { BusinessError } 13900043 - No record locks available + * @throws { BusinessError } 13900044 - Network is unreachable * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 + * @crossplatform + * @atomicservice + * @since {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 */ - tryLock(exclusive?: boolean): void; + function readSync( + fd: number, + buffer: ArrayBuffer, + options?: ReadOptions + ): number; /** - * Unlock file. + * Read content line by line. * - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900008 - Bad file descriptor + * @param { string } filePath - file path. + * @param { Options } [options] - optional parameters + * @returns { Promise } Returns the iterator object in promise mode. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900019 - Is a directory * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900022 - Too many open files + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900041 - Quota exceeded * @throws { BusinessError } 13900042 - Unknown error - * @throws { BusinessError } 13900043 - No record locks available * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 + * @since 11 */ - unlock(): void; -} + /** + * Read content line by line. + * + * @param { string } filePath - file path. + * @param { Options } [options] - optional parameters + * @returns { Promise } Returns the iterator object in promise mode. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900022 - Too many open files + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @throws { BusinessError } 13900044 - Network is unreachable + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 + */ + function readLines(filePath: string, options?: Options): Promise; -/** - * RandomAccessFile object. - * - * @interface RandomAccessFile - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 10 - */ -declare interface RandomAccessFile { + /** + * Read content line by line. + * + * @param { string } filePath - file path. + * @param { AsyncCallback } callback - The callback is used to return the iterator object. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900022 - Too many open files + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 + */ + function readLines(filePath: string, callback: AsyncCallback): void; /** - * File descriptor + * Read content line by line. * - * @type { number } - * @readonly + * @param { string } filePath - file path. + * @param { Options } options - optional parameters + * @param { AsyncCallback } callback - The callback is used to return the iterator object. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900022 - Too many open files + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 10 + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 */ - readonly fd: number; + function readLines(filePath: string, options: Options, callback: AsyncCallback): void; /** - * File pointer + * Read content line by line with sync interface. * - * @type { number } - * @readonly + * @param { string } filePath - file path. + * @param { Options } [options] - optional parameters + * @returns { ReaderIterator } Returns the iterator object. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900022 - Too many open files + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 11 + */ + /** + * Read content line by line with sync interface. + * + * @param { string } filePath - file path. + * @param { Options } [options] - optional parameters + * @returns { ReaderIterator } Returns the iterator object. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900022 - Too many open files + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @throws { BusinessError } 13900044 - Network is unreachable * @syscap SystemCapability.FileManagement.File.FileIO - * @since 10 + * @since {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 */ - readonly filePointer: number; + function readLinesSync(filePath: string, options?: Options): ReaderIterator; /** - * Set file pointer. + * Read text. * - * @param { number } filePointer - filePointer. + * @param { string } filePath - file path. + * @param { object } [options] - options. + * @returns { Promise } Returns the contents of the read file in promise mode. + * @throws { BusinessError } 13900001 - Operation not permitted * @throws { BusinessError } 13900004 - Interrupted system call * @throws { BusinessError } 13900005 - I/O error * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900019 - Is a directory * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900041 - Quota exceeded * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 10 + * @since 9 */ - setFilePointer(filePointer: number): void; - /** - * Close randomAccessFile with sync interface. + * Read text. * + * @param { string } filePath - file path. + * @param { object } [options] - options. + * @returns { Promise } Returns the contents of the read file in promise mode. + * @throws { BusinessError } 13900001 - Operation not permitted * @throws { BusinessError } 13900004 - Interrupted system call * @throws { BusinessError } 13900005 - I/O error * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900024 - File too large * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900034 - Operation would block * @throws { BusinessError } 13900041 - Quota exceeded * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform * @since 10 */ - close(): void; - /** - * Write randomAccessFile. + * Read text. * - * @param { ArrayBuffer | string } buffer - buffer. - * @param { object } [options] - options. - * @returns { Promise } Returns the number of bytes written to the file in promise mode. + * @param { string } filePath - file path. + * @param { ReadTextOptions } [options] - options. + * @returns { Promise } Returns the contents of the read file in promise mode. * @throws { BusinessError } 13900001 - Operation not permitted * @throws { BusinessError } 13900004 - Interrupted system call * @throws { BusinessError } 13900005 - I/O error * @throws { BusinessError } 13900008 - Bad file descriptor * @throws { BusinessError } 13900010 - Try again * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900019 - Is a directory * @throws { BusinessError } 13900020 - Invalid argument * @throws { BusinessError } 13900024 - File too large * @throws { BusinessError } 13900025 - No space left on device @@ -6830,45 +4518,53 @@ declare interface RandomAccessFile { * @throws { BusinessError } 13900041 - Quota exceeded * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 10 + * @crossplatform + * @atomicservice + * @since 11 */ /** - * Write randomAccessFile. + * Read text. * - * @param { ArrayBuffer | string } buffer - buffer. - * @param { WriteOptions } [options] - options. - * @returns { Promise } Returns the number of bytes written to the file in promise mode. + * @param { string } filePath - file path. + * @param { ReadTextOptions } [options] - options. + * @returns { Promise } Returns the contents of the read file in promise mode. * @throws { BusinessError } 13900001 - Operation not permitted * @throws { BusinessError } 13900004 - Interrupted system call * @throws { BusinessError } 13900005 - I/O error * @throws { BusinessError } 13900008 - Bad file descriptor * @throws { BusinessError } 13900010 - Try again * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900019 - Is a directory * @throws { BusinessError } 13900020 - Invalid argument * @throws { BusinessError } 13900024 - File too large * @throws { BusinessError } 13900025 - No space left on device * @throws { BusinessError } 13900034 - Operation would block * @throws { BusinessError } 13900041 - Quota exceeded * @throws { BusinessError } 13900042 - Unknown error + * @throws { BusinessError } 13900044 - Network is unreachable * @syscap SystemCapability.FileManagement.File.FileIO - * @since 11 + * @crossplatform + * @atomicservice + * @since {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 */ - write( - buffer: ArrayBuffer | string, - options?: WriteOptions - ): Promise; + function readText( + filePath: string, + options?: ReadTextOptions + ): Promise; /** - * Write randomAccessFile. + * Read text. * - * @param { ArrayBuffer | string } buffer - buffer. - * @param { AsyncCallback } callback - The callback is used to return the number of bytes written to the file. + * @param { string } filePath - file path. + * @param { AsyncCallback } callback - The callback is used to return the contents of the read file. * @throws { BusinessError } 13900001 - Operation not permitted * @throws { BusinessError } 13900004 - Interrupted system call * @throws { BusinessError } 13900005 - I/O error * @throws { BusinessError } 13900008 - Bad file descriptor * @throws { BusinessError } 13900010 - Try again * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900019 - Is a directory * @throws { BusinessError } 13900020 - Invalid argument * @throws { BusinessError } 13900024 - File too large * @throws { BusinessError } 13900025 - No space left on device @@ -6876,22 +4572,20 @@ declare interface RandomAccessFile { * @throws { BusinessError } 13900041 - Quota exceeded * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 10 + * @since 9 */ - write(buffer: ArrayBuffer | string, callback: AsyncCallback): void; - /** - * Write randomAccessFile. + * Read text. * - * @param { ArrayBuffer | string } buffer - buffer. - * @param { object } [options] - options. - * @param { AsyncCallback } callback - The callback is used to return the number of bytes written to the file. + * @param { string } filePath - file path. + * @param { AsyncCallback } callback - The callback is used to return the contents of the read file. * @throws { BusinessError } 13900001 - Operation not permitted * @throws { BusinessError } 13900004 - Interrupted system call * @throws { BusinessError } 13900005 - I/O error * @throws { BusinessError } 13900008 - Bad file descriptor * @throws { BusinessError } 13900010 - Try again * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900019 - Is a directory * @throws { BusinessError } 13900020 - Invalid argument * @throws { BusinessError } 13900024 - File too large * @throws { BusinessError } 13900025 - No space left on device @@ -6899,20 +4593,21 @@ declare interface RandomAccessFile { * @throws { BusinessError } 13900041 - Quota exceeded * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform * @since 10 */ /** - * Write randomAccessFile. + * Read text. * - * @param { ArrayBuffer | string } buffer - buffer. - * @param { WriteOptions } [options] - options. - * @param { AsyncCallback } callback - The callback is used to return the number of bytes written to the file. + * @param { string } filePath - file path. + * @param { AsyncCallback } callback - The callback is used to return the contents of the read file. * @throws { BusinessError } 13900001 - Operation not permitted * @throws { BusinessError } 13900004 - Interrupted system call * @throws { BusinessError } 13900005 - I/O error * @throws { BusinessError } 13900008 - Bad file descriptor * @throws { BusinessError } 13900010 - Try again * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900019 - Is a directory * @throws { BusinessError } 13900020 - Invalid argument * @throws { BusinessError } 13900024 - File too large * @throws { BusinessError } 13900025 - No space left on device @@ -6920,26 +4615,26 @@ declare interface RandomAccessFile { * @throws { BusinessError } 13900041 - Quota exceeded * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 11 + * @crossplatform + * @atomicservice + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 */ - write( - buffer: ArrayBuffer | string, - options: WriteOptions, - callback: AsyncCallback - ): void; + function readText(filePath: string, callback: AsyncCallback): void; /** - * Write randomAccessFile with sync interface. + * Read text. * - * @param { ArrayBuffer | string } buffer - buffer. + * @param { string } filePath - file path. * @param { object } [options] - options. - * @returns { number } Returns the number of bytes written to the file. + * @param { AsyncCallback } callback - The callback is used to return the contents of the read file. * @throws { BusinessError } 13900001 - Operation not permitted * @throws { BusinessError } 13900004 - Interrupted system call * @throws { BusinessError } 13900005 - I/O error * @throws { BusinessError } 13900008 - Bad file descriptor * @throws { BusinessError } 13900010 - Try again * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900019 - Is a directory * @throws { BusinessError } 13900020 - Invalid argument * @throws { BusinessError } 13900024 - File too large * @throws { BusinessError } 13900025 - No space left on device @@ -6947,20 +4642,21 @@ declare interface RandomAccessFile { * @throws { BusinessError } 13900041 - Quota exceeded * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 10 + * @since 9 */ /** - * Write randomAccessFile with sync interface. + * Read text. * - * @param { ArrayBuffer | string } buffer - buffer. - * @param { WriteOptions } [options] - options. - * @returns { number } Returns the number of bytes written to the file. + * @param { string } filePath - file path. + * @param { object } [options] - options. + * @param { AsyncCallback } callback - The callback is used to return the contents of the read file. * @throws { BusinessError } 13900001 - Operation not permitted * @throws { BusinessError } 13900004 - Interrupted system call * @throws { BusinessError } 13900005 - I/O error * @throws { BusinessError } 13900008 - Bad file descriptor * @throws { BusinessError } 13900010 - Try again * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900019 - Is a directory * @throws { BusinessError } 13900020 - Invalid argument * @throws { BusinessError } 13900024 - File too large * @throws { BusinessError } 13900025 - No space left on device @@ -6968,19 +4664,16 @@ declare interface RandomAccessFile { * @throws { BusinessError } 13900041 - Quota exceeded * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 11 + * @crossplatform + * @since 10 */ - writeSync( - buffer: ArrayBuffer | string, - options?: WriteOptions - ): number; - /** - * Read randomAccessFile. + * Read text. * - * @param { ArrayBuffer } buffer - buffer. - * @param { object } [options] - options. - * @returns { Promise } Returns the number of file bytes read to buffer in promise mode. + * @param { string } filePath - file path. + * @param { ReadTextOptions } [options] - options. + * @param { AsyncCallback } callback - The callback is used to return the contents of the read file. + * @throws { BusinessError } 13900001 - Operation not permitted * @throws { BusinessError } 13900004 - Interrupted system call * @throws { BusinessError } 13900005 - I/O error * @throws { BusinessError } 13900008 - Bad file descriptor @@ -6988,17 +4681,30 @@ declare interface RandomAccessFile { * @throws { BusinessError } 13900013 - Bad address * @throws { BusinessError } 13900019 - Is a directory * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900041 - Quota exceeded * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 10 + * @crossplatform + * @atomicservice + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 */ + function readText( + filePath: string, + options: ReadTextOptions, + callback: AsyncCallback + ): void; + /** - * Read randomAccessFile. + * Read text with sync interface. * - * @param { ArrayBuffer } buffer - buffer. - * @param { ReadOptions } [options] - options. - * @returns { Promise } Returns the number of file bytes read to buffer in promise mode. + * @param { string } filePath - file path. + * @param { object } [options] - options. + * @returns { string } Returns the contents of the read file. + * @throws { BusinessError } 13900001 - Operation not permitted * @throws { BusinessError } 13900004 - Interrupted system call * @throws { BusinessError } 13900005 - I/O error * @throws { BusinessError } 13900008 - Bad file descriptor @@ -7006,17 +4712,21 @@ declare interface RandomAccessFile { * @throws { BusinessError } 13900013 - Bad address * @throws { BusinessError } 13900019 - Is a directory * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900041 - Quota exceeded * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 11 + * @since 9 */ /** - * Read randomAccessFile. + * Read text with sync interface. * - * @param { ArrayBuffer } buffer - buffer. - * @param { ReadOptions } [options] - options. - * @returns { Promise } Returns the number of file bytes read to buffer in promise mode. + * @param { string } filePath - file path. + * @param { object } [options] - options. + * @returns { string } Returns the contents of the read file. + * @throws { BusinessError } 13900001 - Operation not permitted * @throws { BusinessError } 13900004 - Interrupted system call * @throws { BusinessError } 13900005 - I/O error * @throws { BusinessError } 13900008 - Bad file descriptor @@ -7024,22 +4734,22 @@ declare interface RandomAccessFile { * @throws { BusinessError } 13900013 - Bad address * @throws { BusinessError } 13900019 - Is a directory * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900041 - Quota exceeded * @throws { BusinessError } 13900042 - Unknown error - * @throws { BusinessError } 13900044 - Network is unreachable * @syscap SystemCapability.FileManagement.File.FileIO - * @since 12 + * @crossplatform + * @since 10 */ - read( - buffer: ArrayBuffer, - options?: ReadOptions - ): Promise; - /** - * Read randomAccessFile. + * Read text with sync interface. * - * @param { ArrayBuffer } buffer - buffer. - * @param { AsyncCallback } callback - The callback is used to return the number of file bytes read to buffer. + * @param { string } filePath - file path. + * @param { ReadTextOptions } [options] - options. + * @returns { string } Returns the contents of the read file. + * @throws { BusinessError } 13900001 - Operation not permitted * @throws { BusinessError } 13900004 - Interrupted system call * @throws { BusinessError } 13900005 - I/O error * @throws { BusinessError } 13900008 - Bad file descriptor @@ -7047,19 +4757,23 @@ declare interface RandomAccessFile { * @throws { BusinessError } 13900013 - Bad address * @throws { BusinessError } 13900019 - Is a directory * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900041 - Quota exceeded * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 10 + * @crossplatform + * @atomicservice + * @since 11 */ - read(buffer: ArrayBuffer, callback: AsyncCallback): void; - /** - * Read randomAccessFile. + * Read text with sync interface. * - * @param { ArrayBuffer } buffer - buffer. - * @param { object } [options] - options. - * @param { AsyncCallback } callback - The callback is used to return the number of file bytes read to buffer. + * @param { string } filePath - file path. + * @param { ReadTextOptions } [options] - options. + * @returns { string } Returns the contents of the read file. + * @throws { BusinessError } 13900001 - Operation not permitted * @throws { BusinessError } 13900004 - Interrupted system call * @throws { BusinessError } 13900005 - I/O error * @throws { BusinessError } 13900008 - Bad file descriptor @@ -7067,827 +4781,1515 @@ declare interface RandomAccessFile { * @throws { BusinessError } 13900013 - Bad address * @throws { BusinessError } 13900019 - Is a directory * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900041 - Quota exceeded * @throws { BusinessError } 13900042 - Unknown error + * @throws { BusinessError } 13900044 - Network is unreachable * @syscap SystemCapability.FileManagement.File.FileIO - * @since 10 + * @crossplatform + * @atomicservice + * @since {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 */ - /** - * Read randomAccessFile. - * - * @param { ArrayBuffer } buffer - buffer. - * @param { ReadOptions } [options] - options. - * @param { AsyncCallback } callback - The callback is used to return the number of file bytes read to buffer. - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900010 - Try again - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 11 - */ - read( - buffer: ArrayBuffer, - options: ReadOptions, - callback: AsyncCallback - ): void; + function readTextSync( + filePath: string, + options?: ReadTextOptions + ): string; /** - * Read randomAccessFile with sync interface. + * Rename file. * - * @param { ArrayBuffer } buffer - buffer. - * @param { object } [options] - options. - * @returns { number } Returns the number of file bytes read to buffer. - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error + * @param { string } oldPath - oldPath. + * @param { string } newPath - newPath. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900016 - Cross-device link + * @throws { BusinessError } 13900018 - Not a directory * @throws { BusinessError } 13900019 - Is a directory * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900028 - Too many links + * @throws { BusinessError } 13900032 - Directory not empty + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900041 - Quota exceeded * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 10 + * @since 9 */ /** - * Read randomAccessFile with sync interface. + * Rename file. * - * @param { ArrayBuffer } buffer - buffer. - * @param { ReadOptions } [options] - options. - * @returns { number } Returns the number of file bytes read to buffer. - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error + * @param { string } oldPath - oldPath. + * @param { string } newPath - newPath. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900016 - Cross-device link + * @throws { BusinessError } 13900018 - Not a directory * @throws { BusinessError } 13900019 - Is a directory * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900028 - Too many links + * @throws { BusinessError } 13900032 - Directory not empty + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900041 - Quota exceeded * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 11 + * @crossplatform + * @since 10 */ /** - * Read randomAccessFile with sync interface. + * Rename file. * - * @param { ArrayBuffer } buffer - buffer. - * @param { ReadOptions } [options] - options. - * @returns { number } Returns the number of file bytes read to buffer. - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error + * @param { string } oldPath - oldPath. + * @param { string } newPath - newPath. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900016 - Cross-device link + * @throws { BusinessError } 13900018 - Not a directory * @throws { BusinessError } 13900019 - Is a directory * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900028 - Too many links + * @throws { BusinessError } 13900032 - Directory not empty + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900041 - Quota exceeded * @throws { BusinessError } 13900042 - Unknown error - * @throws { BusinessError } 13900044 - Network is unreachable * @syscap SystemCapability.FileManagement.File.FileIO - * @since 12 + * @crossplatform + * @atomicservice + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 */ - readSync( - buffer: ArrayBuffer, - options?: ReadOptions - ): number; + function rename(oldPath: string, newPath: string): Promise; /** - * Generate read stream from RandomAccessFile object. + * Rename file. * - * @returns { ReadStream } Return ReadStream object. - * @throws { BusinessError } 401 - Parameter error + * @param { string } oldPath - oldPath. + * @param { string } newPath - newPath. + * @param { AsyncCallback } callback - Returns the callback function. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory * @throws { BusinessError } 13900008 - Bad file descriptor * @throws { BusinessError } 13900011 - Out of memory * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900016 - Cross-device link + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900042 - Unknown error + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900028 - Too many links + * @throws { BusinessError } 13900032 - Directory not empty + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 12 + * @since 9 */ - getReadStream(): ReadStream; - /** - * Generate write stream from RandomAccessFile object. + * Rename file. * - * @returns { WriteStream } Return WriteStream object. - * @throws { BusinessError } 401 - Parameter error + * @param { string } oldPath - oldPath. + * @param { string } newPath - newPath. + * @param { AsyncCallback } callback - Returns the callback function. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory * @throws { BusinessError } 13900008 - Bad file descriptor * @throws { BusinessError } 13900011 - Out of memory * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900016 - Cross-device link + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900042 - Unknown error + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900028 - Too many links + * @throws { BusinessError } 13900032 - Directory not empty + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 12 + * @crossplatform + * @since 10 */ - getWriteStream(): WriteStream; -} - -/** - * File Read Stream. - * - * @extends stream.Readable - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 12 - */ -declare class ReadStream extends stream.Readable { - /** - * The ReadStream constructor. - * - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 12 - */ - constructor(); - /** - * The Number of bytes read in the stream. + * Rename file. * - * @type { number } - * @readonly + * @param { string } oldPath - oldPath. + * @param { string } newPath - newPath. + * @param { AsyncCallback } callback - Returns the callback function. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900016 - Cross-device link + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900028 - Too many links + * @throws { BusinessError } 13900032 - Directory not empty + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900041 - Quota exceeded * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 12 + * @crossplatform + * @atomicservice + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 */ - readonly bytesRead: number; + function rename(oldPath: string, newPath: string, callback: AsyncCallback): void; /** - * The path of the file being read. + * Rename file with sync interface. * - * @type { string } - * @readonly + * @param { string } oldPath - oldPath. + * @param { string } newPath - newPath. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900016 - Cross-device link + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900028 - Too many links + * @throws { BusinessError } 13900032 - Directory not empty + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900041 - Quota exceeded * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 12 + * @since 9 */ - readonly path: string; - /** - * Set the file position indicator for the read stream. + * Rename file with sync interface. * - * @param { number } offset - file offset. - * @param { WhenceType } [whence = WhenceType.SEEK_SET] - directive whence. - * @returns { number } Returns the offset relative to starting position of stream. - * @throws { BusinessError } 401 - Parameter error + * @param { string } oldPath - oldPath. + * @param { string } newPath - newPath. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900016 - Cross-device link + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900026 - Illegal seek + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900028 - Too many links + * @throws { BusinessError } 13900032 - Directory not empty + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900041 - Quota exceeded * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 12 + * @crossplatform + * @since 10 */ - seek(offset: number, whence?: WhenceType): number; - /** - * Close ReadStream with sync interface. + * Rename file with sync interface. * - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error + * @param { string } oldPath - oldPath. + * @param { string } newPath - newPath. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900016 - Cross-device link + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900028 - Too many links + * @throws { BusinessError } 13900032 - Directory not empty + * @throws { BusinessError } 13900033 - Too many symbolic links encountered * @throws { BusinessError } 13900041 - Quota exceeded * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 12 + * @crossplatform + * @atomicservice + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 */ - close(): void; -} - -/** - * File Write Stream. - * - * @extends stream.Writable - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 12 - */ -declare class WriteStream extends stream.Writable { - /** - * The WriteStream constructor. - * - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 12 - */ - constructor(); + function renameSync(oldPath: string, newPath: string): void; /** - * The Number of bytes written in the stream. + * Delete dir. * - * @type { number } - * @readonly + * @param { string } path - path. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900027 - Read-only file system1 + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900032 - Directory not empty * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 12 + * @since 9 */ - readonly bytesWritten: number; - /** - * The path of the file being written. + * Delete dir. * - * @type { string } - * @readonly + * @param { string } path - path. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900027 - Read-only file system1 + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900032 - Directory not empty * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 12 + * @crossplatform + * @since 10 */ - readonly path: string; - /** - * Set the file position indicator for the write stream. + * Delete dir. * - * @param { number } offset - file offset. - * @param { WhenceType } [whence = WhenceType.SEEK_SET] - directive whence. - * @returns { number } Returns the offset relative to starting position of stream. - * @throws { BusinessError } 401 - Parameter error + * @param { string } path - path. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900018 - Not a directory * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900026 - Illegal seek + * @throws { BusinessError } 13900027 - Read-only file system1 + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900032 - Directory not empty * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 12 + * @crossplatform + * @atomicservice + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 */ - seek(offset: number, whence?: WhenceType): number; + function rmdir(path: string): Promise; /** - * Close WriteStream with sync interface. + * Delete dir. * - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900041 - Quota exceeded + * @param { string } path - path. + * @param { AsyncCallback } callback - Return the callback function. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900027 - Read-only file system1 + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900032 - Directory not empty * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 12 - */ - close(): void; -} - -/** - * The AtomicFile class provides methods for performing atomic operations on files. - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 15 - */ -export class AtomicFile { - /** - * The AtomicFile constructor. - * @param { string } path file path. - * @throws { BusinessError } 401 Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 15 - */ - constructor(path: string); - - /** - * Get the File object from AtomicFile object. - * @returns { File } Returns the file object. - * @throws { BusinessError } 13900002 No such file or directory - * @throws { BusinessError } 13900005 IO error - * @throws { BusinessError } 13900012 Permission denied - * @throws { BusinessError } 13900042 Internal error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 15 - */ - getBaseFile(): File; - - /** - * Create the file read stream. - * @returns { ReadStream } Returns the file read stream. - * @throws { BusinessError } 13900001 Operation not permitted - * @throws { BusinessError } 13900002 No such file or directory - * @throws { BusinessError } 13900012 Permission denied - * @throws { BusinessError } 13900042 Internal error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 15 + * @since 9 */ - openRead(): ReadStream; - /** - * Read the entire contents of the file. - * @returns { ArrayBuffer } Returns the ArrayBuffer of the file contents. - * @throws { BusinessError } 13900005 I/O error - * @throws { BusinessError } 13900042 Internal error + * Delete dir. + * + * @param { string } path - path. + * @param { AsyncCallback } callback - Return the callback function. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900027 - Read-only file system1 + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900032 - Directory not empty + * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 15 + * @crossplatform + * @since 10 */ - readFully(): ArrayBuffer; - /** - * Create the file write stream. - * @returns { WriteStream } Returns the file write stream. - * @throws { BusinessError } 13900001 Operation not permitted - * @throws { BusinessError } 13900002 No such file or directory - * @throws { BusinessError } 13900012 Permission denied - * @throws { BusinessError } 13900027 Read-only file system - * @throws { BusinessError } 13900042 Internal error + * Delete dir. + * + * @param { string } path - path. + * @param { AsyncCallback } callback - Return the callback function. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900027 - Read-only file system1 + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900032 - Directory not empty + * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 15 + * @crossplatform + * @atomicservice + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 */ - startWrite(): WriteStream; + function rmdir(path: string, callback: AsyncCallback): void; /** - * If the file is written successfully, the file is closed. - * @throws { BusinessError } 13900042 Internal error + * Delete dir with sync interface. + * + * @param { string } path - path. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900027 - Read-only file system1 + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900032 - Directory not empty + * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 15 + * @since 9 */ - finishWrite(): void; - /** - * If writing to the file fails, the file is rolled back. - * @throws { BusinessError } 13900042 Internal error + * Delete dir with sync interface. + * + * @param { string } path - path. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900027 - Read-only file system1 + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900032 - Directory not empty + * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 15 + * @crossplatform + * @since 10 */ - failWrite(): void; - /** - * Delete all file. - * @throws { BusinessError } 13900001 Operation not permitted - * @throws { BusinessError } 13900002 No such file or directory - * @throws { BusinessError } 13900012 Permission denied - * @throws { BusinessError } 13900027 Read-only file system - * @throws { BusinessError } 13900042 Internal error + * Delete dir with sync interface. + * + * @param { string } path - path. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900027 - Read-only file system1 + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900032 - Directory not empty + * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 15 + * @crossplatform + * @atomicservice + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 */ - delete(): void; -} + function rmdirSync(path: string): void; -/** - * Stat object. - * - * @interface Stat - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 - */ -/** - * Stat object. - * - * @interface Stat - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @since 10 - */ -/** - * Stat object. - * - * @interface Stat - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice - * @since 11 - */ -declare interface Stat { /** - * @type { bigint } - * @readonly + * Get file information. + * + * @param { string | number } file - path or file descriptor. + * @returns { Promise } Returns the Stat object in promise mode. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900031 - Function not implemented + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900038 - Value too large for defined data type * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO * @since 9 */ /** - * @type { bigint } - * @readonly + * Get file information. + * + * @param { string | number } file - path or file descriptor. + * @returns { Promise } Returns the Stat object in promise mode. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900031 - Function not implemented + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900038 - Value too large for defined data type * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO * @crossplatform * @since 10 */ - readonly ino: bigint; /** - * @type { number } - * @readonly + * Get file information. + * + * @param { string | number } file - path or file descriptor. + * @returns { Promise } Returns the Stat object in promise mode. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900031 - Function not implemented + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 + */ + function stat(file: string | number): Promise; + + /** + * Get file information. + * + * @param { string | number } file - path or file descriptor. + * @param { AsyncCallback } callback - The callback is used to return the Stat object. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900031 - Function not implemented + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900038 - Value too large for defined data type * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO * @since 9 */ /** - * @type { number } - * @readonly + * Get file information. + * + * @param { string | number } file - path or file descriptor. + * @param { AsyncCallback } callback - The callback is used to return the Stat object. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900031 - Function not implemented + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900038 - Value too large for defined data type * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO * @crossplatform * @since 10 */ /** - * @type { number } - * @readonly + * Get file information. + * + * @param { string | number } file - path or file descriptor. + * @param { AsyncCallback } callback - The callback is used to return the Stat object. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900031 - Function not implemented + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900038 - Value too large for defined data type * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO * @crossplatform * @atomicservice - * @since 11 + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 */ - readonly mode: number; + function stat(file: string | number, callback: AsyncCallback): void; + /** - * @type { number } - * @readonly - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900042 - Unknown error + * Get file information with sync interface. + * + * @param { string | number } file - path or file descriptor. + * @returns { Stat } Returns the Stat object. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900031 - Function not implemented + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900038 - Value too large for defined data type * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO * @since 9 */ /** - * @type { number } - * @readonly + * Get file information with sync interface. + * + * @param { string | number } file - path or file descriptor. + * @returns { Stat } Returns the Stat object. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900031 - Function not implemented + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900038 - Value too large for defined data type * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ + /** + * Get file information with sync interface. + * + * @param { string | number } file - path or file descriptor. + * @returns { Stat } Returns the Stat object. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900031 - Function not implemented + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900038 - Value too large for defined data type * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO * @crossplatform - * @since 10 + * @atomicservice + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 */ - readonly uid: number; + function statSync(file: string | number): Stat; + /** - * @type { number } - * @readonly + * Link file. + * + * @param { string } target - target. + * @param { string } srcPath - srcPath. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900041 - Quota exceeded * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 + * @since {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 */ + function symlink(target: string, srcPath: string): Promise; + /** - * @type { number } - * @readonly + * Link file. + * + * @param { string } target - target. + * @param { string } srcPath - srcPath. + * @param { AsyncCallback } callback - Return the callback function. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900041 - Quota exceeded * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @since 10 + * @since {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 */ - readonly gid: number; + function symlink(target: string, srcPath: string, callback: AsyncCallback): void; + /** - * @type { number } - * @readonly + * Link file with sync interface. + * + * @param { string } target - target. + * @param { string } srcPath - srcPath. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 + */ + function symlinkSync(target: string, srcPath: string): void; + + /** + * Truncate file. + * + * @param { string | number } file - path or file descriptor. + * @param { number } [len = 0] - len. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900023 - Text file busy + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO * @since 9 */ /** - * @type { number } - * @readonly + * Truncate file. + * + * @param { string | number } file - path or file descriptor. + * @param { number } [len = 0] - len. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900023 - Text file busy + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO * @crossplatform * @since 10 */ /** - * @type { number } - * @readonly + * Truncate file. + * + * @param { string | number } file - path or file descriptor. + * @param { number } [len = 0] - len. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900023 - Text file busy + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO * @crossplatform * @atomicservice - * @since 11 + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 */ - readonly size: number; + function truncate(file: string | number, len?: number): Promise; + /** - * @type { number } - * @readonly + * Truncate file. + * + * @param { string | number } file - path or file descriptor. + * @param { AsyncCallback } callback - Return the callback function. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900023 - Text file busy + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO * @since 9 */ /** - * @type { number } - * @readonly + * Truncate file. + * + * @param { string | number } file - path or file descriptor. + * @param { AsyncCallback } callback - Return the callback function. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900023 - Text file busy + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO * @crossplatform * @since 10 */ /** - * @type { number } - * @readonly + * Truncate file. + * + * @param { string | number } file - path or file descriptor. + * @param { AsyncCallback } callback - Return the callback function. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900023 - Text file busy + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO * @crossplatform * @atomicservice - * @since 11 + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 */ - readonly atime: number; + function truncate(file: string | number, callback: AsyncCallback): void; + /** - * @type { number } - * @readonly + * Truncate file. + * + * @param { string | number } file - path or file descriptor. + * @param { number } [len = 0] - len. + * @param { AsyncCallback } callback - Return the callback function. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900023 - Text file busy + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO * @since 9 */ /** - * @type { number } - * @readonly + * Truncate file. + * + * @param { string | number } file - path or file descriptor. + * @param { number } [len = 0] - len. + * @param { AsyncCallback } callback - Return the callback function. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900023 - Text file busy + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO * @crossplatform * @since 10 */ /** - * @type { number } - * @readonly + * Truncate file. + * + * @param { string | number } file - path or file descriptor. + * @param { number } [len = 0] - len. + * @param { AsyncCallback } callback - Return the callback function. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900023 - Text file busy + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO * @crossplatform * @atomicservice - * @since 11 + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 */ - readonly mtime: number; + function truncate(file: string | number, len: number, callback: AsyncCallback): void; + /** - * @type { number } - * @readonly + * Truncate file with sync interface. + * + * @param { string | number } file - path or file descriptor. + * @param { number } [len = 0] - len. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900023 - Text file busy + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO * @since 9 */ /** - * @type { number } - * @readonly + * Truncate file with sync interface. + * + * @param { string | number } file - path or file descriptor. + * @param { number } [len = 0] - len. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900023 - Text file busy + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO * @crossplatform * @since 10 */ - readonly ctime: number; - - /** - * Returns nanosecond of the access time. - * @type { bigint } - * @readonly - * @throws { BusinessError } 13900042 - Internal error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 15 - */ - readonly atimeNs?:bigint; - - /** - * Returns nanosecond of the modification time. - * @type { bigint } - * @readonly - * @throws { BusinessError } 13900042 - Internal error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 15 - */ - readonly mtimeNs?:bigint; - - /** - * Returns nanosecond of the change time. - * @type { bigint } - * @readonly - * @throws { BusinessError } 13900042 - Internal error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 15 - */ - readonly ctimeNs?:bigint; - /** + * Truncate file with sync interface. * - * @type { LocationType } - * @readonly + * @param { string | number } file - path or file descriptor. + * @param { number } [len = 0] - len. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900023 - Text file busy + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 11 + * @crossplatform + * @atomicservice + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 */ - readonly location: LocationType; + function truncateSync(file: string | number, len?: number): void; /** - * Whether path/fd is block device. + * Delete file. * - * @returns { boolean } Returns whether the path/fd point to a block device or not. + * @param { string } path - path. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO * @since 9 */ /** - * Whether path/fd is block device. + * Delete file. * - * @returns { boolean } Returns whether the path/fd point to a block device or not. + * @param { string } path - path. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO * @crossplatform * @since 10 */ - isBlockDevice(): boolean; - /** - * Whether path/fd is character device. - * - * @returns { boolean } Returns whether the path/fd point to a character device or not. - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 - */ /** - * Whether path/fd is character device. + * Delete file. * - * @returns { boolean } Returns whether the path/fd point to a character device or not. + * @param { string } path - path. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO * @crossplatform - * @since 10 + * @atomicservice + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 */ - isCharacterDevice(): boolean; + function unlink(path: string): Promise; + /** - * Whether path/fd is directory. + * Delete file. * - * @returns { boolean } Returns whether the path/fd point to a directory or not. + * @param { string } path - path. + * @param { AsyncCallback } callback - Return the callback function. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO * @since 9 */ /** - * Whether path/fd is directory. + * Delete file. * - * @returns { boolean } Returns whether the path/fd point to a directory or not. + * @param { string } path - path. + * @param { AsyncCallback } callback - Return the callback function. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO * @crossplatform * @since 10 */ /** - * Whether path/fd is directory. + * Delete file. * - * @returns { boolean } Returns whether the path/fd point to a directory or not. + * @param { string } path - path. + * @param { AsyncCallback } callback - Return the callback function. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO * @crossplatform * @atomicservice - * @since 11 + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 */ - isDirectory(): boolean; + function unlink(path: string, callback: AsyncCallback): void; + /** - * Whether path/fd is fifo. + * Delete file with sync interface. * - * @returns { boolean } Returns whether the path/fd point to a fifo file or not. + * @param { string } path - path. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO * @since 9 */ /** - * Whether path/fd is fifo. + * Delete file with sync interface. + * + * @param { string } path - path. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ + /** + * Delete file with sync interface. * - * @returns { boolean } Returns whether the path/fd point to a fifo file or not. + * @param { string } path - path. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO * @crossplatform - * @since 10 - */ - isFIFO(): boolean; - /** - * Whether path/fd is file. - * - * @returns { boolean } Returns whether the path/fd point to a normal file or not. - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900042 - Unknown error - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 + * @atomicservice + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 */ + function unlinkSync(path: string): void; + /** - * Whether path/fd is file. + * Change file mtime. * - * @returns { boolean } Returns whether the path/fd point to a normal file or not. - * @throws { BusinessError } 13900005 - I/O error + * @param { string } path - path. + * @param { number } mtime - last modification time + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900027 - Read-only file system * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @since 10 + * @since 11 */ /** - * Whether path/fd is file. + * Change file mtime. * - * @returns { boolean } Returns whether the path/fd point to a normal file or not. - * @throws { BusinessError } 13900005 - I/O error + * @param { string } path - path. + * @param { number } mtime - last modification time + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900027 - Read-only file system * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO * @crossplatform - * @atomicservice - * @since 11 + * @since {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 */ - isFile(): boolean; + function utimes(path: string, mtime: number): void; + /** - * Whether path/fd is socket. + * Write file. * - * @returns { boolean } Returns whether the path/fd point to a socket file or not. + * @param { number } fd - file descriptor. + * @param { ArrayBuffer | string } buffer - buffer. + * @param { object } [options] - options. + * @returns { Promise } Returns the number of bytes written to the file in promise mode. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900004 - Interrupted system call * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900041 - Quota exceeded * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO * @since 9 */ /** - * Whether path/fd is socket. + * Write file. * - * @returns { boolean } Returns whether the path/fd point to a socket file or not. + * @param { number } fd - file descriptor. + * @param { ArrayBuffer | string } buffer - buffer. + * @param { object } [options] - options. + * @returns { Promise } Returns the number of bytes written to the file in promise mode. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900004 - Interrupted system call * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900041 - Quota exceeded * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO * @crossplatform * @since 10 */ - isSocket(): boolean; /** - * Whether path/fd is symbolic link. + * Write file. * - * @returns { boolean } Returns whether the path/fd point to a symbolic link or not. + * @param { number } fd - file descriptor. + * @param { ArrayBuffer | string } buffer - buffer. + * @param { WriteOptions } [options] - options. + * @returns { Promise } Returns the number of bytes written to the file in promise mode. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900004 - Interrupted system call * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900041 - Quota exceeded * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 + * @crossplatform + * @atomicservice + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 */ + function write( + fd: number, + buffer: ArrayBuffer | string, + options?: WriteOptions + ): Promise; + /** - * Whether path/fd is symbolic link. + * Write file. * - * @returns { boolean } Returns whether the path/fd point to a symbolic link or not. + * @param { number } fd - file descriptor. + * @param { ArrayBuffer | string } buffer - buffer. + * @param { AsyncCallback } callback - The callback is used to return the number of bytes written to the file. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900004 - Interrupted system call * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900041 - Quota exceeded * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @since 10 + * @since 9 */ - isSymbolicLink(): boolean; -} - -/** - * Stream object - * - * @interface Stream - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 - */ -declare interface Stream { /** - * Close stream. + * Write file. * - * @returns { Promise } The promise returned by the function. + * @param { number } fd - file descriptor. + * @param { ArrayBuffer | string } buffer - buffer. + * @param { AsyncCallback } callback - The callback is used to return the number of bytes written to the file. + * @throws { BusinessError } 13900001 - Operation not permitted * @throws { BusinessError } 13900004 - Interrupted system call * @throws { BusinessError } 13900005 - I/O error * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900024 - File too large * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900034 - Operation would block * @throws { BusinessError } 13900041 - Quota exceeded * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 + * @crossplatform + * @since 10 */ - close(): Promise; - /** - * Close stream. + * Write file. * - * @param { AsyncCallback } callback - Return the callback function. + * @param { number } fd - file descriptor. + * @param { ArrayBuffer | string } buffer - buffer. + * @param { AsyncCallback } callback - The callback is used to return the number of bytes written to the file. + * @throws { BusinessError } 13900001 - Operation not permitted * @throws { BusinessError } 13900004 - Interrupted system call * @throws { BusinessError } 13900005 - I/O error * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900024 - File too large * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900034 - Operation would block * @throws { BusinessError } 13900041 - Quota exceeded * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 + * @crossplatform + * @atomicservice + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 */ - close(callback: AsyncCallback): void; + function write(fd: number, buffer: ArrayBuffer | string, callback: AsyncCallback): void; /** - * Close stream with sync interface. + * Write file. * + * @param { number } fd - file descriptor. + * @param { ArrayBuffer | string } buffer - buffer. + * @param { object } [options] - options. + * @param { AsyncCallback } callback - The callback is used to return the number of bytes written to the file. + * @throws { BusinessError } 13900001 - Operation not permitted * @throws { BusinessError } 13900004 - Interrupted system call * @throws { BusinessError } 13900005 - I/O error * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900024 - File too large * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900034 - Operation would block * @throws { BusinessError } 13900041 - Quota exceeded * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO * @since 9 */ - closeSync(): void; - /** - * Flush stream. + * Write file. * - * @returns { Promise } The promise returned by the function. + * @param { number } fd - file descriptor. + * @param { ArrayBuffer | string } buffer - buffer. + * @param { object } [options] - options. + * @param { AsyncCallback } callback - The callback is used to return the number of bytes written to the file. * @throws { BusinessError } 13900001 - Operation not permitted * @throws { BusinessError } 13900004 - Interrupted system call * @throws { BusinessError } 13900005 - I/O error @@ -7901,14 +6303,16 @@ declare interface Stream { * @throws { BusinessError } 13900041 - Quota exceeded * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 + * @crossplatform + * @since 10 */ - flush(): Promise; - /** - * Flush stream. + * Write file. * - * @param { AsyncCallback } callback - Return the callback function. + * @param { number } fd - file descriptor. + * @param { ArrayBuffer | string } buffer - buffer. + * @param { WriteOptions } [options] - options. + * @param { AsyncCallback } callback - The callback is used to return the number of bytes written to the file. * @throws { BusinessError } 13900001 - Operation not permitted * @throws { BusinessError } 13900004 - Interrupted system call * @throws { BusinessError } 13900005 - I/O error @@ -7922,13 +6326,25 @@ declare interface Stream { * @throws { BusinessError } 13900041 - Quota exceeded * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 + * @crossplatform + * @atomicservice + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 */ - flush(callback: AsyncCallback): void; + function write( + fd: number, + buffer: ArrayBuffer | string, + options: WriteOptions, + callback: AsyncCallback + ): void; /** - * Flush stream with sync interface. + * Write file with sync interface. * + * @param { number } fd - file descriptor. + * @param { ArrayBuffer | string } buffer - buffer. + * @param { object } [options] - options. + * @returns { number } Returns the number of bytes written to the file. * @throws { BusinessError } 13900001 - Operation not permitted * @throws { BusinessError } 13900004 - Interrupted system call * @throws { BusinessError } 13900005 - I/O error @@ -7944,14 +6360,13 @@ declare interface Stream { * @syscap SystemCapability.FileManagement.File.FileIO * @since 9 */ - flushSync(): void; - /** - * Write stream. + * Write file with sync interface. * + * @param { number } fd - file descriptor. * @param { ArrayBuffer | string } buffer - buffer. * @param { object } [options] - options. - * @returns { Promise } Returns the number of file bytes written to file in promise mode. + * @returns { number } Returns the number of bytes written to the file. * @throws { BusinessError } 13900001 - Operation not permitted * @throws { BusinessError } 13900004 - Interrupted system call * @throws { BusinessError } 13900005 - I/O error @@ -7965,14 +6380,16 @@ declare interface Stream { * @throws { BusinessError } 13900041 - Quota exceeded * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 + * @crossplatform + * @since 10 */ /** - * Write stream. + * Write file with sync interface. * + * @param { number } fd - file descriptor. * @param { ArrayBuffer | string } buffer - buffer. * @param { WriteOptions } [options] - options. - * @returns { Promise } Returns the number of file bytes written to file in promise mode. + * @returns { number } Returns the number of bytes written to the file. * @throws { BusinessError } 13900001 - Operation not permitted * @throws { BusinessError } 13900004 - Interrupted system call * @throws { BusinessError } 13900005 - I/O error @@ -7986,310 +6403,2360 @@ declare interface Stream { * @throws { BusinessError } 13900041 - Quota exceeded * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 11 + * @crossplatform + * @atomicservice + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 */ - write( + function writeSync( + fd: number, buffer: ArrayBuffer | string, options?: WriteOptions - ): Promise; + ): number; + + /** + * Set extended attributes information of the file. + * + * @param { string } path - path. + * @param { string } key - the key of extended attribute. + * @param { string } value - the value of extended attribute. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameter types. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900031 - Function not implemented + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 + */ + function setxattr(path: string, key: string, value: string): Promise; + + /** + * Set extended attributes information of the file. + * + * @param { string } path - path. + * @param { string } key - the key of extended attribute. + * @param { string } value - the value of extended attribute. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameter types. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900031 - Function not implemented + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 + */ + function setxattrSync(path: string, key: string, value: string): void; + + /** + * Get extended attributes information of the file. + * + * @param { string } path - path. + * @param { string } key - the key of extended attribute. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameter types. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900007 - Arg list too long + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900031 - Function not implemented + * @throws { BusinessError } 13900037 - No data available + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 + */ + function getxattr(path: string, key: string): Promise; + + /** + * Get extended attributes information of the file with sync interface. + * + * @param { string } path - path. + * @param { string } key - the key of extended attribute. + * @returns { string } Return the value of extended attribute. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameter types. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900007 - Arg list too long + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900031 - Function not implemented + * @throws { BusinessError } 13900037 - No data available + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 + */ + function getxattrSync(path: string, key: string): string; + // function end + + /** + * Progress data of copyFile + * + * @typedef Progress + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 + */ + interface Progress { + /** + * @type { number } + * @readonly + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 + */ + readonly processedSize: number; + + /** + * @type { number } + * @readonly + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 + */ + readonly totalSize: number; + } + + /** + * Task signal. + * + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 20 + * @arkts 1.2 + */ + class TaskSignal { + /** + * Cancel the copy task in progress. + * + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900012 - Permission denied by the file system + * @throws { BusinessError } 13900043 - No task can be canceled. + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 20 + * @arkts 1.2 + */ + cancel(): void; + + /** + * Subscribe the cancel event of current task. + * + * @returns { Promise } Return the result of the cancel event. + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 20 + * @arkts 1.2 + */ + onCancel(): Promise; + } + + /** + * Get options of copy + * + * @typedef CopyOptions + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 20 + * @arkts 1.2 + */ + interface CopyOptions { + /** + * Listener of copy progress + * + * @type { ?ProgressListener } + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 20 + * @arkts 1.2 + */ + progressListener?: ProgressListener; + /** + * Cancel signal of copy. + * + * @type { ?TaskSignal } + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 20 + * @arkts 1.2 + */ + copySignal?: TaskSignal; + } + + /** + * Listener of copy progress. + * + * @typedef { function } ProgressListener + * @param { Progress } progress - indicates the progress data of copyFile + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 + */ + type ProgressListener = (progress: Progress) => void; + + /** + * File object. + * + * @interface File + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + /** + * File object. + * + * @interface File + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ + /** + * File object. + * + * @interface File + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 + */ + interface File { + /** + * @type { number } + * @readonly + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + /** + * @type { number } + * @readonly + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ + /** + * @type { number } + * @readonly + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 + */ + readonly fd: number; + + /** + * File path + * + * @type { string } + * @readonly + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900042 - Unknown error + * @throws { BusinessError } 14300002 - Invalid URI + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 + */ + readonly path: string; + + /** + * File name + * + * @type { string } + * @readonly + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 + */ + readonly name: string; + + /** + * Get parent path of file. + * + * @returns { string } Return the parent path of file. + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900042 - Unknown error + * @throws { BusinessError } 14300002 - Invalid URI + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 + */ + getParent(): string; + + /** + * Lock file with blocking method. + * + * @param { boolean } exclusive - whether lock is exclusive. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900042 - Unknown error + * @throws { BusinessError } 13900043 - No record locks available + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 + */ + lock(exclusive?: boolean): Promise; + + /** + * Lock file with blocking method. + * + * @param { AsyncCallback } callback - Return the callback function. + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900042 - Unknown error + * @throws { BusinessError } 13900043 - No record locks available + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 + */ + lock(callback: AsyncCallback): void; + + /** + * Lock file with blocking method. + * + * @param { boolean } exclusive - whether lock is exclusive. + * @param { AsyncCallback } callback - Return the callback function. + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900042 - Unknown error + * @throws { BusinessError } 13900043 - No record locks available + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 + */ + lock(exclusive: boolean, callback: AsyncCallback): void; + + /** + * Try to lock file with returning results immediately. + * + * @param { boolean } exclusive - whether lock is exclusive. + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900042 - Unknown error + * @throws { BusinessError } 13900043 - No record locks available + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 + */ + tryLock(exclusive?: boolean): void; + + /** + * Unlock file. + * + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900042 - Unknown error + * @throws { BusinessError } 13900043 - No record locks available + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 + */ + unlock(): void; + } + + /** + * RandomAccessFile object. + * + * @interface RandomAccessFile + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 + */ + interface RandomAccessFile { + + /** + * File descriptor + * + * @type { number } + * @readonly + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 + */ + readonly fd: number; + + /** + * File pointer + * + * @type { number } + * @readonly + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 + */ + readonly filePointer: number; + + /** + * Set file pointer. + * + * @param { number } filePointer - filePointer. + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 + */ + setFilePointer(filePointer: number): void; + + /** + * Close randomAccessFile with sync interface. + * + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 + */ + close(): void; + + /** + * Write randomAccessFile. + * + * @param { ArrayBuffer | string } buffer - buffer. + * @param { object } [options] - options. + * @returns { Promise } Returns the number of bytes written to the file in promise mode. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 10 + */ + /** + * Write randomAccessFile. + * + * @param { ArrayBuffer | string } buffer - buffer. + * @param { WriteOptions } [options] - options. + * @returns { Promise } Returns the number of bytes written to the file in promise mode. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 + */ + write( + buffer: ArrayBuffer | string, + options?: WriteOptions + ): Promise; + + /** + * Write randomAccessFile. + * + * @param { ArrayBuffer | string } buffer - buffer. + * @param { AsyncCallback } callback - The callback is used to return the number of bytes written to the file. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 + */ + write(buffer: ArrayBuffer | string, callback: AsyncCallback): void; + + /** + * Write randomAccessFile. + * + * @param { ArrayBuffer | string } buffer - buffer. + * @param { object } [options] - options. + * @param { AsyncCallback } callback - The callback is used to return the number of bytes written to the file. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 10 + */ + /** + * Write randomAccessFile. + * + * @param { ArrayBuffer | string } buffer - buffer. + * @param { WriteOptions } [options] - options. + * @param { AsyncCallback } callback - The callback is used to return the number of bytes written to the file. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 + */ + write( + buffer: ArrayBuffer | string, + options: WriteOptions, + callback: AsyncCallback + ): void; + + /** + * Write randomAccessFile with sync interface. + * + * @param { ArrayBuffer | string } buffer - buffer. + * @param { object } [options] - options. + * @returns { number } Returns the number of bytes written to the file. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 10 + */ + /** + * Write randomAccessFile with sync interface. + * + * @param { ArrayBuffer | string } buffer - buffer. + * @param { WriteOptions } [options] - options. + * @returns { number } Returns the number of bytes written to the file. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 + */ + writeSync( + buffer: ArrayBuffer | string, + options?: WriteOptions + ): number; + + /** + * Read randomAccessFile. + * + * @param { ArrayBuffer } buffer - buffer. + * @param { object } [options] - options. + * @returns { Promise } Returns the number of file bytes read to buffer in promise mode. + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 10 + */ + /** + * Read randomAccessFile. + * + * @param { ArrayBuffer } buffer - buffer. + * @param { ReadOptions } [options] - options. + * @returns { Promise } Returns the number of file bytes read to buffer in promise mode. + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 11 + */ + /** + * Read randomAccessFile. + * + * @param { ArrayBuffer } buffer - buffer. + * @param { ReadOptions } [options] - options. + * @returns { Promise } Returns the number of file bytes read to buffer in promise mode. + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900042 - Unknown error + * @throws { BusinessError } 13900044 - Network is unreachable + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 + */ + read( + buffer: ArrayBuffer, + options?: ReadOptions + ): Promise; + + /** + * Read randomAccessFile. + * + * @param { ArrayBuffer } buffer - buffer. + * @param { AsyncCallback } callback - The callback is used to return the number of file bytes read to buffer. + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 + */ + read(buffer: ArrayBuffer, callback: AsyncCallback): void; + + /** + * Read randomAccessFile. + * + * @param { ArrayBuffer } buffer - buffer. + * @param { object } [options] - options. + * @param { AsyncCallback } callback - The callback is used to return the number of file bytes read to buffer. + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 10 + */ + /** + * Read randomAccessFile. + * + * @param { ArrayBuffer } buffer - buffer. + * @param { ReadOptions } [options] - options. + * @param { AsyncCallback } callback - The callback is used to return the number of file bytes read to buffer. + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 + */ + read( + buffer: ArrayBuffer, + options: ReadOptions, + callback: AsyncCallback + ): void; + + /** + * Read randomAccessFile with sync interface. + * + * @param { ArrayBuffer } buffer - buffer. + * @param { object } [options] - options. + * @returns { number } Returns the number of file bytes read to buffer. + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 10 + */ + /** + * Read randomAccessFile with sync interface. + * + * @param { ArrayBuffer } buffer - buffer. + * @param { ReadOptions } [options] - options. + * @returns { number } Returns the number of file bytes read to buffer. + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 11 + */ + /** + * Read randomAccessFile with sync interface. + * + * @param { ArrayBuffer } buffer - buffer. + * @param { ReadOptions } [options] - options. + * @returns { number } Returns the number of file bytes read to buffer. + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900042 - Unknown error + * @throws { BusinessError } 13900044 - Network is unreachable + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 + */ + readSync( + buffer: ArrayBuffer, + options?: ReadOptions + ): number; + + /** + * Generate read stream from RandomAccessFile object. + * + * @returns { ReadStream } Return ReadStream object. + * @throws { BusinessError } 401 - Parameter error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 + */ + getReadStream(): ReadStream; + + /** + * Generate write stream from RandomAccessFile object. + * + * @returns { WriteStream } Return WriteStream object. + * @throws { BusinessError } 401 - Parameter error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 + */ + getWriteStream(): WriteStream; + } + + /** + * File Read Stream. + * + * @extends stream.Readable + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 + */ + class ReadStream extends stream.Readable { + /** + * The ReadStream constructor. + * + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 + */ + constructor(); + + /** + * The Number of bytes read in the stream. + * + * @type { number } + * @readonly + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 + */ + readonly bytesRead: number; + + /** + * The path of the file being read. + * + * @type { string } + * @readonly + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 + */ + readonly path: string; + + /** + * Set the file position indicator for the read stream. + * + * @param { number } offset - file offset. + * @param { WhenceType } [whence = WhenceType.SEEK_SET] - directive whence. + * @returns { number } Returns the offset relative to starting position of stream. + * @throws { BusinessError } 401 - Parameter error + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900026 - Illegal seek + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 + */ + seek(offset: number, whence?: WhenceType): number; + + /** + * Close ReadStream with sync interface. + * + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 + */ + close(): void; + } + + /** + * File Write Stream. + * + * @extends stream.Writable + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 + */ + class WriteStream extends stream.Writable { + /** + * The WriteStream constructor. + * + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 + */ + constructor(); + + /** + * The Number of bytes written in the stream. + * + * @type { number } + * @readonly + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 + */ + readonly bytesWritten: number; + + /** + * The path of the file being written. + * + * @type { string } + * @readonly + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 + */ + readonly path: string; + + /** + * Set the file position indicator for the write stream. + * + * @param { number } offset - file offset. + * @param { WhenceType } [whence = WhenceType.SEEK_SET] - directive whence. + * @returns { number } Returns the offset relative to starting position of stream. + * @throws { BusinessError } 401 - Parameter error + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900026 - Illegal seek + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 + */ + seek(offset: number, whence?: WhenceType): number; + + /** + * Close WriteStream with sync interface. + * + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 + */ + close(): void; + } /** - * Write stream. + * The AtomicFile class provides methods for performing atomic operations on files. + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 20 + * @arkts 1.2 + */ + class AtomicFile { + /** + * The AtomicFile constructor. + * @param { string } path file path. + * @throws { BusinessError } 401 Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 20 + * @arkts 1.2 + */ + constructor(path: string); + + /** + * Get the File object from AtomicFile object. + * @returns { File } Returns the file object. + * @throws { BusinessError } 13900002 No such file or directory + * @throws { BusinessError } 13900005 IO error + * @throws { BusinessError } 13900012 Permission denied + * @throws { BusinessError } 13900042 Internal error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 20 + * @arkts 1.2 + */ + getBaseFile(): File; + + /** + * Create the file read stream. + * @returns { ReadStream } Returns the file read stream. + * @throws { BusinessError } 13900001 Operation not permitted + * @throws { BusinessError } 13900002 No such file or directory + * @throws { BusinessError } 13900012 Permission denied + * @throws { BusinessError } 13900042 Internal error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 20 + * @arkts 1.2 + */ + openRead(): ReadStream; + + /** + * Read the entire contents of the file. + * @returns { ArrayBuffer } Returns the ArrayBuffer of the file contents. + * @throws { BusinessError } 13900005 I/O error + * @throws { BusinessError } 13900042 Internal error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 20 + * @arkts 1.2 + */ + readFully(): ArrayBuffer; + + /** + * Create the file write stream. + * @returns { WriteStream } Returns the file write stream. + * @throws { BusinessError } 13900001 Operation not permitted + * @throws { BusinessError } 13900002 No such file or directory + * @throws { BusinessError } 13900012 Permission denied + * @throws { BusinessError } 13900027 Read-only file system + * @throws { BusinessError } 13900042 Internal error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 20 + * @arkts 1.2 + */ + startWrite(): WriteStream; + + /** + * If the file is written successfully, the file is closed. + * @throws { BusinessError } 13900042 Internal error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 20 + * @arkts 1.2 + */ + finishWrite(): void; + + /** + * If writing to the file fails, the file is rolled back. + * @throws { BusinessError } 13900042 Internal error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 20 + * @arkts 1.2 + */ + failWrite(): void; + + /** + * Delete all file. + * @throws { BusinessError } 13900001 Operation not permitted + * @throws { BusinessError } 13900002 No such file or directory + * @throws { BusinessError } 13900012 Permission denied + * @throws { BusinessError } 13900027 Read-only file system + * @throws { BusinessError } 13900042 Internal error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 20 + * @arkts 1.2 + */ + delete(): void; + } + + /** + * Stat object. * - * @param { ArrayBuffer | string } buffer - buffer. - * @param { AsyncCallback } callback - The callback is used to return the number of file bytes written to file. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900010 - Try again - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900024 - File too large - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error + * @interface Stat * @syscap SystemCapability.FileManagement.File.FileIO * @since 9 */ - write(buffer: ArrayBuffer | string, callback: AsyncCallback): void; - /** - * Write stream. + * Stat object. * - * @param { ArrayBuffer | string } buffer - buffer. - * @param { object } [options] - options. - * @param { AsyncCallback } callback - The callback is used to return the number of file bytes written to file. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900010 - Try again - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900024 - File too large - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error + * @interface Stat * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 + * @crossplatform + * @since 10 */ /** - * Write stream. + * Stat object. * - * @param { ArrayBuffer | string } buffer - buffer. - * @param { WriteOptions } [options] - options. - * @param { AsyncCallback } callback - The callback is used to return the number of file bytes written to file. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900010 - Try again - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900024 - File too large - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error + * @interface Stat * @syscap SystemCapability.FileManagement.File.FileIO - * @since 11 - */ - write( - buffer: ArrayBuffer | string, - options: WriteOptions, - callback: AsyncCallback - ): void; + * @crossplatform + * @atomicservice + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 + */ + interface Stat { + /** + * @type { bigint } + * @readonly + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + /** + * @type { bigint } + * @readonly + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 + */ + readonly ino: bigint; + /** + * @type { number } + * @readonly + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + /** + * @type { number } + * @readonly + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ + /** + * @type { number } + * @readonly + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 + */ + readonly mode: number; + /** + * @type { number } + * @readonly + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900042 - Unknown error + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + /** + * @type { number } + * @readonly + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900042 - Unknown error + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 + */ + readonly uid: number; + /** + * @type { number } + * @readonly + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + /** + * @type { number } + * @readonly + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 + */ + readonly gid: number; + /** + * @type { number } + * @readonly + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + /** + * @type { number } + * @readonly + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ + /** + * @type { number } + * @readonly + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 + */ + readonly size: number; + /** + * @type { number } + * @readonly + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + /** + * @type { number } + * @readonly + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ + /** + * @type { number } + * @readonly + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 + */ + readonly atime: number; + /** + * @type { number } + * @readonly + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + /** + * @type { number } + * @readonly + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ + /** + * @type { number } + * @readonly + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 + */ + readonly mtime: number; + /** + * @type { number } + * @readonly + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + /** + * @type { number } + * @readonly + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 + */ + readonly ctime: number; + + /** + * Returns nanosecond of the access time. + * @type { bigint } + * @readonly + * @throws { BusinessError } 13900042 - Internal error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'15', '1.2':'20'} + * @arkts 1.1&1.2 + */ + readonly atimeNs?:bigint; + + /** + * Returns nanosecond of the modification time. + * @type { bigint } + * @readonly + * @throws { BusinessError } 13900042 - Internal error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'15', '1.2':'20'} + * @arkts 1.1&1.2 + */ + readonly mtimeNs?:bigint; + + /** + * Returns nanosecond of the change time. + * @type { bigint } + * @readonly + * @throws { BusinessError } 13900042 - Internal error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'15', '1.2':'20'} + * @arkts 1.1&1.2 + */ + readonly ctimeNs?:bigint; + + /** + * + * @type { LocationType } + * @readonly + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 + */ + readonly location: LocationType; + + /** + * Whether path/fd is block device. + * + * @returns { boolean } Returns whether the path/fd point to a block device or not. + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + /** + * Whether path/fd is block device. + * + * @returns { boolean } Returns whether the path/fd point to a block device or not. + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 + */ + isBlockDevice(): boolean; + /** + * Whether path/fd is character device. + * + * @returns { boolean } Returns whether the path/fd point to a character device or not. + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + /** + * Whether path/fd is character device. + * + * @returns { boolean } Returns whether the path/fd point to a character device or not. + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 + */ + isCharacterDevice(): boolean; + /** + * Whether path/fd is directory. + * + * @returns { boolean } Returns whether the path/fd point to a directory or not. + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + /** + * Whether path/fd is directory. + * + * @returns { boolean } Returns whether the path/fd point to a directory or not. + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ + /** + * Whether path/fd is directory. + * + * @returns { boolean } Returns whether the path/fd point to a directory or not. + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 + */ + isDirectory(): boolean; + /** + * Whether path/fd is fifo. + * + * @returns { boolean } Returns whether the path/fd point to a fifo file or not. + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + /** + * Whether path/fd is fifo. + * + * @returns { boolean } Returns whether the path/fd point to a fifo file or not. + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 + */ + isFIFO(): boolean; + /** + * Whether path/fd is file. + * + * @returns { boolean } Returns whether the path/fd point to a normal file or not. + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + /** + * Whether path/fd is file. + * + * @returns { boolean } Returns whether the path/fd point to a normal file or not. + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ + /** + * Whether path/fd is file. + * + * @returns { boolean } Returns whether the path/fd point to a normal file or not. + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 + */ + isFile(): boolean; + /** + * Whether path/fd is socket. + * + * @returns { boolean } Returns whether the path/fd point to a socket file or not. + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + /** + * Whether path/fd is socket. + * + * @returns { boolean } Returns whether the path/fd point to a socket file or not. + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 + */ + isSocket(): boolean; + /** + * Whether path/fd is symbolic link. + * + * @returns { boolean } Returns whether the path/fd point to a symbolic link or not. + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + /** + * Whether path/fd is symbolic link. + * + * @returns { boolean } Returns whether the path/fd point to a symbolic link or not. + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 + */ + isSymbolicLink(): boolean; + } /** - * Write stream with sync interface. + * Stream object * - * @param { ArrayBuffer | string } buffer - buffer. - * @param { object } [options] - options. - * @returns { number } Returns the number of file bytes written to file. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900010 - Try again - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900024 - File too large - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error + * @interface Stream + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 + */ + interface Stream { + /** + * Close stream. + * + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 + */ + close(): Promise; + + /** + * Close stream. + * + * @param { AsyncCallback } callback - Return the callback function. + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 + */ + close(callback: AsyncCallback): void; + + /** + * Close stream with sync interface. + * + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 + */ + closeSync(): void; + + /** + * Flush stream. + * + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 + */ + flush(): Promise; + + /** + * Flush stream. + * + * @param { AsyncCallback } callback - Return the callback function. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 + */ + flush(callback: AsyncCallback): void; + + /** + * Flush stream with sync interface. + * + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 + */ + flushSync(): void; + + /** + * Write stream. + * + * @param { ArrayBuffer | string } buffer - buffer. + * @param { object } [options] - options. + * @returns { Promise } Returns the number of file bytes written to file in promise mode. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + /** + * Write stream. + * + * @param { ArrayBuffer | string } buffer - buffer. + * @param { WriteOptions } [options] - options. + * @returns { Promise } Returns the number of file bytes written to file in promise mode. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 + */ + write( + buffer: ArrayBuffer | string, + options?: WriteOptions + ): Promise; + + /** + * Write stream. + * + * @param { ArrayBuffer | string } buffer - buffer. + * @param { AsyncCallback } callback - The callback is used to return the number of file bytes written to file. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 + */ + write(buffer: ArrayBuffer | string, callback: AsyncCallback): void; + + /** + * Write stream. + * + * @param { ArrayBuffer | string } buffer - buffer. + * @param { object } [options] - options. + * @param { AsyncCallback } callback - The callback is used to return the number of file bytes written to file. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + /** + * Write stream. + * + * @param { ArrayBuffer | string } buffer - buffer. + * @param { WriteOptions } [options] - options. + * @param { AsyncCallback } callback - The callback is used to return the number of file bytes written to file. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 + */ + write( + buffer: ArrayBuffer | string, + options: WriteOptions, + callback: AsyncCallback + ): void; + + /** + * Write stream with sync interface. + * + * @param { ArrayBuffer | string } buffer - buffer. + * @param { object } [options] - options. + * @returns { number } Returns the number of file bytes written to file. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + /** + * Write stream with sync interface. + * + * @param { ArrayBuffer | string } buffer - buffer. + * @param { WriteOptions } [options] - options. + * @returns { number } Returns the number of file bytes written to file. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 + */ + writeSync( + buffer: ArrayBuffer | string, + options?: WriteOptions + ): number; + + /** + * Read stream. + * + * @param { ArrayBuffer } buffer - buffer. + * @param { object } [options] - options. + * @returns { Promise } Returns the number of file bytes read to buffer in promise mode. + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + /** + * Read stream. + * + * @param { ArrayBuffer } buffer - buffer. + * @param { ReadOptions } [options] - options. + * @returns { Promise } Returns the number of file bytes read to buffer in promise mode. + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 11 + */ + /** + * Read stream. + * + * @param { ArrayBuffer } buffer - buffer. + * @param { ReadOptions } [options] - options. + * @returns { Promise } Returns the number of file bytes read to buffer in promise mode. + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900042 - Unknown error + * @throws { BusinessError } 13900044 - Network is unreachable + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 + */ + read( + buffer: ArrayBuffer, + options?: ReadOptions + ): Promise; + + /** + * Read stream. + * + * @param { ArrayBuffer } buffer - buffer. + * @param { AsyncCallback } callback - The callback is used to return the number of file bytes read to buffer. + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 + */ + read(buffer: ArrayBuffer, callback: AsyncCallback): void; + + /** + * Read stream. + * + * @param { ArrayBuffer } buffer - buffer. + * @param { object } [options] - options. + * @param { AsyncCallback } callback - The callback is used to return the number of file bytes read to buffer. + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + /** + * Read stream. + * + * @param { ArrayBuffer } buffer - buffer. + * @param { ReadOptions } [options] - options. + * @param { AsyncCallback } callback - The callback is used to return the number of file bytes read to buffer. + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 + */ + read( + buffer: ArrayBuffer, + options: ReadOptions, + callback: AsyncCallback + ): void; + + /** + * Read stream with sync interface. + * + * @param { ArrayBuffer } buffer - buffer. + * @param { object } [options] - options. + * @returns { number } Returns the number of file bytes read to file. + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + /** + * Read stream with sync interface. + * + * @param { ArrayBuffer } buffer - buffer. + * @param { ReadOptions } [options] - options. + * @returns { number } Returns the number of file bytes read to file. + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 11 + */ + /** + * Read stream with sync interface. + * + * @param { ArrayBuffer } buffer - buffer. + * @param { ReadOptions } [options] - options. + * @returns { number } Returns the number of file bytes read to file. + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900042 - Unknown error + * @throws { BusinessError } 13900044 - Network is unreachable + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 + */ + readSync( + buffer: ArrayBuffer, + options?: ReadOptions + ): number; + } + + /** + * Watcher object + * + * @interface Watcher + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 20 + * @arkts 1.2 + */ + interface Watcher { + /** + * Start watcher. + * + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900021 - File table overflow + * @throws { BusinessError } 13900022 - Too many open files + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 20 + * @arkts 1.2 + */ + start(): void; + + /** + * Stop watcher. + * + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900021 - File table overflow + * @throws { BusinessError } 13900022 - Too many open files + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 20 + * @arkts 1.2 + */ + stop(): void; + } + + /** + * ReaderIterator object + * + * @interface ReaderIterator + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 + */ + interface ReaderIterator { + /** + * Get next result from the iterator. + * + * @returns { ReaderIteratorResult } Returns the result of reader iterator. + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900037 - No data available + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 + */ + next(): ReaderIteratorResult; + } + + /** + * Enumeration of different types of whence. + * + * @enum { number } whence type + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 + */ + enum WhenceType { + /** + * Starting position of the file offset. + * + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 + */ + SEEK_SET = 0, + + /** + * Current position of the file offset. + * + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 + */ + SEEK_CUR = 1, + + /** + * Ending position of the file offset. + * + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 + */ + SEEK_END = 2, + } + + /** + * Enumeration of different types of file location. + * + * @enum { number } location type + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 + */ + enum LocationType { + /** + * Local file. + * + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 + */ + LOCAL = 1 << 0, + + /** + * Cloud file. + * + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 + */ + CLOUD = 1 << 1, + } + + /** + * Enumeration of different types of access mode. + * + * @enum { number } access mode type * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 - */ + * @atomicservice + * @since {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 + */ + enum AccessModeType { + /** + * Check if the file exists. + * + * @syscap SystemCapability.FileManagement.File.FileIO + * @atomicservice + * @since {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 + */ + EXIST = 0, + + /** + * Check if the file has write permission. + * + * @syscap SystemCapability.FileManagement.File.FileIO + * @atomicservice + * @since {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 + */ + WRITE = 2, + + /** + * Check if the file has read permission. + * + * @syscap SystemCapability.FileManagement.File.FileIO + * @atomicservice + * @since {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 + */ + READ = 4, + + /** + * Check if the file has read and write permission. + * + * @syscap SystemCapability.FileManagement.File.FileIO + * @atomicservice + * @since {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 + */ + READ_WRITE = 6, + } + /** - * Write stream with sync interface. + * Enumeration of different types of access flag. + * + * @enum { number } access flag type + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 + */ + enum AccessFlagType { + /** + * Check if the file is on the local. + * + * @syscap SystemCapability.FileManagement.File.FileIO + * @since {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 + */ + LOCAL = 0, + } +} + +/** + * Task signal. + * @typedef { fileIo.TaskSignal } + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 20 + * @arkts 1.2 + */ +type TaskSignal = fileIo.TaskSignal; + +/** + * The AtomicFile class provides methods for performing atomic operations on files. + * @typedef { fileIo.AtomicFile } + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 20 + * @arkts 1.2 + */ +type AtomicFile = fileIo.AtomicFile; + +/** + * Watcher object + * @typedef { fileIo.Watcher } + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 20 + * @arkts 1.2 + */ +type Watcher = fileIo.Watcher; + +/** + * Get options of copy + * + * @typedef { fileIo.CopyOptions } + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 20 + * @arkts 1.2 + */ +type CopyOptions = fileIo.CopyOptions; + +/** + * Task signal. + * + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 12 + */ +class TaskSignal { + /** + * Cancel the copy task in progress. * - * @param { ArrayBuffer | string } buffer - buffer. - * @param { WriteOptions } [options] - options. - * @returns { number } Returns the number of file bytes written to file. - * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor * @throws { BusinessError } 13900010 - Try again - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900024 - File too large - * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900041 - Quota exceeded - * @throws { BusinessError } 13900042 - Unknown error + * @throws { BusinessError } 13900012 - Permission denied by the file system + * @throws { BusinessError } 13900043 - No task can be canceled. * @syscap SystemCapability.FileManagement.File.FileIO - * @since 11 + * @since 12 */ - writeSync( - buffer: ArrayBuffer | string, - options?: WriteOptions - ): number; + cancel(): void; /** - * Read stream. + * Subscribe the cancel event of current task. * - * @param { ArrayBuffer } buffer - buffer. - * @param { object } [options] - options. - * @returns { Promise } Returns the number of file bytes read to buffer in promise mode. + * @returns { Promise } Return the result of the cancel event. * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900010 - Try again - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900034 - Operation would block * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 + * @since 12 */ + onCancel(): Promise; +} + +/** + * The AtomicFile class provides methods for performing atomic operations on files. + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 15 + */ +class AtomicFile { /** - * Read stream. - * - * @param { ArrayBuffer } buffer - buffer. - * @param { ReadOptions } [options] - options. - * @returns { Promise } Returns the number of file bytes read to buffer in promise mode. - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900010 - Try again - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900042 - Unknown error + * The AtomicFile constructor. + * @param { string } path file path. + * @throws { BusinessError } 401 Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. * @syscap SystemCapability.FileManagement.File.FileIO - * @since 11 + * @since 15 */ + constructor(path: string); + /** - * Read stream. - * - * @param { ArrayBuffer } buffer - buffer. - * @param { ReadOptions } [options] - options. - * @returns { Promise } Returns the number of file bytes read to buffer in promise mode. - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900010 - Try again - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900042 - Unknown error - * @throws { BusinessError } 13900044 - Network is unreachable + * Get the File object from AtomicFile object. + * @returns { File } Returns the file object. + * @throws { BusinessError } 13900002 No such file or directory + * @throws { BusinessError } 13900005 IO error + * @throws { BusinessError } 13900012 Permission denied + * @throws { BusinessError } 13900042 Internal error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 12 + * @since 15 */ - read( - buffer: ArrayBuffer, - options?: ReadOptions - ): Promise; + getBaseFile(): File; /** - * Read stream. - * - * @param { ArrayBuffer } buffer - buffer. - * @param { AsyncCallback } callback - The callback is used to return the number of file bytes read to buffer. - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900010 - Try again - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900042 - Unknown error + * Create the file read stream. + * @returns { ReadStream } Returns the file read stream. + * @throws { BusinessError } 13900001 Operation not permitted + * @throws { BusinessError } 13900002 No such file or directory + * @throws { BusinessError } 13900012 Permission denied + * @throws { BusinessError } 13900042 Internal error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 + * @since 15 */ - read(buffer: ArrayBuffer, callback: AsyncCallback): void; + openRead(): ReadStream; /** - * Read stream. - * - * @param { ArrayBuffer } buffer - buffer. - * @param { object } [options] - options. - * @param { AsyncCallback } callback - The callback is used to return the number of file bytes read to buffer. - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900010 - Try again - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900042 - Unknown error + * Read the entire contents of the file. + * @returns { ArrayBuffer } Returns the ArrayBuffer of the file contents. + * @throws { BusinessError } 13900005 I/O error + * @throws { BusinessError } 13900042 Internal error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 + * @since 15 */ + readFully(): ArrayBuffer; + /** - * Read stream. - * - * @param { ArrayBuffer } buffer - buffer. - * @param { ReadOptions } [options] - options. - * @param { AsyncCallback } callback - The callback is used to return the number of file bytes read to buffer. - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900010 - Try again - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900042 - Unknown error + * Create the file write stream. + * @returns { WriteStream } Returns the file write stream. + * @throws { BusinessError } 13900001 Operation not permitted + * @throws { BusinessError } 13900002 No such file or directory + * @throws { BusinessError } 13900012 Permission denied + * @throws { BusinessError } 13900027 Read-only file system + * @throws { BusinessError } 13900042 Internal error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 11 + * @since 15 */ - read( - buffer: ArrayBuffer, - options: ReadOptions, - callback: AsyncCallback - ): void; + startWrite(): WriteStream; /** - * Read stream with sync interface. - * - * @param { ArrayBuffer } buffer - buffer. - * @param { object } [options] - options. - * @returns { number } Returns the number of file bytes read to file. - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900010 - Try again - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900042 - Unknown error + * If the file is written successfully, the file is closed. + * @throws { BusinessError } 13900042 Internal error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 + * @since 15 */ + finishWrite(): void; + /** - * Read stream with sync interface. - * - * @param { ArrayBuffer } buffer - buffer. - * @param { ReadOptions } [options] - options. - * @returns { number } Returns the number of file bytes read to file. - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900010 - Try again - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900042 - Unknown error + * If writing to the file fails, the file is rolled back. + * @throws { BusinessError } 13900042 Internal error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 11 + * @since 15 */ + failWrite(): void; + /** - * Read stream with sync interface. - * - * @param { ArrayBuffer } buffer - buffer. - * @param { ReadOptions } [options] - options. - * @returns { number } Returns the number of file bytes read to file. - * @throws { BusinessError } 13900004 - Interrupted system call - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900010 - Try again - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900019 - Is a directory - * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900042 - Unknown error - * @throws { BusinessError } 13900044 - Network is unreachable + * Delete all file. + * @throws { BusinessError } 13900001 Operation not permitted + * @throws { BusinessError } 13900002 No such file or directory + * @throws { BusinessError } 13900012 Permission denied + * @throws { BusinessError } 13900027 Read-only file system + * @throws { BusinessError } 13900042 Internal error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 12 + * @since 15 */ - readSync( - buffer: ArrayBuffer, - options?: ReadOptions - ): number; + delete(): void; } /** @@ -8299,7 +8766,7 @@ declare interface Stream { * @syscap SystemCapability.FileManagement.File.FileIO * @since 10 */ -export interface WatchEventListener { +interface WatchEventListener { /** * Specifies the callback function to be invoked. * @@ -8315,16 +8782,18 @@ export interface WatchEventListener { * * @interface WatchEvent * @syscap SystemCapability.FileManagement.File.FileIO - * @since 10 + * @since {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 */ -export interface WatchEvent { +interface WatchEvent { /** * File name. * * @type { string } * @readonly * @syscap SystemCapability.FileManagement.File.FileIO - * @since 10 + * @since {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 */ readonly fileName: string; @@ -8334,7 +8803,8 @@ export interface WatchEvent { * @type { number } * @readonly * @syscap SystemCapability.FileManagement.File.FileIO - * @since 10 + * @since {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 */ readonly event: number; @@ -8344,7 +8814,8 @@ export interface WatchEvent { * @type { number } * @readonly * @syscap SystemCapability.FileManagement.File.FileIO - * @since 10 + * @since {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 */ readonly cookie: number; } @@ -8356,7 +8827,7 @@ export interface WatchEvent { * @syscap SystemCapability.FileManagement.File.FileIO * @since 10 */ -export interface Watcher { +interface Watcher { /** * Start watcher. * @@ -8405,15 +8876,17 @@ export interface Watcher { * * @interface ReaderIteratorResult * @syscap SystemCapability.FileManagement.File.FileIO - * @since 11 + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 */ -export interface ReaderIteratorResult { +interface ReaderIteratorResult { /** * Whether reader iterator completes the traversal. * * @type { boolean } * @syscap SystemCapability.FileManagement.File.FileIO - * @since 11 + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 */ done: boolean; @@ -8422,32 +8895,39 @@ export interface ReaderIteratorResult { * * @type { string } * @syscap SystemCapability.FileManagement.File.FileIO - * @since 11 + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 */ value: string; } /** - * ReaderIterator object + * Get options of copy * - * @interface ReaderIterator + * @typedef CopyOptions * @syscap SystemCapability.FileManagement.File.FileIO * @since 11 */ -declare interface ReaderIterator { +interface CopyOptions { /** - * Get next result from the iterator. + * Listener of copy progress * - * @returns { ReaderIteratorResult } Returns the result of reader iterator. - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900037 - No data available - * @throws { BusinessError } 13900042 - Unknown error + * @type { ?ProgressListener } * @syscap SystemCapability.FileManagement.File.FileIO * @since 11 */ - next(): ReaderIteratorResult; + progressListener?: ProgressListener; + /** + * Cancel signal of copy. + * + * @type { ?TaskSignal } + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 12 + */ + copySignal?: TaskSignal; } + /** * File filter type * @@ -8462,9 +8942,10 @@ declare interface ReaderIterator { * @syscap SystemCapability.FileManagement.File.FileIO * @crossplatform * @atomicservice - * @since 11 + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 */ -export interface Filter { +interface Filter { /** * The suffix of the file. * @@ -8479,7 +8960,8 @@ export interface Filter { * @syscap SystemCapability.FileManagement.File.FileIO * @crossplatform * @atomicservice - * @since 11 + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 */ suffix?: Array; /** @@ -8496,7 +8978,8 @@ export interface Filter { * @syscap SystemCapability.FileManagement.File.FileIO * @crossplatform * @atomicservice - * @since 11 + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 */ displayName?: Array; /** @@ -8513,7 +8996,8 @@ export interface Filter { * @syscap SystemCapability.FileManagement.File.FileIO * @crossplatform * @atomicservice - * @since 11 + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 */ mimeType?: Array; /** @@ -8530,7 +9014,8 @@ export interface Filter { * @syscap SystemCapability.FileManagement.File.FileIO * @crossplatform * @atomicservice - * @since 11 + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 */ fileSizeOver?: number; /** @@ -8547,7 +9032,8 @@ export interface Filter { * @syscap SystemCapability.FileManagement.File.FileIO * @crossplatform * @atomicservice - * @since 11 + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 */ lastModifiedAfter?: number; /** @@ -8564,7 +9050,8 @@ export interface Filter { * @syscap SystemCapability.FileManagement.File.FileIO * @crossplatform * @atomicservice - * @since 11 + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 */ excludeMedia?: boolean; } @@ -8580,9 +9067,10 @@ export interface Filter { * * @interface ConflictFiles * @syscap SystemCapability.FileManagement.File.FileIO - * @since 11 + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 */ -export interface ConflictFiles { +interface ConflictFiles { /** * The path of the source file. * @@ -8595,7 +9083,8 @@ export interface ConflictFiles { * * @type { string } * @syscap SystemCapability.FileManagement.File.FileIO - * @since 11 + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 */ srcFile: string; @@ -8611,7 +9100,8 @@ export interface ConflictFiles { * * @type { string } * @syscap SystemCapability.FileManagement.File.FileIO - * @since 11 + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 */ destFile: string; } @@ -8621,15 +9111,17 @@ export interface ConflictFiles { * * @interface Options * @syscap SystemCapability.FileManagement.File.FileIO - * @since 11 + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 */ -export interface Options { +interface Options { /** * The encoding style. * * @type { ?string } * @syscap SystemCapability.FileManagement.File.FileIO - * @since 11 + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 */ encoding?: string; } @@ -8640,16 +9132,18 @@ export interface Options { * @interface ReadOptions * @syscap SystemCapability.FileManagement.File.FileIO * @atomicservice - * @since 11 + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 */ -export interface ReadOptions { +interface ReadOptions { /** * The offset when reading the file. * * @type { ?number } * @syscap SystemCapability.FileManagement.File.FileIO * @atomicservice - * @since 11 + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 */ offset?: number; /** @@ -8658,7 +9152,8 @@ export interface ReadOptions { * @type { ?number } * @syscap SystemCapability.FileManagement.File.FileIO * @atomicservice - * @since 11 + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 */ length?: number; } @@ -8670,16 +9165,18 @@ export interface ReadOptions { * @interface ReadTextOptions * @syscap SystemCapability.FileManagement.File.FileIO * @atomicservice - * @since 11 + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 */ -export interface ReadTextOptions extends ReadOptions { +interface ReadTextOptions extends ReadOptions { /** * The encoding style when reading text. * * @type { ?string } * @syscap SystemCapability.FileManagement.File.FileIO * @atomicservice - * @since 11 + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 */ encoding?: string; } @@ -8691,16 +9188,18 @@ export interface ReadTextOptions extends ReadOptions { * @interface WriteOptions * @syscap SystemCapability.FileManagement.File.FileIO * @atomicservice - * @since 11 + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 */ -export interface WriteOptions extends Options { +interface WriteOptions extends Options { /** * The offset when writing the file. * * @type { ?number } * @syscap SystemCapability.FileManagement.File.FileIO * @atomicservice - * @since 11 + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 */ offset?: number; /** @@ -8709,7 +9208,8 @@ export interface WriteOptions extends Options { * @type { ?number } * @syscap SystemCapability.FileManagement.File.FileIO * @atomicservice - * @since 11 + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 */ length?: number; } @@ -8720,16 +9220,18 @@ export interface WriteOptions extends Options { * @interface ListFileOptions * @syscap SystemCapability.FileManagement.File.FileIO * @atomicservice - * @since 11 + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 */ -export interface ListFileOptions { +interface ListFileOptions { /** * Whether to recursively list files. * * @type { ?boolean } * @syscap SystemCapability.FileManagement.File.FileIO * @atomicservice - * @since 11 + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 */ recursion?: boolean; @@ -8739,7 +9241,8 @@ export interface ListFileOptions { * @type { ?number } * @syscap SystemCapability.FileManagement.File.FileIO * @atomicservice - * @since 11 + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 */ listNum?: number; @@ -8749,7 +9252,8 @@ export interface ListFileOptions { * @type { ?Filter } * @syscap SystemCapability.FileManagement.File.FileIO * @atomicservice - * @since 11 + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 */ filter?: Filter; } @@ -8759,15 +9263,17 @@ export interface ListFileOptions { * * @interface RandomAccessFileOptions * @syscap SystemCapability.FileManagement.File.FileIO - * @since 12 + * @since {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 */ -export interface RandomAccessFileOptions { +interface RandomAccessFileOptions { /** * The starting position of file offset. * * @type { ?number } * @syscap SystemCapability.FileManagement.File.FileIO - * @since 12 + * @since {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 */ start?: number; @@ -8776,7 +9282,8 @@ export interface RandomAccessFileOptions { * * @type { ?number } * @syscap SystemCapability.FileManagement.File.FileIO - * @since 12 + * @since {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 */ end?: number; } @@ -8786,15 +9293,17 @@ export interface RandomAccessFileOptions { * * @interface ReadStreamOptions * @syscap SystemCapability.FileManagement.File.FileIO - * @since 12 + * @since {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 */ -export interface ReadStreamOptions { +interface ReadStreamOptions { /** * The starting range for reading a file by stream. * * @type { ?number } * @syscap SystemCapability.FileManagement.File.FileIO - * @since 12 + * @since {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 */ start?: number; @@ -8803,7 +9312,8 @@ export interface ReadStreamOptions { * * @type { ?number } * @syscap SystemCapability.FileManagement.File.FileIO - * @since 12 + * @since {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 */ end?: number; } @@ -8813,15 +9323,17 @@ export interface ReadStreamOptions { * * @interface WriteStreamOptions * @syscap SystemCapability.FileManagement.File.FileIO - * @since 12 + * @since {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 */ -export interface WriteStreamOptions { +interface WriteStreamOptions { /** * The mode for creating write stream. * * @type { ?number } * @syscap SystemCapability.FileManagement.File.FileIO - * @since 12 + * @since {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 */ mode?: number; /** @@ -8829,147 +9341,62 @@ export interface WriteStreamOptions { * * @type { ?number } * @syscap SystemCapability.FileManagement.File.FileIO - * @since 12 + * @since {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 */ start?: number; } /** - * The listeners of Distributed File System. + * Connect Distributed File System. * - * @typedef DfsListeners + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param { string } networkId - The networkId of device. + * @param { DfsListeners } listeners - The listeners of Distributed File System. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameter types. + * @throws { BusinessError } 13900045 - Connection failed. + * @throws { BusinessError } 13900046 - Software caused connection abort. * @syscap SystemCapability.FileManagement.File.FileIO * @since 12 */ -export interface DfsListeners { - /** - * The Listener of Distributed File System status - * - * @param { string } networkId - The networkId of device. - * @param { number } status - The status code of Distributed File System. - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 12 - */ - onStatus(networkId: string, status: number): void; -} - -/** - * Enumeration of different types of whence. - * - * @enum { number } whence type - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 11 - */ -declare enum WhenceType { - /** - * Starting position of the file offset. - * - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 11 - */ - SEEK_SET = 0, - - /** - * Current position of the file offset. - * - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 11 - */ - SEEK_CUR = 1, - - /** - * Ending position of the file offset. - * - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 11 - */ - SEEK_END = 2, -} - -/** - * Enumeration of different types of file location. - * - * @enum { number } location type - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 11 - */ -declare enum LocationType { - /** - * Local file. - * - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 11 - */ - LOCAL = 1 << 0, - - /** - * Cloud file. - * - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 11 - */ - CLOUD = 1 << 1, -} +declare function connectDfs(networkId: string, listeners: DfsListeners): Promise; /** - * Enumeration of different types of access mode. + * Disconnect Distributed File System. * - * @enum { number } access mode type + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param { string } networkId - The networkId of device. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameter types. + * @throws { BusinessError } 13600004 - Unmount failed. * @syscap SystemCapability.FileManagement.File.FileIO - * @atomicservice * @since 12 */ -declare enum AccessModeType { - /** - * Check if the file exists. - * - * @syscap SystemCapability.FileManagement.File.FileIO - * @atomicservice - * @since 12 - */ - EXIST = 0, - - /** - * Check if the file has write permission. - * - * @syscap SystemCapability.FileManagement.File.FileIO - * @atomicservice - * @since 12 - */ - WRITE = 2, - - /** - * Check if the file has read permission. - * - * @syscap SystemCapability.FileManagement.File.FileIO - * @atomicservice - * @since 12 - */ - READ = 4, +declare function disconnectDfs(networkId: string): Promise; - /** - * Check if the file has read and write permission. - * - * @syscap SystemCapability.FileManagement.File.FileIO - * @atomicservice - * @since 12 - */ - READ_WRITE = 6, -} /** - * Enumeration of different types of access flag. + * The listeners of Distributed File System. * - * @enum { number } access flag type + * @typedef DfsListeners * @syscap SystemCapability.FileManagement.File.FileIO * @since 12 */ -declare enum AccessFlagType { +interface DfsListeners { /** - * Check if the file is on the local. + * The Listener of Distributed File System status * + * @param { string } networkId - The networkId of device. + * @param { number } status - The status code of Distributed File System. * @syscap SystemCapability.FileManagement.File.FileIO * @since 12 */ - LOCAL = 0, + onStatus(networkId: string, status: number): void; } + +export default fileIo; \ No newline at end of file diff --git a/api/@ohos.file.hash.d.ts b/api/@ohos.file.hash.d.ts index bd9f4e28b30543ef302d3e9b8c81bb1271c3e8f0..700e97c301fe432908d66439a127057cd2e5792c 100644 --- a/api/@ohos.file.hash.d.ts +++ b/api/@ohos.file.hash.d.ts @@ -34,7 +34,8 @@ import stream from './@ohos.util.stream'; * @namespace hash * @syscap SystemCapability.FileManagement.File.FileIO * @atomicservice - * @since 11 + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 */ declare namespace hash { /** @@ -58,7 +59,8 @@ declare namespace hash { * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO * @atomicservice - * @since 11 + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 */ function hash(path: string, algorithm: string): Promise; @@ -83,7 +85,8 @@ declare namespace hash { * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO * @atomicservice - * @since 11 + * @since {'1.1':'11', '1.2':'20'} + * @arkts 1.1&1.2 */ function hash(path: string, algorithm: string, callback: AsyncCallback): void; @@ -92,7 +95,8 @@ declare namespace hash { * * @extends stream.Transform * @syscap SystemCapability.FileManagement.File.FileIO - * @since 12 + * @since {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 */ class HashStream extends stream.Transform { /** @@ -102,7 +106,8 @@ declare namespace hash { * @throws { BusinessError } 401 - Parameter error * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 12 + * @since {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 */ digest(): string; @@ -113,7 +118,8 @@ declare namespace hash { * @throws { BusinessError } 401 - Parameter error * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 12 + * @since {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 */ update(data: ArrayBuffer): void; } @@ -127,7 +133,8 @@ declare namespace hash { * @throws { BusinessError } 13900020 - Invalid argument * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 12 + * @since {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 */ function createHash(algorithm: string): HashStream; } diff --git a/api/@ohos.file.securityLabel.d.ts b/api/@ohos.file.securityLabel.d.ts index 6167dc92ace646abc9354557a9cc0b9780f5c409..50e8b574945ea0a99417c83395855c30b5f22205 100644 --- a/api/@ohos.file.securityLabel.d.ts +++ b/api/@ohos.file.securityLabel.d.ts @@ -25,7 +25,8 @@ import type { AsyncCallback } from './@ohos.base'; * * @namespace securityLabel * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 + * @since {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 */ declare namespace securityLabel { /** @@ -33,7 +34,8 @@ declare namespace securityLabel { * * @typedef { 's0' | 's1' | 's2' | 's3' | 's4' } * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 + * @since {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 */ type DataLevel = 's0' | 's1' | 's2' | 's3' | 's4'; @@ -52,7 +54,8 @@ declare namespace securityLabel { * @throws { BusinessError } 13900041 - Quota exceeded * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 + * @since {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 */ function setSecurityLabel(path: string, type: DataLevel): Promise; @@ -71,7 +74,8 @@ declare namespace securityLabel { * @throws { BusinessError } 13900041 - Quota exceeded * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 + * @since {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 */ function setSecurityLabel(path: string, type: DataLevel, callback: AsyncCallback): void; @@ -89,7 +93,8 @@ declare namespace securityLabel { * @throws { BusinessError } 13900041 - Quota exceeded * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 + * @since {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 */ function setSecurityLabelSync(path: string, type: DataLevel): void; @@ -107,7 +112,8 @@ declare namespace securityLabel { * @throws { BusinessError } 13900041 - Quota exceeded * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 + * @since {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 */ function getSecurityLabel(path: string): Promise; @@ -125,7 +131,8 @@ declare namespace securityLabel { * @throws { BusinessError } 13900041 - Quota exceeded * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 + * @since {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 */ function getSecurityLabel(path: string, callback: AsyncCallback): void; @@ -143,7 +150,8 @@ declare namespace securityLabel { * @throws { BusinessError } 13900041 - Quota exceeded * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 + * @since {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 */ function getSecurityLabelSync(path: string): string; }