diff --git a/api/@ohos.file.environment.d.ts b/api/@ohos.file.environment.d.ts index 5d89e2c967fc799815049604852d2b59344036a2..cb5c78b0fd6a47e2f5d2dedc6d893ae01600dffb 100644 --- a/api/@ohos.file.environment.d.ts +++ b/api/@ohos.file.environment.d.ts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021-2023 Huawei Device Co., Ltd. + * Copyright (C) 2021-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -25,7 +25,8 @@ import type { AsyncCallback } from './@ohos.base'; * * @namespace Environment * @syscap SystemCapability.FileManagement.File.Environment - * @since 11 + * @since arkts {'1.1':'11','1.2':'20'} + * @arkts 1.1&1.2 */ declare namespace Environment { /** @@ -37,7 +38,8 @@ declare namespace Environment { * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.Environment * @systemapi - * @since 8 + * @since arkts {'1.1':'8','1.2':'20'} + * @arkts 1.1&1.2 */ function getStorageDataDir(): Promise; @@ -50,7 +52,8 @@ declare namespace Environment { * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.Environment * @systemapi - * @since 8 + * @since arkts {'1.1':'8','1.2':'20'} + * @arkts 1.1&1.2 */ function getStorageDataDir(callback: AsyncCallback): void; @@ -63,7 +66,8 @@ declare namespace Environment { * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.Environment * @systemapi - * @since 8 + * @since arkts {'1.1':'8','1.2':'20'} + * @arkts 1.1&1.2 */ function getUserDataDir(): Promise; @@ -76,7 +80,8 @@ declare namespace Environment { * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.Environment * @systemapi - * @since 8 + * @since arkts {'1.1':'8','1.2':'20'} + * @arkts 1.1&1.2 */ function getUserDataDir(callback: AsyncCallback): void; @@ -98,7 +103,8 @@ declare namespace Environment { * @throws { BusinessError } 801 - Capability not supported. * @throws { BusinessError } 13900042 - Unknown error. * @syscap SystemCapability.FileManagement.File.Environment.FolderObtain - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ function getUserDownloadDir(): string; @@ -120,7 +126,8 @@ declare namespace Environment { * @throws { BusinessError } 801 - Capability not supported. * @throws { BusinessError } 13900042 - Unknown error. * @syscap SystemCapability.FileManagement.File.Environment.FolderObtain - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ function getUserDesktopDir(): string; @@ -142,7 +149,8 @@ declare namespace Environment { * @throws { BusinessError } 801 - Capability not supported. * @throws { BusinessError } 13900042 - Unknown error. * @syscap SystemCapability.FileManagement.File.Environment.FolderObtain - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ function getUserDocumentDir(): string; @@ -157,7 +165,8 @@ declare namespace Environment { * @throws { BusinessError } 13900042 - Unknown error. * @syscap SystemCapability.FileManagement.File.Environment.FolderObtain * @systemapi Hide this for inner system use. - * @since 11 + * @since arkts {'1.1':'11','1.2':'20'} + * @arkts 1.1&1.2 */ function getExternalStorageDir(): string; @@ -172,7 +181,8 @@ declare namespace Environment { * @throws { BusinessError } 13900042 - Unknown error. * @syscap SystemCapability.FileManagement.File.Environment.FolderObtain * @systemapi Hide this for inner system use. - * @since 11 + * @since arkts {'1.1':'11','1.2':'20'} + * @arkts 1.1&1.2 */ function getUserHomeDir(): string; } diff --git a/api/@ohos.file.fs.d.ets b/api/@ohos.file.fs.d.ets index bba5b665e5a7b4ddee43c4517b67aead1a428e73..de66fce23e5c76a836db8164273df9fe7e70432c 100644 --- a/api/@ohos.file.fs.d.ets +++ b/api/@ohos.file.fs.d.ets @@ -21,32 +21,6 @@ import { AsyncCallback } from './@ohos.base'; import stream from './@ohos.util.stream'; -export default fileIo; - -/** - * FileIO - * - * @namespace fileIo - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 - */ -/** - * FileIO - * - * @namespace fileIo - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @since 10 - */ -/** - * FileIO - * - * @namespace fileIo - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice - * @since 11 - */ /** * FileIO * @@ -54,107 +28,10 @@ export default fileIo; * @syscap SystemCapability.FileManagement.File.FileIO * @crossplatform * @atomicservice - * @since 12 + * @since 20 */ 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 { Watcher }; - export { WhenceType }; - export { TaskSignal }; - export { connectDfs }; - export { disconnectDfs }; - export { Progress }; - export { CopyOptions }; - export { ProgressListener }; - export type { DfsListeners }; - /** - * Mode Indicates the open flags. - * - * @namespace OpenMode - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 - */ - /** - * Mode Indicates the open flags. - * - * @namespace OpenMode - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @since 10 - */ /** * Mode Indicates the open flags. * @@ -162,24 +39,9 @@ declare namespace fileIo { * @syscap SystemCapability.FileManagement.File.FileIO * @crossplatform * @atomicservice - * @since 11 + * @since 20 */ namespace OpenMode { - /** - * Read only Permission. - * - * @constant - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 - */ - /** - * Read only Permission. - * - * @constant - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @since 10 - */ /** * Read only Permission. * @@ -187,24 +49,9 @@ declare namespace fileIo { * @syscap SystemCapability.FileManagement.File.FileIO * @crossplatform * @atomicservice - * @since 11 + * @since 20 */ const READ_ONLY = 0o0; - /** - * Write only Permission. - * - * @constant - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 - */ - /** - * Write only Permission. - * - * @constant - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @since 10 - */ /** * Write only Permission. * @@ -212,24 +59,9 @@ declare namespace fileIo { * @syscap SystemCapability.FileManagement.File.FileIO * @crossplatform * @atomicservice - * @since 11 + * @since 20 */ const WRITE_ONLY = 0o1; - /** - * Write and Read Permission. - * - * @constant - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 - */ - /** - * Write and Read Permission. - * - * @constant - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @since 10 - */ /** * Write and Read Permission. * @@ -237,24 +69,9 @@ declare namespace fileIo { * @syscap SystemCapability.FileManagement.File.FileIO * @crossplatform * @atomicservice - * @since 11 + * @since 20 */ const READ_WRITE = 0o2; - /** - * If not exist, create file. - * - * @constant - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 - */ - /** - * If not exist, create file. - * - * @constant - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @since 10 - */ /** * If not exist, create file. * @@ -262,24 +79,9 @@ declare namespace fileIo { * @syscap SystemCapability.FileManagement.File.FileIO * @crossplatform * @atomicservice - * @since 11 + * @since 20 */ const CREATE = 0o100; - /** - * File truncate len 0. - * - * @constant - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 - */ - /** - * File truncate len 0. - * - * @constant - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @since 10 - */ /** * File truncate len 0. * @@ -287,24 +89,9 @@ declare namespace fileIo { * @syscap SystemCapability.FileManagement.File.FileIO * @crossplatform * @atomicservice - * @since 11 + * @since 20 */ const TRUNC = 0o1000; - /** - * File append write. - * - * @constant - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 - */ - /** - * File append write. - * - * @constant - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @since 10 - */ /** * File append write. * @@ -312,81 +99,53 @@ declare namespace fileIo { * @syscap SystemCapability.FileManagement.File.FileIO * @crossplatform * @atomicservice - * @since 11 + * @since 20 */ const APPEND = 0o2000; - /** - * File open in nonblocking mode. - * - * @constant - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 - */ /** * File open in nonblocking mode. * * @constant * @syscap SystemCapability.FileManagement.File.FileIO * @crossplatform - * @since 10 + * @since 20 */ const NONBLOCK = 0o4000; - /** - * File is Dir. - * - * @constant - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 - */ /** * File is Dir. * * @constant * @syscap SystemCapability.FileManagement.File.FileIO * @crossplatform - * @since 10 + * @since 20 */ const DIR = 0o200000; - /** - * File is not symbolic link. - * - * @constant - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 - */ /** * File is not symbolic link. * * @constant * @syscap SystemCapability.FileManagement.File.FileIO * @crossplatform - * @since 10 + * @since 20 */ const NOFOLLOW = 0o400000; - /** - * SYNC IO. - * - * @constant - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 - */ /** * SYNC IO. * * @constant * @syscap SystemCapability.FileManagement.File.FileIO * @crossplatform - * @since 10 + * @since 20 */ const SYNC = 0o4010000; } -} /** * Access file. * * @param { string } path - path. - * @returns { Promise } return Promise + * @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 @@ -400,13 +159,17 @@ declare namespace fileIo { * @throws { BusinessError } 13900033 - Too many symbolic links encountered * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 + * @crossplatform + * @atomicservice + * @since 20 */ +function access(path: string, mode?: AccessModeType): Promise; + /** * Access file. * * @param { string } path - path. - * @returns { Promise } Returns the file is accessible or not in promise mode. + * @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 @@ -421,16 +184,21 @@ declare namespace fileIo { * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO * @crossplatform - * @since 10 + * @atomicservice + * @since 20 */ +function access(path: string, callback: AsyncCallback): void; + /** * Access file. * - * @param { string } path - path. + * @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 } 13900002 - No such file or directory + * @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 } 13900008 - Bad file descriptor * @throws { BusinessError } 13900011 - Out of memory * @throws { BusinessError } 13900012 - Permission denied * @throws { BusinessError } 13900013 - Bad address @@ -439,18 +207,18 @@ declare namespace fileIo { * @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 + * @since 20 */ +function access(path: string, mode: AccessModeType, flag: AccessFlagType): Promise; + /** - * Access file. + * + * Access file with sync interface. * * @param { string } path - path. * @param { AccessModeType } [mode = fs.AccessModeType.EXIST] - accessibility mode. - * @returns { Promise } Returns the file is accessible or not in promise 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 @@ -466,18 +234,20 @@ declare namespace fileIo { * @syscap SystemCapability.FileManagement.File.FileIO * @crossplatform * @atomicservice - * @since 12 + * @since 20 */ -declare function access(path: string, mode?: AccessModeType): Promise; +function accessSync(path: string, mode?: AccessModeType): boolean; /** - * Access file. + * Access file with sync interface. * - * @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 + * @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 } 13900008 - Bad file descriptor * @throws { BusinessError } 13900011 - Out of memory * @throws { BusinessError } 13900012 - Permission denied * @throws { BusinessError } 13900013 - Bad address @@ -486,5554 +256,2422 @@ declare function access(path: string, mode?: AccessModeType): Promise; * @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 + * @since 20 */ +function accessSync(path: string, mode: AccessModeType, flag: AccessFlagType): boolean; + /** - * Access file. + * Close file or fd. * - * @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 + * @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 } 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 } 13900025 - No space left on device + * @throws { BusinessError } 13900041 - Quota exceeded * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO * @crossplatform - * @since 10 + * @atomicservice + * @since 20 */ +function close(file: number | File): Promise; + /** - * Access file. + * Close file or fd. * - * @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 + * @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 } 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 } 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 + * @since 20 */ -declare function access(path: string, callback: AsyncCallback): void; +function close(file: number | File, callback: AsyncCallback): void; /** - * Access file. + * Close file or fd 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 { 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. + * @param { number | File } file - file object or fd. + * @throws { BusinessError } 13900004 - Interrupted system call * @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 + * @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 12 + * @crossplatform + * @atomicservice + * @since 20 */ -declare function access(path: string, mode: AccessModeType, flag: AccessFlagType): Promise; +function closeSync(file: number | File): void; /** - * Access file with sync interface. + * Copy file or directory. * - * @param { string } path - path. - * @returns { boolean } Returns the file is accessible or not. + * @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 - * @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 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; - -/** - * 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; - -/** - * 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; - -/** - * 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; - -/** - * 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; - -/** - * 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; - -/** - * 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; - - -/** - * 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 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 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 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 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 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; - -/** - * 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; - -/** - * 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; - -/** - * 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; - -/** - * 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; - -/** - * 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; - -/** - * 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; - -/** - * 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; - -/** - * 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 } 13900012 - Permission denied by the file system * @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 } 13900021 - File table overflow * @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 } 13900028 - Too many links * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @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 - * @crossplatform - * @atomicservice - * @since 11 + * @since 20 */ +function copy(srcUri: string, destUri: string, options?: CopyOptions): Promise; + /** - * Open file with sync interface. + * Copy file or directory. * - * @param { string } path - path. - * @param { number } [mode = OpenMode.READ_ONLY] - mode. - * @returns { File } Returns the File object to record the file descriptor. + * @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 } 13900006 - No such device or address + * @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 } 13900014 - Device or resource busy + * @throws { BusinessError } 13900012 - Permission denied by the file system * @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 } 13900021 - File table overflow * @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 } 13900028 - Too many links * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @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 - * @crossplatform - * @atomicservice - * @since 12 + * @since 20 */ -declare function openSync(path: string, mode?: number): File; +function copy(srcUri: string, destUri: 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. + * Copy file or directory. * - * @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. + * @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 } 13900013 - Bad address + * @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 - * @crossplatform - * @atomicservice - * @since 11 + * @since 20 */ +function copy(srcUri: string, destUri: string, options: CopyOptions, callback: AsyncCallback): void; + /** - * Read file. + * Copy directory. * - * @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. + * @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 - * @crossplatform - * @atomicservice - * @since 12 + * @since 20 */ -declare function read( - fd: number, - buffer: ArrayBuffer, - options?: ReadOptions -): Promise; +function copyDir(src: string, dest: string, mode?: number): Promise; /** - * 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. + * Copy directory. * - * @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. + * @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 - * @crossplatform - * @atomicservice - * @since 11 + * @since 20 */ -declare function read(fd: number, buffer: ArrayBuffer, callback: AsyncCallback): void; +function copyDir(src: string, dest: string, callback: AsyncCallback): void; /** - * Read file. + * Copy directory. * - * @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 + * @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 9 + * @since 20 */ +function copyDir(src: string, dest: string, callback: AsyncCallback>): void; + /** - * Read file. + * Copy directory. * - * @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. + * @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 - * @crossplatform - * @since 10 + * @since 20 */ +function copyDir(src: string, dest: string, mode: number, callback: AsyncCallback): void; + /** - * Read file. + * Copy directory. * - * @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 + * @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 - * @crossplatform - * @atomicservice - * @since 11 + * @since 20 */ -declare function read( - fd: number, - buffer: ArrayBuffer, - options: ReadOptions, - callback: AsyncCallback -): void; +function copyDir(src: string, dest: string, mode: number, callback: AsyncCallback>): void; /** - * 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. + * 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 9 + * @since 20 */ +function copyDirSync(src: string, dest: string, mode?: number): void; + /** - * Read file with sync interface. + * Copy file. * - * @param { number } fd - file descriptor. - * @param { ArrayBuffer } buffer - buffer. - * @param { object } [options] - options. - * @returns { number } Returns the number of file bytes read to buffer. + * @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 - * @since 10 + * @atomicservice + * @since 20 */ +function copyFile(src: string | number, dest: string | number, mode?: number): Promise; + /** - * Read file with sync interface. + * Copy file. * - * @param { number } fd - file descriptor. - * @param { ArrayBuffer } buffer - buffer. - * @param { ReadOptions } [options] - options. - * @returns { number } Returns the number of file bytes read to buffer. + * @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 + * @since 20 */ +function copyFile(src: string | number, dest: string | number, callback: AsyncCallback): void; + /** - * Read file with sync interface. + * Copy file. * - * @param { number } fd - file descriptor. - * @param { ArrayBuffer } buffer - buffer. - * @param { ReadOptions } [options] - options. - * @returns { number } Returns the number of file bytes read to buffer. + * @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 - * @throws { BusinessError } 13900044 - Network is unreachable * @syscap SystemCapability.FileManagement.File.FileIO * @crossplatform * @atomicservice - * @since 12 + * @since 20 */ -declare function readSync( - fd: number, - buffer: ArrayBuffer, - options?: ReadOptions -): number; +function copyFile( + src: string | number, + dest: string | number, + mode: number, + callback: AsyncCallback +): void; /** - * Read content line by line. + * Copy file with sync interface. * - * @param { string } filePath - file path. - * @param { Options } [options] - optional parameters - * @returns { Promise } Returns the iterator object in promise mode. + * @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 } 13900015 - File exists + * @throws { BusinessError } 13900013 - Bad address + * @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 } 13900025 - No space left on device - * @throws { BusinessError } 13900027 - Read-only file system * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900031 - Function not implemented * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900041 - Quota exceeded + * @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 11 + * @crossplatform + * @atomicservice + * @since 20 */ +function copyFileSync(src: string | number, dest: string | number, mode?: number): void; + /** - * Read content line by line. + * Create class Stream. * - * @param { string } filePath - file path. - * @param { Options } [options] - optional parameters - * @returns { Promise } Returns the iterator object in promise mode. + * @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 + * @since 20 */ -declare function readLines(filePath: string, options?: Options): Promise; +function createStream(path: string, mode: string): Promise; /** - * Read content line by line. + * Create class Stream. * - * @param { string } filePath - file path. - * @param { AsyncCallback } callback - The callback is used to return the iterator object. + * @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 11 + * @since 20 */ -declare function readLines(filePath: string, callback: AsyncCallback): void; +function createStream(path: string, mode: string, callback: AsyncCallback): void; /** - * Read content line by line. + * Create class Stream with sync interface. * - * @param { string } filePath - file path. - * @param { Options } options - optional parameters - * @param { AsyncCallback } callback - The callback is used to return the iterator object. + * @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 11 + * @since 20 */ -declare function readLines(filePath: string, options: Options, callback: AsyncCallback): void; +function createStreamSync(path: string, mode: string): Stream; /** - * Read content line by line with sync interface. + * Create class RandomAccessFile. * - * @param { string } filePath - file path. - * @param { Options } [options] - optional parameters - * @returns { ReaderIterator } Returns the iterator object. + * @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 11 + * @since 20 */ +function createRandomAccessFile(file: string | File, mode?: number, + options?: RandomAccessFileOptions): Promise; + /** - * Read content line by line with sync interface. + * Create class RandomAccessFile. * - * @param { string } filePath - file path. - * @param { Options } [options] - optional parameters - * @returns { ReaderIterator } Returns the iterator object. + * @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 - * @throws { BusinessError } 13900044 - Network is unreachable * @syscap SystemCapability.FileManagement.File.FileIO - * @since 12 + * @since 20 */ -declare function readLinesSync(filePath: string, options?: Options): ReaderIterator; +function createRandomAccessFile(file: string | File, callback: AsyncCallback): void; /** - * Read text. + * Create class RandomAccessFile. * - * @param { string } filePath - file path. - * @param { object } [options] - options. - * @returns { Promise } Returns the contents of the read file in promise mode. + * @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 } 13900005 - I/O error + * @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 + * @since 20 */ +function createRandomAccessFile(file: string | File, mode: number, callback: AsyncCallback): void; + /** - * Read text. + * Create class RandomAccessFile with sync interface. * - * @param { string } filePath - file path. - * @param { object } [options] - options. - * @returns { Promise } Returns the contents of the read file in promise mode. + * @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 } 13900005 - I/O error + * @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 + * @throws { BusinessError } 13900044 - Network is unreachable * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @since 10 + * @since 20 */ +function createRandomAccessFileSync(file: string | File, mode?: number, + options?: RandomAccessFileOptions): RandomAccessFile; + /** - * Read text. + * Create file read stream. * - * @param { string } filePath - file path. - * @param { ReadTextOptions } [options] - options. - * @returns { Promise } Returns the contents of the read file in promise mode. + * @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 } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900010 - Try again - * @throws { BusinessError } 13900013 - Bad address + * @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 } 13900025 - No space left on device - * @throws { BusinessError } 13900034 - Operation would block + * @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 - * @crossplatform - * @atomicservice - * @since 11 + * @since 20 */ +function createReadStream(path: string, options?: ReadStreamOptions): ReadStream; + /** - * Read text. + * Create file write stream. * - * @param { string } filePath - file path. - * @param { ReadTextOptions } [options] - options. - * @returns { Promise } Returns the contents of the read file in promise mode. + * @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 } 13900005 - I/O error - * @throws { BusinessError } 13900008 - Bad file descriptor - * @throws { BusinessError } 13900010 - Try again - * @throws { BusinessError } 13900013 - Bad address + * @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 } 13900034 - Operation would block + * @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 - * @throws { BusinessError } 13900044 - Network is unreachable * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice - * @since 12 + * @since 20 */ -declare function readText( - filePath: string, - options?: ReadTextOptions -): Promise; +function createWriteStream(path: string, options?: WriteStreamOptions): WriteStream; /** - * Read text. + * Create watcher to listen for file changes. * - * @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 + * @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 } 13900010 - Try again + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900018 - Not a directory * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900021 - File table overflow + * @throws { BusinessError } 13900022 - Too many open files * @throws { BusinessError } 13900025 - No space left on device - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900030 - File name too long * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 + * @since 20 */ +function createWatcher(path: string, events: number, listener: WatchEventListener): Watcher; + /** - * Read text. + * Duplicate fd to File Object. * - * @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 + * @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 } 13900010 - Try again - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900014 - Device or resource busy * @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 } 13900022 - Too many open files * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @since 10 + * @since 20 */ +function dup(fd: number): File; + /** - * Read text. + * Synchronize file metadata. * - * @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 + * @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 } 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 } 13900027 - Read-only file system * @throws { BusinessError } 13900041 - Quota exceeded * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO * @crossplatform - * @atomicservice - * @since 11 + * @since 20 */ -declare function readText(filePath: string, callback: AsyncCallback): void; +function fdatasync(fd: number): Promise; /** - * Read text. + * Synchronize file metadata. * - * @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 + * @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 } 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 } 13900027 - Read-only file system * @throws { BusinessError } 13900041 - Quota exceeded * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 + * @crossplatform + * @since 20 */ +function fdatasync(fd: number, callback: AsyncCallback): void; + /** - * Read text. + * Synchronize file metadata with sync interface. * - * @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 + * @param { number } fd - fd. * @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 } 13900027 - Read-only file system * @throws { BusinessError } 13900041 - Quota exceeded * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO * @crossplatform - * @since 10 + * @since 20 */ +function fdatasyncSync(fd: number): void; + /** - * Read text. + * Create class Stream by using fd. * - * @param { string } filePath - file path. - * @param { ReadTextOptions } [options] - options. - * @param { AsyncCallback } callback - The callback is used to return the contents of the read file. + * @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 } 13900005 - I/O error + * @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 - * @crossplatform - * @atomicservice - * @since 11 + * @since 20 */ -declare function readText( - filePath: string, - options: ReadTextOptions, - callback: AsyncCallback -): void; +function fdopenStream(fd: number, mode: string): Promise; /** - * Read text with sync interface. + * Create class Stream by using fd. * - * @param { string } filePath - file path. - * @param { object } [options] - options. - * @returns { string } Returns the contents of the read file. + * @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 } 13900005 - I/O error + * @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 + * @since 20 */ +function fdopenStream(fd: number, mode: string, callback: AsyncCallback): void; + /** - * Read text with sync interface. + * Create class Stream by using fd with sync interface. * - * @param { string } filePath - file path. - * @param { object } [options] - options. - * @returns { string } Returns the contents of the read file. + * @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 } 13900005 - I/O error + * @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 - * @crossplatform - * @since 10 + * @since 20 */ +function fdopenStreamSync(fd: number, mode: string): Stream; + /** - * Read text with sync interface. + * Synchronize file. * - * @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 + * @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 } 13900010 - Try again - * @throws { BusinessError } 13900013 - Bad address - * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900008 - Bad file descriptor * @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 } 13900027 - Read-only file system * @throws { BusinessError } 13900041 - Quota exceeded * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO * @crossplatform - * @atomicservice - * @since 11 + * @since 20 */ +function fsync(fd: number): Promise; + /** - * Read text with sync interface. + * Synchronize file. * - * @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 + * @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 } 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 } 13900027 - Read-only file system * @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 + * @since 20 */ -declare function readTextSync( - filePath: string, - options?: ReadTextOptions -): string; +function fsync(fd: number, callback: AsyncCallback): void; /** - * Rename file. + * Synchronize file with sync interface. * - * @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 + * @param { number } fd - fd. + * @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 } 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 + * @crossplatform + * @since 20 */ +function fsyncSync(fd: number): void; + /** - * Rename file. + * List file. * - * @param { string } oldPath - oldPath. - * @param { string } newPath - newPath. - * @returns { Promise } The promise returned by the function. - * @throws { BusinessError } 13900001 - Operation not permitted + * @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 } 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 + * @atomicservice + * @since 20 */ +function listFile( + path: string, + options?: ListFileOptions +): Promise; + /** - * Rename file. + * List file. * - * @param { string } oldPath - oldPath. - * @param { string } newPath - newPath. - * @returns { Promise } The promise returned by the function. - * @throws { BusinessError } 13900001 - Operation not permitted + * @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 } 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 + * @since 20 */ -declare function rename(oldPath: string, newPath: string): Promise; +function listFile(path: string, callback: AsyncCallback): void; /** - * Rename file. + * List file. * - * @param { string } oldPath - oldPath. - * @param { string } newPath - newPath. - * @param { AsyncCallback } callback - Returns the callback function. - * @throws { BusinessError } 13900001 - Operation not permitted + * @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 } 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 + * @crossplatform + * @atomicservice + * @since 20 */ +function listFile( + path: string, + options: ListFileOptions, + callback: AsyncCallback +): void; + /** - * Rename file. + * List file with sync interface. * - * @param { string } oldPath - oldPath. - * @param { string } newPath - newPath. - * @param { AsyncCallback } callback - Returns the callback function. - * @throws { BusinessError } 13900001 - Operation not permitted + * @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 } 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 + * @atomicservice + * @since 20 */ +function listFileSync( + path: string, + options?: ListFileOptions +): string[]; + /** - * Rename file. + * Reposition file offset. * - * @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 + * @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 } 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 } 13900026 - Illegal seek + * @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 20 */ -declare function rename(oldPath: string, newPath: string, callback: AsyncCallback): void; +function lseek(fd: number, offset: number, whence?: WhenceType): number; /** - * Rename file with sync interface. + * Stat link file. * - * @param { string } oldPath - oldPath. - * @param { string } newPath - newPath. - * @throws { BusinessError } 13900001 - Operation not permitted + * @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 } 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 } 13900030 - File name too long * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900038 - Value too large for defined data type * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 + * @since 20 */ +function lstat(path: string): Promise; + /** - * Rename file with sync interface. + * Stat link file. * - * @param { string } oldPath - oldPath. - * @param { string } newPath - newPath. - * @throws { BusinessError } 13900001 - Operation not permitted + * @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 } 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 } 13900030 - File name too long * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900038 - Value too large for defined data type * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @since 10 + * @since 20 */ +function lstat(path: string, callback: AsyncCallback): void; + /** - * Rename file with sync interface. + * Stat link file with sync interface. * - * @param { string } oldPath - oldPath. - * @param { string } newPath - newPath. - * @throws { BusinessError } 13900001 - Operation not permitted + * @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 } 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 } 13900030 - File name too long * @throws { BusinessError } 13900033 - Too many symbolic links encountered - * @throws { BusinessError } 13900041 - Quota exceeded + * @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 20 */ -declare function renameSync(oldPath: string, newPath: string): void; +function lstatSync(path: string): Stat; /** - * Delete dir. + * 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 } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists * @throws { BusinessError } 13900018 - Not a directory * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900027 - Read-only file system1 + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900028 - Too many links * @throws { BusinessError } 13900030 - File name too long - * @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 + * @crossplatform + * @atomicservice + * @since 20 */ +function mkdir(path: string): Promise; + /** - * Delete dir. + * 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 } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists * @throws { BusinessError } 13900018 - Not a directory * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900027 - Read-only file system1 + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900028 - Too many links * @throws { BusinessError } 13900030 - File name too long - * @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 + * @atomicservice + * @since 20 */ +function mkdir(path: string, recursion: boolean): Promise; + /** - * Delete dir. + * Make dir. * * @param { string } path - path. - * @returns { Promise } The promise returned by the function. + * @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 } 13900018 - Not a directory * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900027 - Read-only file system1 + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900028 - Too many links * @throws { BusinessError } 13900030 - File name too long - * @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 + * @since 20 */ -declare function rmdir(path: string): Promise; +function mkdir(path: string, callback: AsyncCallback): void; /** - * Delete dir. + * 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 } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists * @throws { BusinessError } 13900018 - Not a directory * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900027 - Read-only file system1 + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900028 - Too many links * @throws { BusinessError } 13900030 - File name too long - * @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 + * @atomicservice + * @since 20 */ +function mkdir(path: string, recursion: boolean, callback: AsyncCallback): void; + /** - * Delete dir. + * Make dir with sync interface. * * @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 } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists * @throws { BusinessError } 13900018 - Not a directory * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900027 - Read-only file system1 + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900028 - Too many links * @throws { BusinessError } 13900030 - File name too long - * @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 + * @atomicservice + * @since 20 */ +function mkdirSync(path: string): void; + /** - * Delete dir. + * Make dir with sync interface. * * @param { string } path - path. - * @param { AsyncCallback } callback - Return the callback function. + * @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 } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists * @throws { BusinessError } 13900018 - Not a directory * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900027 - Read-only file system1 + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900028 - Too many links * @throws { BusinessError } 13900030 - File name too long - * @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 + * @since 20 */ -declare function rmdir(path: string, callback: AsyncCallback): void; +function mkdirSync(path: string, recursion: boolean): void; /** - * Delete dir with sync interface. + * Make temp dir. * - * @param { string } path - path. + * @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 } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists * @throws { BusinessError } 13900018 - Not a directory * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900027 - Read-only file system1 + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900028 - Too many links * @throws { BusinessError } 13900030 - File name too long - * @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 + * @crossplatform + * @since 20 */ +function mkdtemp(prefix: string): Promise; + /** - * Delete dir with sync interface. + * Make temp dir. * - * @param { string } path - path. + * @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 } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists * @throws { BusinessError } 13900018 - Not a directory * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900027 - Read-only file system1 + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900028 - Too many links * @throws { BusinessError } 13900030 - File name too long - * @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 + * @since 20 */ +function mkdtemp(prefix: string, callback: AsyncCallback): void; + /** - * Delete dir with sync interface. + * Make temp dir with sync interface. * - * @param { string } path - path. + * @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 } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists * @throws { BusinessError } 13900018 - Not a directory * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900027 - Read-only file system1 + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900028 - Too many links * @throws { BusinessError } 13900030 - File name too long - * @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 + * @since 20 */ -declare function rmdirSync(path: string): void; +function mkdtempSync(prefix: string): string; /** - * Get file information. + * Move directory. * - * @param { string | number } file - path or file descriptor. - * @returns { Promise } Returns the Stat object in promise mode. + * @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 } 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 } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900016 - Cross-device link * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900031 - Function not implemented + * @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 } 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 + * @since 20 */ +function moveDir(src: string, dest: string, mode?: number): Promise; + /** - * Get file information. + * Move directory. * - * @param { string | number } file - path or file descriptor. - * @returns { Promise } Returns the Stat object in promise mode. + * @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 } 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 } 13900014 - Device or resource busy + * @throws { BusinessError } 13900016 - Cross-device link * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900031 - Function not implemented + * @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 } 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 + * @since 20 */ +function moveDir(src: string, dest: string, callback: AsyncCallback): void; + /** - * Get file information. + * Move directory. * - * @param { string | number } file - path or file descriptor. - * @returns { Promise } Returns the Stat object in promise mode. + * @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 20 + */ +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 } 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 } 13900014 - Device or resource busy + * @throws { BusinessError } 13900016 - Cross-device link * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900031 - Function not implemented + * @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 } 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 + * @since 20 */ -declare function stat(file: string | number): Promise; +function moveDir(src: string, dest: string, mode: number, callback: AsyncCallback): void; /** - * Get file information. + * Move directory. * - * @param { string | number } file - path or file descriptor. - * @param { AsyncCallback } callback - The callback is used to return the Stat object. + * @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 20 + */ +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 } 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 } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900016 - Cross-device link * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900031 - Function not implemented + * @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 } 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 + * @since 20 */ +function moveDirSync(src: string, dest: string, mode?: number): void; + /** - * Get file information. + * Move file. * - * @param { string | number } file - path or file descriptor. - * @param { AsyncCallback } callback - The callback is used to return the Stat object. + * @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 } 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 } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900016 - Cross-device link * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900031 - Function not implemented + * @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 } 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 + * @since 20 */ +function moveFile(src: string, dest: string, mode?: number): Promise; + /** - * Get file information. + * Move file. * - * @param { string | number } file - path or file descriptor. - * @param { AsyncCallback } callback - The callback is used to return the Stat object. + * @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 } 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 } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900016 - Cross-device link * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900031 - Function not implemented + * @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 } 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 + * @since 20 */ -declare function stat(file: string | number, callback: AsyncCallback): void; +function moveFile(src: string, dest: string, callback: AsyncCallback): void; /** - * Get file information with sync interface. + * Move file. * - * @param { string | number } file - path or file descriptor. - * @returns { Stat } Returns the Stat object. + * @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 } 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 } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900016 - Cross-device link * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900031 - Function not implemented + * @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 } 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 + * @crossplatform + * @since 20 */ +function moveFile(src: string, dest: string, mode: number, callback: AsyncCallback): void; + /** - * Get file information with sync interface. + * Move file with sync interface. * - * @param { string | number } file - path or file descriptor. - * @returns { Stat } Returns the Stat object. + * @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 } 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 } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900016 - Cross-device link * @throws { BusinessError } 13900018 - Not a directory - * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900031 - Function not implemented + * @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 } 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 + * @since 20 */ +function moveFileSync(src: string, dest: string, mode?: number): void; + /** - * Get file information with sync interface. + * Open file. * - * @param { string | number } file - path or file descriptor. - * @returns { Stat } Returns the Stat object. + * @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 } 13900005 - I/O error + * @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 } 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 } 13900041 - Quota exceeded * @throws { BusinessError } 13900042 - Unknown error + * @throws { BusinessError } 13900044 - Network is unreachable * @syscap SystemCapability.FileManagement.File.FileIO * @crossplatform * @atomicservice - * @since 11 + * @since 20 */ -declare function statSync(file: string | number): Stat; +function open(path: string, mode?: number): Promise; /** - * Link file. + * Open file. * - * @param { string } target - target. - * @param { string } srcPath - srcPath. - * @returns { Promise } The promise returned by the function. + * @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 } 13900005 - I/O error + * @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 + * @crossplatform + * @atomicservice + * @since 20 */ -declare function symlink(target: string, srcPath: string): Promise; +function open(path: string, callback: AsyncCallback): void; /** - * Link file. + * Open file. * - * @param { string } target - target. - * @param { string } srcPath - srcPath. - * @param { AsyncCallback } callback - Return the callback function. + * @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 } 13900005 - I/O error + * @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 + * @crossplatform + * @atomicservice + * @since 20 */ -declare function symlink(target: string, srcPath: string, callback: AsyncCallback): void; +function open(path: string, mode: number, callback: AsyncCallback): void; /** - * Link file with sync interface. + * Open file with sync interface. * - * @param { string } target - target. - * @param { string } srcPath - srcPath. + * @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 } 13900005 - I/O error + * @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 9 + * @crossplatform + * @atomicservice + * @since 20 */ -declare function symlinkSync(target: string, srcPath: string): void; +function openSync(path: string, mode?: number): File; /** - * Truncate file. + * Read 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 + * @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 } 13900012 - Permission denied + * @throws { BusinessError } 13900010 - Try again * @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 } 13900034 - Operation would block * @throws { BusinessError } 13900042 - Unknown error + * @throws { BusinessError } 13900044 - Network is unreachable * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 + * @crossplatform + * @atomicservice + * @since 20 */ +function read( + fd: number, + buffer: ArrayBuffer, + options?: ReadOptions +): Promise; + /** - * Truncate file. + * Read 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 + * @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 } 13900012 - Permission denied + * @throws { BusinessError } 13900010 - Try again * @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 } 13900034 - Operation would block * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO * @crossplatform - * @since 10 + * @atomicservice + * @since 20 */ +function read(fd: number, buffer: ArrayBuffer, callback: AsyncCallback): void; + /** - * Truncate file. + * Read 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 + * @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 20 + */ +function read( + fd: number, + buffer: ArrayBuffer, + options: ReadOptions, + callback: AsyncCallback +): void; + +/** + * 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 } 13900012 - Permission denied + * @throws { BusinessError } 13900010 - Try again * @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 } 13900034 - Operation would block * @throws { BusinessError } 13900042 - Unknown error + * @throws { BusinessError } 13900044 - Network is unreachable * @syscap SystemCapability.FileManagement.File.FileIO * @crossplatform * @atomicservice - * @since 11 + * @since 20 */ -declare function truncate(file: string | number, len?: number): Promise; +function readSync( + fd: number, + buffer: ArrayBuffer, + options?: ReadOptions +): number; /** - * Truncate file. + * Read content line by line. * - * @param { string | number } file - path or file descriptor. - * @param { AsyncCallback } callback - Return the callback function. - * @throws { BusinessError } 13900001 - Operation not permitted + * @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 } 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 } 13900015 - File exists * @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 } 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 9 + * @since 20 */ +function readLines(filePath: string, options?: Options): Promise; + /** - * Truncate file. + * Read content line by line. * - * @param { string | number } file - path or file descriptor. - * @param { AsyncCallback } callback - Return the callback function. - * @throws { BusinessError } 13900001 - Operation not permitted + * @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 } 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 } 13900015 - File exists * @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 } 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 - * @crossplatform - * @since 10 + * @since 20 */ +function readLines(filePath: string, callback: AsyncCallback): void; + /** - * Truncate file. + * Read content line by line. * - * @param { string | number } file - path or file descriptor. - * @param { AsyncCallback } callback - Return the callback function. - * @throws { BusinessError } 13900001 - Operation not permitted + * @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 } 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 } 13900015 - File exists * @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 } 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 - * @crossplatform - * @atomicservice - * @since 11 + * @since 20 */ -declare function truncate(file: string | number, callback: AsyncCallback): void; +function readLines(filePath: string, options: Options, callback: AsyncCallback): void; /** - * Truncate file. + * Read content line by line with sync interface. * - * @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 + * @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 } 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 } 13900015 - File exists * @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 } 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 9 + * @since 20 */ +function readLinesSync(filePath: string, options?: Options): ReaderIterator; + /** - * Truncate file. + * Read text. * - * @param { string | number } file - path or file descriptor. - * @param { number } [len = 0] - len. - * @param { AsyncCallback } callback - Return the callback function. + * @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 } 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 } 13900010 - Try again * @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 } 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 - * @since 10 + * @atomicservice + * @since 20 */ +function readText( + filePath: string, + options?: ReadTextOptions +): Promise; + /** - * Truncate file. + * Read text. * - * @param { string | number } file - path or file descriptor. - * @param { number } [len = 0] - len. - * @param { AsyncCallback } callback - Return the callback function. + * @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 } 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 } 13900010 - Try again * @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 } 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 + * @since 20 */ -declare function truncate(file: string | number, len: number, callback: AsyncCallback): void; +function readText(filePath: string, callback: AsyncCallback): void; /** - * Truncate file with sync interface. + * Read text. * - * @param { string | number } file - path or file descriptor. - * @param { number } [len = 0] - len. + * @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 } 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 } 13900010 - Try again * @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 } 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 20 */ +function readText( + filePath: string, + options: ReadTextOptions, + callback: AsyncCallback +): void; + /** - * Truncate file with sync interface. + * Read text with sync interface. * - * @param { string | number } file - path or file descriptor. - * @param { number } [len = 0] - len. + * @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 } 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 } 13900010 - Try again * @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 } 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 - * @since 10 + * @atomicservice + * @since 20 */ +function readTextSync( + filePath: string, + options?: ReadTextOptions +): string; + /** - * Truncate file with sync interface. + * Rename file. * - * @param { string | number } file - path or file descriptor. - * @param { number } [len = 0] - len. + * @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 } 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 } 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 } 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 } 13900030 - File name too long + * @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 + * @since 20 */ -declare function truncateSync(file: string | number, len?: number): void; +function rename(oldPath: string, newPath: string): Promise; /** - * Delete file. + * Rename file. * - * @param { string } path - path. - * @returns { Promise } The promise returned by the function. + * @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 } 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 } 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 } 13900030 - File name too long + * @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 + * @crossplatform + * @atomicservice + * @since 20 */ +function rename(oldPath: string, newPath: string, callback: AsyncCallback): void; + /** - * Delete file. + * Rename file with sync interface. * - * @param { string } path - path. - * @returns { Promise } The promise returned by the function. + * @param { string } oldPath - oldPath. + * @param { string } newPath - newPath. * @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 } 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 } 13900030 - File name too long + * @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 + * @atomicservice + * @since 20 */ +function renameSync(oldPath: string, newPath: string): void; + /** - * Delete file. + * 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 } 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 } 13900027 - Read-only file system1 * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900032 - Directory not empty * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO * @crossplatform * @atomicservice - * @since 11 + * @since 20 */ -declare function unlink(path: string): Promise; +function rmdir(path: string): Promise; /** - * Delete file. + * 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 } 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 } 13900027 - Read-only file system1 * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900032 - Directory not empty * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 + * @crossplatform + * @atomicservice + * @since 20 */ +function rmdir(path: string, callback: AsyncCallback): void; + /** - * Delete file. + * Delete dir with sync interface. * * @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 } 13900027 - Read-only file system1 * @throws { BusinessError } 13900030 - File name too long - * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900032 - Directory not empty * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO * @crossplatform - * @since 10 + * @atomicservice + * @since 20 */ +function rmdirSync(path: string): void; + /** - * Delete file. + * Get file information. * - * @param { string } path - path. - * @param { AsyncCallback } callback - Return the callback function. - * @throws { BusinessError } 13900001 - Operation not permitted + * @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 } 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 } 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 20 */ -declare function unlink(path: string, callback: AsyncCallback): void; +function stat(file: string | number): Promise; /** - * Delete file with sync interface. + * Get file information. * - * @param { string } path - path. - * @throws { BusinessError } 13900001 - Operation not permitted + * @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 } 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 } 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 + * @crossplatform + * @atomicservice + * @since 20 */ +function stat(file: string | number, callback: AsyncCallback): void; + /** - * Delete file with sync interface. + * Get file information with sync interface. * - * @param { string } path - path. - * @throws { BusinessError } 13900001 - Operation not permitted + * @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 } 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 } 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 20 */ +function statSync(file: string | number): Stat; + /** - * Delete file with sync interface. + * Link file. * - * @param { string } path - path. + * @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 @@ -6041,247 +2679,285 @@ declare function unlink(path: string, callback: AsyncCallback): void; * @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 } 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 } 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 + * @since 20 */ -declare function unlinkSync(path: string): void; +function symlink(target: string, srcPath: string): Promise; /** - * Change file mtime. + * Link file. * - * @param { string } path - path. - * @param { number } mtime - last modification time + * @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 } 13900020 - Invalid argument + * @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 11 + * @since 20 */ +function symlink(target: string, srcPath: string, callback: AsyncCallback): void; + /** - * Change file mtime. + * Link file with sync interface. * - * @param { string } path - path. - * @param { number } mtime - last modification time + * @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 } 13900020 - Invalid argument + * @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 12 + * @since 20 */ -declare function utimes(path: string, mtime: number): void; +function symlinkSync(target: string, srcPath: string): void; /** - * Write file. + * Truncate 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. + * @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 } 13900010 - Try again + * @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 } 13900025 - No space left on device - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900041 - Quota exceeded + * @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 + * @crossplatform + * @atomicservice + * @since 20 */ +function truncate(file: string | number, len?: number): Promise; + /** - * Write file. + * Truncate 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. + * @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 } 13900010 - Try again + * @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 } 13900025 - No space left on device - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900041 - Quota exceeded + * @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 20 */ +function truncate(file: string | number, callback: AsyncCallback): void; + /** - * Write file. + * Truncate 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. + * @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 } 13900010 - Try again + * @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 } 13900025 - No space left on device - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900041 - Quota exceeded + * @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 20 */ -declare function write( - fd: number, - buffer: ArrayBuffer | string, - options?: WriteOptions -): Promise; +function truncate(file: string | number, len: number, callback: AsyncCallback): void; /** - * Write file. + * Truncate file with sync interface. * - * @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. + * @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 } 13900010 - Try again + * @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 } 13900025 - No space left on device - * @throws { BusinessError } 13900034 - Operation would block - * @throws { BusinessError } 13900041 - Quota exceeded + * @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 + * @crossplatform + * @atomicservice + * @since 20 */ +function truncateSync(file: string | number, len?: number): void; + /** - * Write file. + * Delete 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. + * @param { string } path - path. + * @returns { Promise } The promise returned by the function. * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900002 - No such file or directory * @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 } 13900014 - Device or resource busy + * @throws { BusinessError } 13900018 - Not a directory + * @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 } 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 20 */ +function unlink(path: string): Promise; + /** - * Write file. + * Delete 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. + * @param { string } path - path. + * @param { AsyncCallback } callback - Return the callback function. * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900002 - No such file or directory * @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 } 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 } 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 20 */ -declare function write(fd: number, buffer: ArrayBuffer | string, callback: AsyncCallback): void; +function unlink(path: string, callback: AsyncCallback): void; /** - * Write file. + * Delete file with sync interface. * - * @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. + * @param { string } path - path. * @throws { BusinessError } 13900001 - Operation not permitted - * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900002 - No such file or directory * @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 } 13900014 - Device or resource busy + * @throws { BusinessError } 13900018 - Not a directory + * @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 } 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 + * @crossplatform + * @atomicservice + * @since 20 */ +function unlinkSync(path: string): void; + /** - * Write file. + * Change file mtime. * - * @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. + * @param { string } path - path. + * @param { number } mtime - last modification time * @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 } 13900002 - No such file or directory + * @throws { BusinessError } 13900012 - Permission denied * @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 } 13900027 - Read-only file system * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO * @crossplatform - * @since 10 + * @since 20 */ +function utimes(path: string, mtime: number): void; + /** * 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. + * @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 @@ -6297,22 +2973,20 @@ declare function write(fd: number, buffer: ArrayBuffer | string, callback: Async * @syscap SystemCapability.FileManagement.File.FileIO * @crossplatform * @atomicservice - * @since 11 + * @since 20 */ -declare function write( +function write( fd: number, buffer: ArrayBuffer | string, - options: WriteOptions, - callback: AsyncCallback -): void; + options?: WriteOptions +): Promise; /** - * Write file with sync interface. + * Write file. * * @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. + * @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 @@ -6326,15 +3000,19 @@ declare function write( * @throws { BusinessError } 13900041 - Quota exceeded * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 + * @crossplatform + * @atomicservice + * @since 20 */ +function write(fd: number, buffer: ArrayBuffer | string, callback: AsyncCallback): void; + /** - * Write file with sync interface. + * Write file. * * @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. + * @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 @@ -6349,8 +3027,16 @@ declare function write( * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO * @crossplatform - * @since 10 + * @atomicservice + * @since 20 */ +function write( + fd: number, + buffer: ArrayBuffer | string, + options: WriteOptions, + callback: AsyncCallback +): void; + /** * Write file with sync interface. * @@ -6373,9 +3059,9 @@ declare function write( * @syscap SystemCapability.FileManagement.File.FileIO * @crossplatform * @atomicservice - * @since 11 + * @since 20 */ -declare function writeSync( +function writeSync( fd: number, buffer: ArrayBuffer | string, options?: WriteOptions @@ -6394,9 +3080,9 @@ declare function writeSync( * @throws { BusinessError } 13900045 - Connection failed. * @throws { BusinessError } 13900046 - Software caused connection abort. * @syscap SystemCapability.FileManagement.File.FileIO - * @since 12 + * @since 20 */ -declare function connectDfs(networkId: string, listeners: DfsListeners): Promise; +function connectDfs(networkId: string, listeners: DfsListeners): Promise; /** * Disconnect Distributed File System. @@ -6409,9 +3095,9 @@ declare function connectDfs(networkId: string, listeners: DfsListeners): Promise *
2.Incorrect parameter types. * @throws { BusinessError } 13600004 - Unmount failed. * @syscap SystemCapability.FileManagement.File.FileIO - * @since 12 + * @since 20 */ -declare function disconnectDfs(networkId: string): Promise; +function disconnectDfs(networkId: string): Promise; /** * Set extended attributes information of the file. @@ -6432,9 +3118,9 @@ declare function disconnectDfs(networkId: string): Promise; * @throws { BusinessError } 13900041 - Quota exceeded * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 12 + * @since 20 */ -declare function setxattr(path: string, key: string, value: string): Promise; +function setxattr(path: string, key: string, value: string): Promise; /** * Set extended attributes information of the file. @@ -6454,10 +3140,10 @@ declare function setxattr(path: string, key: string, value: string): Promise; +function getxattr(path: string, key: string): Promise; /** * Get extended attributes information of the file with sync interface. @@ -6495,23 +3181,23 @@ declare function getxattr(path: string, key: string): Promise; * @throws { BusinessError } 13900038 - Value too large for defined data type * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 12 + * @since 20 */ -declare function getxattrSync(path: string, key: string): string; +function getxattrSync(path: string, key: string): string; /** * Progress data of copyFile * * @typedef Progress * @syscap SystemCapability.FileManagement.File.FileIO - * @since 11 + * @since 20 */ interface Progress { /** * @type { number } * @readonly * @syscap SystemCapability.FileManagement.File.FileIO - * @since 11 + * @since 20 */ readonly processedSize: number; @@ -6519,7 +3205,7 @@ interface Progress { * @type { number } * @readonly * @syscap SystemCapability.FileManagement.File.FileIO - * @since 11 + * @since 20 */ readonly totalSize: number; } @@ -6528,9 +3214,9 @@ interface Progress { * Task signal. * * @syscap SystemCapability.FileManagement.File.FileIO - * @since 12 + * @since 20 */ -declare class TaskSignal { +class TaskSignal { /** * Cancel the copy task in progress. * @@ -6538,7 +3224,7 @@ declare class TaskSignal { * @throws { BusinessError } 13900012 - Permission denied by the file system * @throws { BusinessError } 13900043 - No task can be canceled. * @syscap SystemCapability.FileManagement.File.FileIO - * @since 12 + * @since 20 */ cancel(): void; @@ -6550,7 +3236,7 @@ declare class TaskSignal { * @throws { BusinessError } 13900008 - Bad file descriptor * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 12 + * @since 20 */ onCancel(): Promise; } @@ -6560,7 +3246,7 @@ declare class TaskSignal { * * @typedef CopyOptions * @syscap SystemCapability.FileManagement.File.FileIO - * @since 11 + * @since 20 */ interface CopyOptions { /** @@ -6568,7 +3254,7 @@ interface CopyOptions { * * @type { ?ProgressListener } * @syscap SystemCapability.FileManagement.File.FileIO - * @since 11 + * @since 20 */ progressListener?: ProgressListener; /** @@ -6576,7 +3262,7 @@ interface CopyOptions { * * @type { ?TaskSignal } * @syscap SystemCapability.FileManagement.File.FileIO - * @since 12 + * @since 20 */ copySignal?: TaskSignal; } @@ -6587,25 +3273,10 @@ interface CopyOptions { * @typedef { function } ProgressListener * @param { Progress } progress - indicates the progress data of copyFile * @syscap SystemCapability.FileManagement.File.FileIO - * @since 11 + * @since 20 */ -type ProgressListener = (progress: Progress) => void; +export 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. * @@ -6613,29 +3284,17 @@ type ProgressListener = (progress: Progress) => void; * @syscap SystemCapability.FileManagement.File.FileIO * @crossplatform * @atomicservice - * @since 11 + * @since 20 */ -declare interface File { - /** - * @type { number } - * @readonly - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 - */ - /** - * @type { number } - * @readonly - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @since 10 - */ +interface File { + /** * @type { number } * @readonly * @syscap SystemCapability.FileManagement.File.FileIO * @crossplatform * @atomicservice - * @since 11 + * @since 20 */ readonly fd: number; @@ -6648,7 +3307,7 @@ declare interface File { * @throws { BusinessError } 13900042 - Unknown error * @throws { BusinessError } 14300002 - Invalid URI * @syscap SystemCapability.FileManagement.File.FileIO - * @since 10 + * @since 20 */ readonly path: string; @@ -6660,7 +3319,7 @@ declare interface File { * @throws { BusinessError } 13900005 - I/O error * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 10 + * @since 20 */ readonly name: string; @@ -6672,7 +3331,7 @@ declare interface File { * @throws { BusinessError } 13900042 - Unknown error * @throws { BusinessError } 14300002 - Invalid URI * @syscap SystemCapability.FileManagement.File.FileIO - * @since 11 + * @since 20 */ getParent(): string; @@ -6688,7 +3347,7 @@ declare interface File { * @throws { BusinessError } 13900042 - Unknown error * @throws { BusinessError } 13900043 - No record locks available * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 + * @since 20 */ lock(exclusive?: boolean): Promise; @@ -6703,7 +3362,7 @@ declare interface File { * @throws { BusinessError } 13900042 - Unknown error * @throws { BusinessError } 13900043 - No record locks available * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 + * @since 20 */ lock(callback: AsyncCallback): void; @@ -6719,7 +3378,7 @@ declare interface File { * @throws { BusinessError } 13900042 - Unknown error * @throws { BusinessError } 13900043 - No record locks available * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 + * @since 20 */ lock(exclusive: boolean, callback: AsyncCallback): void; @@ -6734,7 +3393,7 @@ declare interface File { * @throws { BusinessError } 13900042 - Unknown error * @throws { BusinessError } 13900043 - No record locks available * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 + * @since 20 */ tryLock(exclusive?: boolean): void; @@ -6748,7 +3407,7 @@ declare interface File { * @throws { BusinessError } 13900042 - Unknown error * @throws { BusinessError } 13900043 - No record locks available * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 + * @since 20 */ unlock(): void; } @@ -6758,9 +3417,9 @@ declare interface File { * * @interface RandomAccessFile * @syscap SystemCapability.FileManagement.File.FileIO - * @since 10 + * @since 20 */ -declare interface RandomAccessFile { +interface RandomAccessFile { /** * File descriptor @@ -6768,7 +3427,7 @@ declare interface RandomAccessFile { * @type { number } * @readonly * @syscap SystemCapability.FileManagement.File.FileIO - * @since 10 + * @since 20 */ readonly fd: number; @@ -6778,7 +3437,7 @@ declare interface RandomAccessFile { * @type { number } * @readonly * @syscap SystemCapability.FileManagement.File.FileIO - * @since 10 + * @since 20 */ readonly filePointer: number; @@ -6792,7 +3451,7 @@ declare interface RandomAccessFile { * @throws { BusinessError } 13900020 - Invalid argument * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 10 + * @since 20 */ setFilePointer(filePointer: number): void; @@ -6806,31 +3465,10 @@ declare interface RandomAccessFile { * @throws { BusinessError } 13900041 - Quota exceeded * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 10 + * @since 20 */ 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. * @@ -6850,7 +3488,7 @@ declare interface RandomAccessFile { * @throws { BusinessError } 13900041 - Quota exceeded * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 11 + * @since 20 */ write( buffer: ArrayBuffer | string, @@ -6875,31 +3513,10 @@ declare interface RandomAccessFile { * @throws { BusinessError } 13900041 - Quota exceeded * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 10 + * @since 20 */ 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. * @@ -6919,7 +3536,7 @@ declare interface RandomAccessFile { * @throws { BusinessError } 13900041 - Quota exceeded * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 11 + * @since 20 */ write( buffer: ArrayBuffer | string, @@ -6927,27 +3544,6 @@ declare interface RandomAccessFile { 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. * @@ -6967,49 +3563,13 @@ declare interface RandomAccessFile { * @throws { BusinessError } 13900041 - Quota exceeded * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 11 + * @since 20 */ 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. * @@ -7027,7 +3587,7 @@ declare interface RandomAccessFile { * @throws { BusinessError } 13900042 - Unknown error * @throws { BusinessError } 13900044 - Network is unreachable * @syscap SystemCapability.FileManagement.File.FileIO - * @since 12 + * @since 20 */ read( buffer: ArrayBuffer, @@ -7049,28 +3609,10 @@ declare interface RandomAccessFile { * @throws { BusinessError } 13900034 - Operation would block * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 10 + * @since 20 */ 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. * @@ -7087,7 +3629,7 @@ declare interface RandomAccessFile { * @throws { BusinessError } 13900034 - Operation would block * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 11 + * @since 20 */ read( buffer: ArrayBuffer, @@ -7095,42 +3637,6 @@ declare interface RandomAccessFile { 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. * @@ -7148,7 +3654,7 @@ declare interface RandomAccessFile { * @throws { BusinessError } 13900042 - Unknown error * @throws { BusinessError } 13900044 - Network is unreachable * @syscap SystemCapability.FileManagement.File.FileIO - * @since 12 + * @since 20 */ readSync( buffer: ArrayBuffer, @@ -7166,7 +3672,7 @@ declare interface RandomAccessFile { * @throws { BusinessError } 13900020 - Invalid argument * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 12 + * @since 20 */ getReadStream(): ReadStream; @@ -7181,7 +3687,7 @@ declare interface RandomAccessFile { * @throws { BusinessError } 13900020 - Invalid argument * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 12 + * @since 20 */ getWriteStream(): WriteStream; } @@ -7191,14 +3697,14 @@ declare interface RandomAccessFile { * * @extends stream.Readable * @syscap SystemCapability.FileManagement.File.FileIO - * @since 12 + * @since 20 */ -declare class ReadStream extends stream.Readable { +class ReadStream extends stream.Readable { /** * The ReadStream constructor. * * @syscap SystemCapability.FileManagement.File.FileIO - * @since 12 + * @since 20 */ constructor(); @@ -7209,7 +3715,7 @@ declare class ReadStream extends stream.Readable { * @readonly * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 12 + * @since 20 */ readonly bytesRead: number; @@ -7220,7 +3726,7 @@ declare class ReadStream extends stream.Readable { * @readonly * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 12 + * @since 20 */ readonly path: string; @@ -7235,7 +3741,7 @@ declare class ReadStream extends stream.Readable { * @throws { BusinessError } 13900026 - Illegal seek * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 12 + * @since 20 */ seek(offset: number, whence?: WhenceType): number; @@ -7249,7 +3755,7 @@ declare class ReadStream extends stream.Readable { * @throws { BusinessError } 13900041 - Quota exceeded * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 12 + * @since 20 */ close(): void; } @@ -7259,14 +3765,14 @@ declare class ReadStream extends stream.Readable { * * @extends stream.Writable * @syscap SystemCapability.FileManagement.File.FileIO - * @since 12 + * @since 20 */ -declare class WriteStream extends stream.Writable { +class WriteStream extends stream.Writable { /** * The WriteStream constructor. * * @syscap SystemCapability.FileManagement.File.FileIO - * @since 12 + * @since 20 */ constructor(); @@ -7277,7 +3783,7 @@ declare class WriteStream extends stream.Writable { * @readonly * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 12 + * @since 20 */ readonly bytesWritten: number; @@ -7288,7 +3794,7 @@ declare class WriteStream extends stream.Writable { * @readonly * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 12 + * @since 20 */ readonly path: string; @@ -7303,7 +3809,7 @@ declare class WriteStream extends stream.Writable { * @throws { BusinessError } 13900026 - Illegal seek * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 12 + * @since 20 */ seek(offset: number, whence?: WhenceType): number; @@ -7317,158 +3823,160 @@ declare class WriteStream extends stream.Writable { * @throws { BusinessError } 13900041 - Quota exceeded * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 12 + * @since 20 */ close(): 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 + * The AtomicFile class provides methods for performing atomic operations on files. * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice - * @since 11 + * @since 20 */ -declare interface Stat { +export class AtomicFile { /** - * @type { bigint } - * @readonly - * @throws { BusinessError } 13900005 - I/O error - * @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 9 + * @since 20 */ + constructor(path: string); + /** - * @type { bigint } - * @readonly - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900042 - Unknown error + * 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 - * @crossplatform - * @since 10 + * @since 20 */ - readonly ino: bigint; + getBaseFile(): File; + /** - * @type { number } - * @readonly - * @throws { BusinessError } 13900005 - I/O error - * @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 20 */ + openRead(): ReadStream; + /** - * @type { number } - * @readonly - * @throws { BusinessError } 13900005 - I/O error - * @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 - * @crossplatform - * @since 10 + * @since 20 */ + readFully(): ArrayBuffer; + /** - * @type { number } - * @readonly - * @throws { BusinessError } 13900005 - I/O error - * @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 - * @crossplatform - * @atomicservice - * @since 11 + * @since 20 */ - readonly mode: number; + startWrite(): WriteStream; + /** - * @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 + * If the file is written successfully, the file is closed. + * @throws { BusinessError } 13900042 Internal error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 + * @since 20 */ + finishWrite(): void; + /** - * @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 + * If writing to the file fails, the file is rolled back. + * @throws { BusinessError } 13900042 Internal error * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @since 10 + * @since 20 */ - readonly uid: number; + failWrite(): void; + /** - * @type { number } - * @readonly - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900042 - Unknown error + * 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 9 + * @since 20 */ + delete(): void; +} + +/** + * Stat object. + * + * @interface Stat + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since 20 + */ +interface Stat { + /** - * @type { number } + * @type { bigint } * @readonly * @throws { BusinessError } 13900005 - I/O error * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO * @crossplatform - * @since 10 + * @since 20 */ - readonly gid: number; + readonly ino: bigint; + /** * @type { number } * @readonly * @throws { BusinessError } 13900005 - I/O error * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 + * @crossplatform + * @atomicservice + * @since 20 */ + readonly mode: number; + /** * @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 11 + * @since 20 */ - readonly size: number; + readonly uid: number; + /** * @type { number } * @readonly * @throws { BusinessError } 13900005 - I/O error * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 + * @crossplatform + * @since 20 */ + readonly gid: number; + /** * @type { number } * @readonly @@ -7476,8 +3984,11 @@ declare interface Stat { * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO * @crossplatform - * @since 10 + * @atomicservice + * @since 20 */ + readonly size: number; + /** * @type { number } * @readonly @@ -7486,17 +3997,22 @@ declare interface Stat { * @syscap SystemCapability.FileManagement.File.FileIO * @crossplatform * @atomicservice - * @since 11 + * @since 20 */ readonly atime: number; + /** * @type { number } * @readonly * @throws { BusinessError } 13900005 - I/O error * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 + * @crossplatform + * @atomicservice + * @since 20 */ + readonly mtime: number; + /** * @type { number } * @readonly @@ -7504,56 +4020,50 @@ declare interface Stat { * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO * @crossplatform - * @since 10 + * @since 20 */ + readonly ctime: number; + /** - * @type { number } + * Returns nanosecond of the access time. + * @type { bigint } * @readonly - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900042 - Unknown error + * @throws { BusinessError } 13900042 - Internal error * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @atomicservice - * @since 11 + * @since 20 */ - readonly mtime: number; + readonly atimeNs?:bigint; + /** - * @type { number } + * Returns nanosecond of the modification time. + * @type { bigint } * @readonly - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900042 - Unknown error + * @throws { BusinessError } 13900042 - Internal error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 + * @since 20 */ + readonly mtimeNs?:bigint; + /** - * @type { number } + * Returns nanosecond of the change time. + * @type { bigint } * @readonly - * @throws { BusinessError } 13900005 - I/O error - * @throws { BusinessError } 13900042 - Unknown error + * @throws { BusinessError } 13900042 - Internal error * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @since 10 + * @since 20 */ - readonly ctime: number; + readonly ctimeNs?:bigint; + /** * * @type { LocationType } * @readonly * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 11 + * @since 20 */ 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. * @@ -7562,18 +4072,10 @@ declare interface Stat { * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO * @crossplatform - * @since 10 + * @since 20 */ 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. * @@ -7582,28 +4084,10 @@ declare interface Stat { * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO * @crossplatform - * @since 10 + * @since 20 */ 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. * @@ -7613,18 +4097,10 @@ declare interface Stat { * @syscap SystemCapability.FileManagement.File.FileIO * @crossplatform * @atomicservice - * @since 11 + * @since 20 */ 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. * @@ -7633,28 +4109,10 @@ declare interface Stat { * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO * @crossplatform - * @since 10 + * @since 20 */ 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. * @@ -7664,18 +4122,10 @@ declare interface Stat { * @syscap SystemCapability.FileManagement.File.FileIO * @crossplatform * @atomicservice - * @since 11 + * @since 20 */ 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. * @@ -7684,18 +4134,10 @@ declare interface Stat { * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO * @crossplatform - * @since 10 + * @since 20 */ 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. * @@ -7704,7 +4146,7 @@ declare interface Stat { * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO * @crossplatform - * @since 10 + * @since 20 */ isSymbolicLink(): boolean; } @@ -7714,9 +4156,9 @@ declare interface Stat { * * @interface Stream * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 + * @since 20 */ -declare interface Stream { +interface Stream { /** * Close stream. * @@ -7728,7 +4170,7 @@ declare interface Stream { * @throws { BusinessError } 13900041 - Quota exceeded * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 + * @since 20 */ close(): Promise; @@ -7743,7 +4185,7 @@ declare interface Stream { * @throws { BusinessError } 13900041 - Quota exceeded * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 + * @since 20 */ close(callback: AsyncCallback): void; @@ -7757,7 +4199,7 @@ declare interface Stream { * @throws { BusinessError } 13900041 - Quota exceeded * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 + * @since 20 */ closeSync(): void; @@ -7778,78 +4220,14 @@ declare interface Stream { * @throws { BusinessError } 13900041 - Quota exceeded * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 - */ - 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 9 - */ - 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 9 - */ - 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 + * @since 20 */ + flush(): Promise; + /** - * Write stream. + * Flush stream. * - * @param { ArrayBuffer | string } buffer - buffer. - * @param { WriteOptions } [options] - options. - * @returns { Promise } Returns the number of file bytes written to file in promise mode. + * @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 @@ -7863,18 +4241,13 @@ declare interface Stream { * @throws { BusinessError } 13900041 - Quota exceeded * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 11 + * @since 20 */ - write( - buffer: ArrayBuffer | string, - options?: WriteOptions - ): Promise; + flush(callback: AsyncCallback): void; /** - * Write stream. + * Flush stream with sync interface. * - * @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 @@ -7888,16 +4261,16 @@ declare interface Stream { * @throws { BusinessError } 13900041 - Quota exceeded * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 + * @since 20 */ - write(buffer: ArrayBuffer | string, callback: AsyncCallback): void; + flushSync(): 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. + * @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 @@ -7911,13 +4284,17 @@ declare interface Stream { * @throws { BusinessError } 13900041 - Quota exceeded * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 + * @since 20 */ + write( + buffer: ArrayBuffer | string, + options?: WriteOptions + ): Promise; + /** * 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 @@ -7932,20 +4309,16 @@ declare interface Stream { * @throws { BusinessError } 13900041 - Quota exceeded * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 11 + * @since 20 */ - write( - buffer: ArrayBuffer | string, - options: WriteOptions, - callback: AsyncCallback - ): void; + write(buffer: ArrayBuffer | string, callback: AsyncCallback): void; /** - * Write stream with sync interface. + * Write stream. * * @param { ArrayBuffer | string } buffer - buffer. - * @param { object } [options] - options. - * @returns { number } Returns the number of file bytes written to file. + * @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 @@ -7959,8 +4332,14 @@ declare interface Stream { * @throws { BusinessError } 13900041 - Quota exceeded * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 + * @since 20 */ + write( + buffer: ArrayBuffer | string, + options: WriteOptions, + callback: AsyncCallback + ): void; + /** * Write stream with sync interface. * @@ -7980,49 +4359,13 @@ declare interface Stream { * @throws { BusinessError } 13900041 - Quota exceeded * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 11 + * @since 20 */ 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. * @@ -8040,7 +4383,7 @@ declare interface Stream { * @throws { BusinessError } 13900042 - Unknown error * @throws { BusinessError } 13900044 - Network is unreachable * @syscap SystemCapability.FileManagement.File.FileIO - * @since 12 + * @since 20 */ read( buffer: ArrayBuffer, @@ -8062,7 +4405,7 @@ declare interface Stream { * @throws { BusinessError } 13900034 - Operation would block * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 + * @since 20 */ read(buffer: ArrayBuffer, callback: AsyncCallback): void; @@ -8070,7 +4413,7 @@ declare interface Stream { * Read stream. * * @param { ArrayBuffer } buffer - buffer. - * @param { object } [options] - options. + * @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 @@ -8082,14 +4425,20 @@ declare interface Stream { * @throws { BusinessError } 13900034 - Operation would block * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 + * @since 20 */ + read( + buffer: ArrayBuffer, + options: ReadOptions, + callback: AsyncCallback + ): void; + /** - * Read stream. + * Read stream with sync interface. * * @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. + * @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 @@ -8099,98 +4448,227 @@ declare interface Stream { * @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 11 + * @since 20 */ - read( + readSync( buffer: ArrayBuffer, - options: ReadOptions, - callback: AsyncCallback - ): void; + options?: ReadOptions + ): number; +} +/** + * Watcher object + * + * @interface Watcher + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 20 + */ +interface Watcher { /** - * Read stream with sync interface. + * Start watcher. * - * @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 } 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 } 13900019 - Is a directory + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900018 - Not a directory * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900034 - Operation would block + * @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 9 + * @since 20 */ + start(): void; + /** - * Read stream with sync interface. + * Stop watcher. * - * @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 } 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 } 13900019 - Is a directory + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900018 - Not a directory * @throws { BusinessError } 13900020 - Invalid argument - * @throws { BusinessError } 13900034 - Operation would block + * @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 11 + * @since 20 + */ + stop(): void; +} + +/** + * Enumeration of different types of whence. + * + * @enum { number } whence type + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 20 + */ +enum WhenceType { + /** + * Starting position of the file offset. + * + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 20 + */ + SEEK_SET = 0, + + /** + * Current position of the file offset. + * + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 20 + */ + SEEK_CUR = 1, + + /** + * Ending position of the file offset. + * + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 20 + */ + SEEK_END = 2, +} + +/** + * Enumeration of different types of file location. + * + * @enum { number } location type + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 20 + */ +enum LocationType { + /** + * Local file. + * + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 20 + */ + LOCAL = 1 << 0, + + /** + * Cloud file. + * + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 20 + */ + CLOUD = 1 << 1, +} + +/** + * Enumeration of different types of access mode. + * + * @enum { number } access mode type + * @syscap SystemCapability.FileManagement.File.FileIO + * @atomicservice + * @since 20 + */ +enum AccessModeType { + /** + * Check if the file exists. + * + * @syscap SystemCapability.FileManagement.File.FileIO + * @atomicservice + * @since 20 + */ + EXIST = 0, + + /** + * Check if the file has write permission. + * + * @syscap SystemCapability.FileManagement.File.FileIO + * @atomicservice + * @since 20 + */ + WRITE = 2, + + /** + * Check if the file has read permission. + * + * @syscap SystemCapability.FileManagement.File.FileIO + * @atomicservice + * @since 20 + */ + READ = 4, + + /** + * Check if the file has read and write permission. + * + * @syscap SystemCapability.FileManagement.File.FileIO + * @atomicservice + * @since 20 + */ + READ_WRITE = 6, +} + +/** + * Enumeration of different types of access flag. + * + * @enum { number } access flag type + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 20 + */ +enum AccessFlagType { + /** + * Check if the file is on the local. + * + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 20 */ + LOCAL = 0, +} + +/** + * ReaderIterator object + * + * @interface ReaderIterator + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 20 + */ +interface ReaderIterator { /** - * Read stream with sync interface. + * Get next result from the iterator. * - * @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 + * @returns { ReaderIteratorResult } Returns the result of reader iterator. * @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 } 13900037 - No data available * @throws { BusinessError } 13900042 - Unknown error - * @throws { BusinessError } 13900044 - Network is unreachable * @syscap SystemCapability.FileManagement.File.FileIO - * @since 12 + * @since 20 */ - readSync( - buffer: ArrayBuffer, - options?: ReadOptions - ): number; + next(): ReaderIteratorResult; +} + } /** * Implements watcher event listening. * - * @interface WatchEventListener + * @typedef { function } WatchEventListener + * @param { WatchEvent } event - Event type for the callback to invoke. * @syscap SystemCapability.FileManagement.File.FileIO - * @since 10 + * @since 20 */ export type WatchEventListener = (event: WatchEvent) => void; - /** - * Specifies the callback function to be invoked. - * - * @param { WatchEvent } event - Event type for the callback to invoke. - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 10 - */ /** * Event Listening. * * @interface WatchEvent * @syscap SystemCapability.FileManagement.File.FileIO - * @since 10 + * @since 20 */ export interface WatchEvent { /** @@ -8199,7 +4677,7 @@ export interface WatchEvent { * @type { string } * @readonly * @syscap SystemCapability.FileManagement.File.FileIO - * @since 10 + * @since 20 */ readonly fileName: string; @@ -8209,7 +4687,7 @@ export interface WatchEvent { * @type { number } * @readonly * @syscap SystemCapability.FileManagement.File.FileIO - * @since 10 + * @since 20 */ readonly event: number; @@ -8219,68 +4697,17 @@ export interface WatchEvent { * @type { number } * @readonly * @syscap SystemCapability.FileManagement.File.FileIO - * @since 10 + * @since 20 */ readonly cookie: number; } -/** - * Watcher object - * - * @interface Watcher - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 10 - */ -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 10 - */ - 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 10 - */ - stop(): void; -} - /** * Reader Iterator Result * * @interface ReaderIteratorResult * @syscap SystemCapability.FileManagement.File.FileIO - * @since 11 + * @since 20 */ export interface ReaderIteratorResult { /** @@ -8288,7 +4715,7 @@ export interface ReaderIteratorResult { * * @type { boolean } * @syscap SystemCapability.FileManagement.File.FileIO - * @since 11 + * @since 20 */ done: boolean; @@ -8297,39 +4724,11 @@ export interface ReaderIteratorResult { * * @type { string } * @syscap SystemCapability.FileManagement.File.FileIO - * @since 11 + * @since 20 */ value: string; } -/** - * ReaderIterator object - * - * @interface ReaderIterator - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 11 - */ -declare 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 11 - */ - next(): ReaderIteratorResult; -} - -/** - * File filter type - * - * @syscap SystemCapability.FileManagement.File.FileIO - * @crossplatform - * @since 10 - */ /** * File filter type * @@ -8337,16 +4736,10 @@ declare interface ReaderIterator { * @syscap SystemCapability.FileManagement.File.FileIO * @crossplatform * @atomicservice - * @since 11 + * @since 20 */ export interface Filter { - /** - * The suffix of the file. - * - * @type { ?Array } - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 10 - */ + /** * The suffix of the file. * @@ -8354,16 +4747,10 @@ export interface Filter { * @syscap SystemCapability.FileManagement.File.FileIO * @crossplatform * @atomicservice - * @since 11 + * @since 20 */ suffix?: Array; - /** - * The display name of the file. - * - * @type { ?Array } - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 10 - */ + /** * The display name of the file. * @@ -8371,16 +4758,10 @@ export interface Filter { * @syscap SystemCapability.FileManagement.File.FileIO * @crossplatform * @atomicservice - * @since 11 + * @since 20 */ displayName?: Array; - /** - * The mimetype of the file. - * - * @type { ?Array } - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 10 - */ + /** * The mimetype of the file. * @@ -8388,16 +4769,10 @@ export interface Filter { * @syscap SystemCapability.FileManagement.File.FileIO * @crossplatform * @atomicservice - * @since 11 + * @since 20 */ mimeType?: Array; - /** - * The exceeding size of the file. - * - * @type { ?number } - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 10 - */ + /** * The exceeding size of the file. * @@ -8405,16 +4780,10 @@ export interface Filter { * @syscap SystemCapability.FileManagement.File.FileIO * @crossplatform * @atomicservice - * @since 11 + * @since 20 */ fileSizeOver?: number; - /** - * The last modification time of the file. - * - * @type { ?number } - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 10 - */ + /** * The last modification time of the file. * @@ -8422,16 +4791,10 @@ export interface Filter { * @syscap SystemCapability.FileManagement.File.FileIO * @crossplatform * @atomicservice - * @since 11 + * @since 20 */ lastModifiedAfter?: number; - /** - * Whether to exclude media files. - * - * @type { ?boolean } - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 10 - */ + /** * Whether to exclude media files. * @@ -8439,54 +4802,35 @@ export interface Filter { * @syscap SystemCapability.FileManagement.File.FileIO * @crossplatform * @atomicservice - * @since 11 + * @since 20 */ excludeMedia?: boolean; } -/** - * Conflict Files type - * - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 10 - */ /** * Conflict Files type * * @interface ConflictFiles * @syscap SystemCapability.FileManagement.File.FileIO - * @since 11 + * @since 20 */ export interface ConflictFiles { + /** * The path of the source file. * * @type { string } * @syscap SystemCapability.FileManagement.File.FileIO - * @since 10 - */ - /** - * The path of the source file. - * - * @type { string } - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 11 + * @since 20 */ srcFile: string; - /** - * The path of the source file. - * - * @type { string } - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 10 - */ /** * The path of the destination file. * * @type { string } * @syscap SystemCapability.FileManagement.File.FileIO - * @since 11 + * @since 20 */ destFile: string; } @@ -8496,7 +4840,7 @@ export interface ConflictFiles { * * @interface Options * @syscap SystemCapability.FileManagement.File.FileIO - * @since 11 + * @since 20 */ export interface Options { /** @@ -8504,7 +4848,7 @@ export interface Options { * * @type { ?string } * @syscap SystemCapability.FileManagement.File.FileIO - * @since 11 + * @since 20 */ encoding?: string; } @@ -8515,7 +4859,7 @@ export interface Options { * @interface ReadOptions * @syscap SystemCapability.FileManagement.File.FileIO * @atomicservice - * @since 11 + * @since 20 */ export interface ReadOptions { /** @@ -8524,7 +4868,7 @@ export interface ReadOptions { * @type { ?number } * @syscap SystemCapability.FileManagement.File.FileIO * @atomicservice - * @since 11 + * @since 20 */ offset?: number; /** @@ -8533,7 +4877,7 @@ export interface ReadOptions { * @type { ?number } * @syscap SystemCapability.FileManagement.File.FileIO * @atomicservice - * @since 11 + * @since 20 */ length?: number; } @@ -8541,11 +4885,11 @@ export interface ReadOptions { /** * ReadTextOptions type * - * @interface ReadTextOptions * @extends ReadOptions + * @interface ReadTextOptions * @syscap SystemCapability.FileManagement.File.FileIO * @atomicservice - * @since 11 + * @since 20 */ export interface ReadTextOptions extends ReadOptions { /** @@ -8554,7 +4898,7 @@ export interface ReadTextOptions extends ReadOptions { * @type { ?string } * @syscap SystemCapability.FileManagement.File.FileIO * @atomicservice - * @since 11 + * @since 20 */ encoding?: string; } @@ -8562,11 +4906,11 @@ export interface ReadTextOptions extends ReadOptions { /** * WriteOptions type * - * @interface WriteOptions * @extends Options + * @interface WriteOptions * @syscap SystemCapability.FileManagement.File.FileIO * @atomicservice - * @since 11 + * @since 20 */ export interface WriteOptions extends Options { /** @@ -8575,7 +4919,7 @@ export interface WriteOptions extends Options { * @type { ?number } * @syscap SystemCapability.FileManagement.File.FileIO * @atomicservice - * @since 11 + * @since 20 */ offset?: number; /** @@ -8584,7 +4928,7 @@ export interface WriteOptions extends Options { * @type { ?number } * @syscap SystemCapability.FileManagement.File.FileIO * @atomicservice - * @since 11 + * @since 20 */ length?: number; } @@ -8595,7 +4939,7 @@ export interface WriteOptions extends Options { * @interface ListFileOptions * @syscap SystemCapability.FileManagement.File.FileIO * @atomicservice - * @since 11 + * @since 20 */ export interface ListFileOptions { /** @@ -8604,7 +4948,7 @@ export interface ListFileOptions { * @type { ?boolean } * @syscap SystemCapability.FileManagement.File.FileIO * @atomicservice - * @since 11 + * @since 20 */ recursion?: boolean; @@ -8614,7 +4958,7 @@ export interface ListFileOptions { * @type { ?number } * @syscap SystemCapability.FileManagement.File.FileIO * @atomicservice - * @since 11 + * @since 20 */ listNum?: number; @@ -8624,7 +4968,7 @@ export interface ListFileOptions { * @type { ?Filter } * @syscap SystemCapability.FileManagement.File.FileIO * @atomicservice - * @since 11 + * @since 20 */ filter?: Filter; } @@ -8634,7 +4978,7 @@ export interface ListFileOptions { * * @interface RandomAccessFileOptions * @syscap SystemCapability.FileManagement.File.FileIO - * @since 12 + * @since 20 */ export interface RandomAccessFileOptions { /** @@ -8642,7 +4986,7 @@ export interface RandomAccessFileOptions { * * @type { ?number } * @syscap SystemCapability.FileManagement.File.FileIO - * @since 12 + * @since 20 */ start?: number; @@ -8651,7 +4995,7 @@ export interface RandomAccessFileOptions { * * @type { ?number } * @syscap SystemCapability.FileManagement.File.FileIO - * @since 12 + * @since 20 */ end?: number; } @@ -8661,7 +5005,7 @@ export interface RandomAccessFileOptions { * * @interface ReadStreamOptions * @syscap SystemCapability.FileManagement.File.FileIO - * @since 12 + * @since 20 */ export interface ReadStreamOptions { /** @@ -8669,7 +5013,7 @@ export interface ReadStreamOptions { * * @type { ?number } * @syscap SystemCapability.FileManagement.File.FileIO - * @since 12 + * @since 20 */ start?: number; @@ -8678,7 +5022,7 @@ export interface ReadStreamOptions { * * @type { ?number } * @syscap SystemCapability.FileManagement.File.FileIO - * @since 12 + * @since 20 */ end?: number; } @@ -8688,7 +5032,7 @@ export interface ReadStreamOptions { * * @interface WriteStreamOptions * @syscap SystemCapability.FileManagement.File.FileIO - * @since 12 + * @since 20 */ export interface WriteStreamOptions { /** @@ -8696,7 +5040,7 @@ export interface WriteStreamOptions { * * @type { ?number } * @syscap SystemCapability.FileManagement.File.FileIO - * @since 12 + * @since 20 */ mode?: number; /** @@ -8704,7 +5048,7 @@ export interface WriteStreamOptions { * * @type { ?number } * @syscap SystemCapability.FileManagement.File.FileIO - * @since 12 + * @since 20 */ start?: number; } @@ -8714,7 +5058,7 @@ export interface WriteStreamOptions { * * @typedef DfsListeners * @syscap SystemCapability.FileManagement.File.FileIO - * @since 12 + * @since 20 */ export interface DfsListeners { /** @@ -8723,128 +5067,34 @@ export interface DfsListeners { * @param { string } networkId - The networkId of device. * @param { number } status - The status code of Distributed File System. * @syscap SystemCapability.FileManagement.File.FileIO - * @since 12 + * @since 20 */ onStatus(networkId: string, status: number): void; } /** - * Enumeration of different types of whence. - * - * @enum { number } whence type + * Task signal. + * @typedef { fileIo.TaskSignal } * @syscap SystemCapability.FileManagement.File.FileIO - * @since 11 + * @since 20 */ -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, -} +type TaskSignal = fileIo.TaskSignal; /** - * Enumeration of different types of file location. - * - * @enum { number } location type + * Watcher object + * @typedef { fileIo.Watcher } * @syscap SystemCapability.FileManagement.File.FileIO - * @since 11 + * @since 20 */ -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, -} +type Watcher = fileIo.Watcher; /** - * Enumeration of different types of access mode. - * - * @enum { number } access mode type + * Watcher object + * @typedef { fileIo.AtomicFile } * @syscap SystemCapability.FileManagement.File.FileIO - * @atomicservice - * @since 12 + * @since 20 */ -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, - - /** - * Check if the file has read and write permission. - * - * @syscap SystemCapability.FileManagement.File.FileIO - * @atomicservice - * @since 12 - */ - READ_WRITE = 6, -} +type AtomicFile = fileIo.AtomicFile; -/** - * Enumeration of different types of access flag. - * - * @enum { number } access flag type - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 12 - */ -declare enum AccessFlagType { - /** - * Check if the file is on the local. - * - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 12 - */ - LOCAL = 0, -} +export default fileIo; +export {TaskSignal, Watcher, AtomicFile} \ No newline at end of file diff --git a/api/@ohos.file.hash.d.ts b/api/@ohos.file.hash.d.ts index bd9f4e28b30543ef302d3e9b8c81bb1271c3e8f0..60bf4c044c2beb6e013f44376e4dbc91a62da437 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 arkts {'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 arkts {'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 arkts {'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 arkts {'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 arkts {'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 arkts {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 */ update(data: ArrayBuffer): void; } diff --git a/api/@ohos.file.securityLabel.d.ts b/api/@ohos.file.securityLabel.d.ts index 6167dc92ace646abc9354557a9cc0b9780f5c409..1050c3b3240f692cb49c0268eb2f8613400aaf65 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 arkts {'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 arkts {'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 arkts {'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 arkts {'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 arkts {'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 arkts {'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 arkts {'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 arkts {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 */ function getSecurityLabelSync(path: string): string; } diff --git a/api/@ohos.file.statvfs.d.ts b/api/@ohos.file.statvfs.d.ts index b5f92e338e2b4f9babb3ef3203a2bdd913175fa6..9dd4b53226e8f0100d6688e4659aa44f62ccc81c 100644 --- a/api/@ohos.file.statvfs.d.ts +++ b/api/@ohos.file.statvfs.d.ts @@ -25,7 +25,8 @@ import type { AsyncCallback } from './@ohos.base'; * * @namespace statfs * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 + * @since arkts {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 */ declare namespace statfs { /** @@ -47,7 +48,8 @@ declare namespace statfs { * @throws { BusinessError } 13900038 - Value too large for defined data type * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 + * @since arkts {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 */ function getFreeSize(path: string): Promise; @@ -70,7 +72,8 @@ declare namespace statfs { * @throws { BusinessError } 13900038 - Value too large for defined data type * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 + * @since arkts {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 */ function getFreeSize(path: string, callback: AsyncCallback): void; @@ -93,7 +96,8 @@ declare namespace statfs { * @throws { BusinessError } 13900038 - Value too large for defined data type * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 10 + * @since arkts {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 */ function getFreeSizeSync(path: string): number; @@ -116,7 +120,8 @@ declare namespace statfs { * @throws { BusinessError } 13900038 - Value too large for defined data type * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 + * @since arkts {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 */ function getTotalSize(path: string): Promise; @@ -139,7 +144,8 @@ declare namespace statfs { * @throws { BusinessError } 13900038 - Value too large for defined data type * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 9 + * @since arkts {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 */ function getTotalSize(path: string, callback: AsyncCallback): void; @@ -162,7 +168,8 @@ declare namespace statfs { * @throws { BusinessError } 13900038 - Value too large for defined data type * @throws { BusinessError } 13900042 - Unknown error * @syscap SystemCapability.FileManagement.File.FileIO - * @since 10 + * @since arkts {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 */ function getTotalSizeSync(path: string): number; }