1/* 2 * Copyright (c) 2022-2024 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16/** 17 * @file 18 * @kit CoreFileKit 19 */ 20 21import { AsyncCallback } from './@ohos.base'; 22import stream from './@ohos.util.stream'; 23 24export default fileIo; 25 26/** 27 * FileIO 28 * 29 * @namespace fileIo 30 * @syscap SystemCapability.FileManagement.File.FileIO 31 * @since 9 32 */ 33/** 34 * FileIO 35 * 36 * @namespace fileIo 37 * @syscap SystemCapability.FileManagement.File.FileIO 38 * @crossplatform 39 * @since 10 40 */ 41/** 42 * FileIO 43 * 44 * @namespace fileIo 45 * @syscap SystemCapability.FileManagement.File.FileIO 46 * @crossplatform 47 * @atomicservice 48 * @since 11 49 */ 50/** 51 * FileIO 52 * 53 * @namespace fileIo 54 * @syscap SystemCapability.FileManagement.File.FileIO 55 * @crossplatform 56 * @atomicservice 57 * @since 12 58 */ 59declare namespace fileIo { 60 export { access }; 61 export { accessSync }; 62 export { close }; 63 export { closeSync }; 64 export { copy }; 65 export { copyDir }; 66 export { copyDirSync }; 67 export { copyFile }; 68 export { copyFileSync }; 69 export { createRandomAccessFile }; 70 export { createRandomAccessFileSync }; 71 export { createStream }; 72 export { createStreamSync }; 73 export { createReadStream }; 74 export { createWriteStream }; 75 export { createWatcher }; 76 export { dup }; 77 export { fdatasync }; 78 export { fdatasyncSync }; 79 export { fdopenStream }; 80 export { fdopenStreamSync }; 81 export { fsync }; 82 export { fsyncSync }; 83 export { getxattr }; 84 export { getxattrSync }; 85 export { listFile }; 86 export { listFileSync }; 87 export { lseek }; 88 export { lstat }; 89 export { lstatSync }; 90 export { mkdir }; 91 export { mkdirSync }; 92 export { mkdtemp }; 93 export { mkdtempSync }; 94 export { moveDir }; 95 export { moveDirSync }; 96 export { moveFile }; 97 export { moveFileSync }; 98 export { open }; 99 export { openSync }; 100 export { read }; 101 export { readSync }; 102 export { readLines }; 103 export { readLinesSync }; 104 export { readText }; 105 export { readTextSync }; 106 export { rename }; 107 export { renameSync }; 108 export { rmdir }; 109 export { rmdirSync }; 110 export { setxattr }; 111 export { setxattrSync }; 112 export { stat }; 113 export { statSync }; 114 export { symlink }; 115 export { symlinkSync }; 116 export { truncate }; 117 export { truncateSync }; 118 export { unlink }; 119 export { unlinkSync }; 120 export { utimes }; 121 export { write }; 122 export { writeSync }; 123 export { AccessModeType }; 124 export { AccessFlagType }; 125 export { File }; 126 export { OpenMode }; 127 export { RandomAccessFile }; 128 export { ReaderIterator }; 129 export { Stat }; 130 export { Stream }; 131 export { ReadStream }; 132 export { WriteStream }; 133 export { Watcher }; 134 export { WhenceType }; 135 export { TaskSignal }; 136 export { connectDfs }; 137 export { disconnectDfs }; 138 export type { Progress }; 139 export type { CopyOptions }; 140 export type { ProgressListener }; 141 export type { DfsListeners }; 142 143 /** 144 * Mode Indicates the open flags. 145 * 146 * @namespace OpenMode 147 * @syscap SystemCapability.FileManagement.File.FileIO 148 * @since 9 149 */ 150 /** 151 * Mode Indicates the open flags. 152 * 153 * @namespace OpenMode 154 * @syscap SystemCapability.FileManagement.File.FileIO 155 * @crossplatform 156 * @since 10 157 */ 158 /** 159 * Mode Indicates the open flags. 160 * 161 * @namespace OpenMode 162 * @syscap SystemCapability.FileManagement.File.FileIO 163 * @crossplatform 164 * @atomicservice 165 * @since 11 166 */ 167 namespace OpenMode { 168 /** 169 * Read only Permission. 170 * 171 * @constant 172 * @syscap SystemCapability.FileManagement.File.FileIO 173 * @since 9 174 */ 175 /** 176 * Read only Permission. 177 * 178 * @constant 179 * @syscap SystemCapability.FileManagement.File.FileIO 180 * @crossplatform 181 * @since 10 182 */ 183 /** 184 * Read only Permission. 185 * 186 * @constant 187 * @syscap SystemCapability.FileManagement.File.FileIO 188 * @crossplatform 189 * @atomicservice 190 * @since 11 191 */ 192 const READ_ONLY = 0o0; 193 /** 194 * Write only Permission. 195 * 196 * @constant 197 * @syscap SystemCapability.FileManagement.File.FileIO 198 * @since 9 199 */ 200 /** 201 * Write only Permission. 202 * 203 * @constant 204 * @syscap SystemCapability.FileManagement.File.FileIO 205 * @crossplatform 206 * @since 10 207 */ 208 /** 209 * Write only Permission. 210 * 211 * @constant 212 * @syscap SystemCapability.FileManagement.File.FileIO 213 * @crossplatform 214 * @atomicservice 215 * @since 11 216 */ 217 const WRITE_ONLY = 0o1; 218 /** 219 * Write and Read Permission. 220 * 221 * @constant 222 * @syscap SystemCapability.FileManagement.File.FileIO 223 * @since 9 224 */ 225 /** 226 * Write and Read Permission. 227 * 228 * @constant 229 * @syscap SystemCapability.FileManagement.File.FileIO 230 * @crossplatform 231 * @since 10 232 */ 233 /** 234 * Write and Read Permission. 235 * 236 * @constant 237 * @syscap SystemCapability.FileManagement.File.FileIO 238 * @crossplatform 239 * @atomicservice 240 * @since 11 241 */ 242 const READ_WRITE = 0o2; 243 /** 244 * If not exist, create file. 245 * 246 * @constant 247 * @syscap SystemCapability.FileManagement.File.FileIO 248 * @since 9 249 */ 250 /** 251 * If not exist, create file. 252 * 253 * @constant 254 * @syscap SystemCapability.FileManagement.File.FileIO 255 * @crossplatform 256 * @since 10 257 */ 258 /** 259 * If not exist, create file. 260 * 261 * @constant 262 * @syscap SystemCapability.FileManagement.File.FileIO 263 * @crossplatform 264 * @atomicservice 265 * @since 11 266 */ 267 const CREATE = 0o100; 268 /** 269 * File truncate len 0. 270 * 271 * @constant 272 * @syscap SystemCapability.FileManagement.File.FileIO 273 * @since 9 274 */ 275 /** 276 * File truncate len 0. 277 * 278 * @constant 279 * @syscap SystemCapability.FileManagement.File.FileIO 280 * @crossplatform 281 * @since 10 282 */ 283 /** 284 * File truncate len 0. 285 * 286 * @constant 287 * @syscap SystemCapability.FileManagement.File.FileIO 288 * @crossplatform 289 * @atomicservice 290 * @since 11 291 */ 292 const TRUNC = 0o1000; 293 /** 294 * File append write. 295 * 296 * @constant 297 * @syscap SystemCapability.FileManagement.File.FileIO 298 * @since 9 299 */ 300 /** 301 * File append write. 302 * 303 * @constant 304 * @syscap SystemCapability.FileManagement.File.FileIO 305 * @crossplatform 306 * @since 10 307 */ 308 /** 309 * File append write. 310 * 311 * @constant 312 * @syscap SystemCapability.FileManagement.File.FileIO 313 * @crossplatform 314 * @atomicservice 315 * @since 11 316 */ 317 const APPEND = 0o2000; 318 /** 319 * File open in nonblocking mode. 320 * 321 * @constant 322 * @syscap SystemCapability.FileManagement.File.FileIO 323 * @since 9 324 */ 325 /** 326 * File open in nonblocking mode. 327 * 328 * @constant 329 * @syscap SystemCapability.FileManagement.File.FileIO 330 * @crossplatform 331 * @since 10 332 */ 333 const NONBLOCK = 0o4000; 334 /** 335 * File is Dir. 336 * 337 * @constant 338 * @syscap SystemCapability.FileManagement.File.FileIO 339 * @since 9 340 */ 341 /** 342 * File is Dir. 343 * 344 * @constant 345 * @syscap SystemCapability.FileManagement.File.FileIO 346 * @crossplatform 347 * @since 10 348 */ 349 const DIR = 0o200000; 350 /** 351 * File is not symbolic link. 352 * 353 * @constant 354 * @syscap SystemCapability.FileManagement.File.FileIO 355 * @since 9 356 */ 357 /** 358 * File is not symbolic link. 359 * 360 * @constant 361 * @syscap SystemCapability.FileManagement.File.FileIO 362 * @crossplatform 363 * @since 10 364 */ 365 const NOFOLLOW = 0o400000; 366 /** 367 * SYNC IO. 368 * 369 * @constant 370 * @syscap SystemCapability.FileManagement.File.FileIO 371 * @since 9 372 */ 373 /** 374 * SYNC IO. 375 * 376 * @constant 377 * @syscap SystemCapability.FileManagement.File.FileIO 378 * @crossplatform 379 * @since 10 380 */ 381 const SYNC = 0o4010000; 382 } 383} 384 385/** 386 * Access file. 387 * 388 * @param { string } path - path. 389 * @returns { Promise<boolean> } return Promise 390 * @throws { BusinessError } 13900002 - No such file or directory 391 * @throws { BusinessError } 13900005 - I/O error 392 * @throws { BusinessError } 13900008 - Bad file descriptor 393 * @throws { BusinessError } 13900011 - Out of memory 394 * @throws { BusinessError } 13900012 - Permission denied 395 * @throws { BusinessError } 13900013 - Bad address 396 * @throws { BusinessError } 13900018 - Not a directory 397 * @throws { BusinessError } 13900020 - Invalid argument 398 * @throws { BusinessError } 13900023 - Text file busy 399 * @throws { BusinessError } 13900030 - File name too long 400 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 401 * @throws { BusinessError } 13900042 - Unknown error 402 * @syscap SystemCapability.FileManagement.File.FileIO 403 * @since 9 404 */ 405/** 406 * Access file. 407 * 408 * @param { string } path - path. 409 * @returns { Promise<boolean> } Returns the file is accessible or not in promise mode. 410 * @throws { BusinessError } 13900002 - No such file or directory 411 * @throws { BusinessError } 13900005 - I/O error 412 * @throws { BusinessError } 13900008 - Bad file descriptor 413 * @throws { BusinessError } 13900011 - Out of memory 414 * @throws { BusinessError } 13900012 - Permission denied 415 * @throws { BusinessError } 13900013 - Bad address 416 * @throws { BusinessError } 13900018 - Not a directory 417 * @throws { BusinessError } 13900020 - Invalid argument 418 * @throws { BusinessError } 13900023 - Text file busy 419 * @throws { BusinessError } 13900030 - File name too long 420 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 421 * @throws { BusinessError } 13900042 - Unknown error 422 * @syscap SystemCapability.FileManagement.File.FileIO 423 * @crossplatform 424 * @since 10 425 */ 426/** 427 * Access file. 428 * 429 * @param { string } path - path. 430 * @returns { Promise<boolean> } Returns the file is accessible or not in promise mode. 431 * @throws { BusinessError } 13900002 - No such file or directory 432 * @throws { BusinessError } 13900005 - I/O error 433 * @throws { BusinessError } 13900008 - Bad file descriptor 434 * @throws { BusinessError } 13900011 - Out of memory 435 * @throws { BusinessError } 13900012 - Permission denied 436 * @throws { BusinessError } 13900013 - Bad address 437 * @throws { BusinessError } 13900018 - Not a directory 438 * @throws { BusinessError } 13900020 - Invalid argument 439 * @throws { BusinessError } 13900023 - Text file busy 440 * @throws { BusinessError } 13900030 - File name too long 441 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 442 * @throws { BusinessError } 13900042 - Unknown error 443 * @syscap SystemCapability.FileManagement.File.FileIO 444 * @crossplatform 445 * @atomicservice 446 * @since 11 447 */ 448/** 449 * Access file. 450 * 451 * @param { string } path - path. 452 * @param { AccessModeType } [mode = fs.AccessModeType.EXIST] - accessibility mode. 453 * @returns { Promise<boolean> } Returns the file is accessible or not in promise mode. 454 * @throws { BusinessError } 13900002 - No such file or directory 455 * @throws { BusinessError } 13900005 - I/O error 456 * @throws { BusinessError } 13900008 - Bad file descriptor 457 * @throws { BusinessError } 13900011 - Out of memory 458 * @throws { BusinessError } 13900012 - Permission denied 459 * @throws { BusinessError } 13900013 - Bad address 460 * @throws { BusinessError } 13900018 - Not a directory 461 * @throws { BusinessError } 13900020 - Invalid argument 462 * @throws { BusinessError } 13900023 - Text file busy 463 * @throws { BusinessError } 13900030 - File name too long 464 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 465 * @throws { BusinessError } 13900042 - Unknown error 466 * @syscap SystemCapability.FileManagement.File.FileIO 467 * @crossplatform 468 * @atomicservice 469 * @since 12 470 */ 471declare function access(path: string, mode?: AccessModeType): Promise<boolean>; 472 473/** 474 * Access file. 475 * 476 * @param { string } path - path. 477 * @param { AsyncCallback<boolean> } callback - The callback is used to return the file is accessible or not. 478 * @throws { BusinessError } 13900002 - No such file or directory 479 * @throws { BusinessError } 13900005 - I/O error 480 * @throws { BusinessError } 13900008 - Bad file descriptor 481 * @throws { BusinessError } 13900011 - Out of memory 482 * @throws { BusinessError } 13900012 - Permission denied 483 * @throws { BusinessError } 13900013 - Bad address 484 * @throws { BusinessError } 13900018 - Not a directory 485 * @throws { BusinessError } 13900020 - Invalid argument 486 * @throws { BusinessError } 13900023 - Text file busy 487 * @throws { BusinessError } 13900030 - File name too long 488 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 489 * @throws { BusinessError } 13900042 - Unknown error 490 * @syscap SystemCapability.FileManagement.File.FileIO 491 * @since 9 492 */ 493/** 494 * Access file. 495 * 496 * @param { string } path - path. 497 * @param { AsyncCallback<boolean> } callback - The callback is used to return the file is accessible or not. 498 * @throws { BusinessError } 13900002 - No such file or directory 499 * @throws { BusinessError } 13900005 - I/O error 500 * @throws { BusinessError } 13900008 - Bad file descriptor 501 * @throws { BusinessError } 13900011 - Out of memory 502 * @throws { BusinessError } 13900012 - Permission denied 503 * @throws { BusinessError } 13900013 - Bad address 504 * @throws { BusinessError } 13900018 - Not a directory 505 * @throws { BusinessError } 13900020 - Invalid argument 506 * @throws { BusinessError } 13900023 - Text file busy 507 * @throws { BusinessError } 13900030 - File name too long 508 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 509 * @throws { BusinessError } 13900042 - Unknown error 510 * @syscap SystemCapability.FileManagement.File.FileIO 511 * @crossplatform 512 * @since 10 513 */ 514/** 515 * Access file. 516 * 517 * @param { string } path - path. 518 * @param { AsyncCallback<boolean> } callback - The callback is used to return the file is accessible or not. 519 * @throws { BusinessError } 13900002 - No such file or directory 520 * @throws { BusinessError } 13900005 - I/O error 521 * @throws { BusinessError } 13900008 - Bad file descriptor 522 * @throws { BusinessError } 13900011 - Out of memory 523 * @throws { BusinessError } 13900012 - Permission denied 524 * @throws { BusinessError } 13900013 - Bad address 525 * @throws { BusinessError } 13900018 - Not a directory 526 * @throws { BusinessError } 13900020 - Invalid argument 527 * @throws { BusinessError } 13900023 - Text file busy 528 * @throws { BusinessError } 13900030 - File name too long 529 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 530 * @throws { BusinessError } 13900042 - Unknown error 531 * @syscap SystemCapability.FileManagement.File.FileIO 532 * @crossplatform 533 * @atomicservice 534 * @since 11 535 */ 536declare function access(path: string, callback: AsyncCallback<boolean>): void; 537 538/** 539 * Access file. 540 * 541 * @param { string } path - file path that needs to be checked whether the calling process can access. 542 * @param { AccessModeType } mode - accessibility mode. 543 * @param { AccessFlagType } flag - accessibility flag. 544 * @returns { Promise<boolean> } Returns the file is accessible or not in promise mode. 545 * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 546 * <br>2.Incorrect parameter types. 547 * @throws { BusinessError } 13900005 - I/O error 548 * @throws { BusinessError } 13900011 - Out of memory 549 * @throws { BusinessError } 13900012 - Permission denied 550 * @throws { BusinessError } 13900013 - Bad address 551 * @throws { BusinessError } 13900018 - Not a directory 552 * @throws { BusinessError } 13900020 - Invalid argument 553 * @throws { BusinessError } 13900023 - Text file busy 554 * @throws { BusinessError } 13900030 - File name too long 555 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 556 * @syscap SystemCapability.FileManagement.File.FileIO 557 * @since 12 558 */ 559declare function access(path: string, mode: AccessModeType, flag: AccessFlagType): Promise<boolean>; 560 561/** 562 * Access file with sync interface. 563 * 564 * @param { string } path - path. 565 * @returns { boolean } Returns the file is accessible or not. 566 * @throws { BusinessError } 13900002 - No such file or directory 567 * @throws { BusinessError } 13900005 - I/O error 568 * @throws { BusinessError } 13900008 - Bad file descriptor 569 * @throws { BusinessError } 13900011 - Out of memory 570 * @throws { BusinessError } 13900012 - Permission denied 571 * @throws { BusinessError } 13900013 - Bad address 572 * @throws { BusinessError } 13900018 - Not a directory 573 * @throws { BusinessError } 13900020 - Invalid argument 574 * @throws { BusinessError } 13900023 - Text file busy 575 * @throws { BusinessError } 13900030 - File name too long 576 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 577 * @throws { BusinessError } 13900042 - Unknown error 578 * @syscap SystemCapability.FileManagement.File.FileIO 579 * @since 9 580 */ 581/** 582 * Access file with sync interface. 583 * 584 * @param { string } path - path. 585 * @returns { boolean } Returns the file is accessible or not. 586 * @throws { BusinessError } 13900002 - No such file or directory 587 * @throws { BusinessError } 13900005 - I/O error 588 * @throws { BusinessError } 13900008 - Bad file descriptor 589 * @throws { BusinessError } 13900011 - Out of memory 590 * @throws { BusinessError } 13900012 - Permission denied 591 * @throws { BusinessError } 13900013 - Bad address 592 * @throws { BusinessError } 13900018 - Not a directory 593 * @throws { BusinessError } 13900020 - Invalid argument 594 * @throws { BusinessError } 13900023 - Text file busy 595 * @throws { BusinessError } 13900030 - File name too long 596 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 597 * @throws { BusinessError } 13900042 - Unknown error 598 * @syscap SystemCapability.FileManagement.File.FileIO 599 * @crossplatform 600 * @since 10 601 */ 602/** 603 * Access file with sync interface. 604 * 605 * @param { string } path - path. 606 * @returns { boolean } Returns the file is accessible or not. 607 * @throws { BusinessError } 13900002 - No such file or directory 608 * @throws { BusinessError } 13900005 - I/O error 609 * @throws { BusinessError } 13900008 - Bad file descriptor 610 * @throws { BusinessError } 13900011 - Out of memory 611 * @throws { BusinessError } 13900012 - Permission denied 612 * @throws { BusinessError } 13900013 - Bad address 613 * @throws { BusinessError } 13900018 - Not a directory 614 * @throws { BusinessError } 13900020 - Invalid argument 615 * @throws { BusinessError } 13900023 - Text file busy 616 * @throws { BusinessError } 13900030 - File name too long 617 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 618 * @throws { BusinessError } 13900042 - Unknown error 619 * @syscap SystemCapability.FileManagement.File.FileIO 620 * @crossplatform 621 * @atomicservice 622 * @since 11 623 */ 624/** 625 * 626 * Access file with sync interface. 627 * 628 * @param { string } path - path. 629 * @param { AccessModeType } [mode = fs.AccessModeType.EXIST] - accessibility mode. 630 * @returns { boolean } Returns the file is accessible or not. 631 * @throws { BusinessError } 13900002 - No such file or directory 632 * @throws { BusinessError } 13900005 - I/O error 633 * @throws { BusinessError } 13900008 - Bad file descriptor 634 * @throws { BusinessError } 13900011 - Out of memory 635 * @throws { BusinessError } 13900012 - Permission denied 636 * @throws { BusinessError } 13900013 - Bad address 637 * @throws { BusinessError } 13900018 - Not a directory 638 * @throws { BusinessError } 13900020 - Invalid argument 639 * @throws { BusinessError } 13900023 - Text file busy 640 * @throws { BusinessError } 13900030 - File name too long 641 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 642 * @throws { BusinessError } 13900042 - Unknown error 643 * @syscap SystemCapability.FileManagement.File.FileIO 644 * @crossplatform 645 * @atomicservice 646 * @since 12 647 */ 648declare function accessSync(path: string, mode?: AccessModeType): boolean; 649 650/** 651 * Access file with sync interface. 652 * 653 * @param { string } path - file path that needs to be checked whether the calling process can access. 654 * @param { AccessModeType } mode - accessibility mode. 655 * @param { AccessFlagType } flag - accessibility flag. 656 * @returns { boolean } Returns the file is accessible or not. 657 * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 658 * <br>2.Incorrect parameter types. 659 * @throws { BusinessError } 13900005 - I/O error 660 * @throws { BusinessError } 13900011 - Out of memory 661 * @throws { BusinessError } 13900012 - Permission denied 662 * @throws { BusinessError } 13900013 - Bad address 663 * @throws { BusinessError } 13900018 - Not a directory 664 * @throws { BusinessError } 13900020 - Invalid argument 665 * @throws { BusinessError } 13900023 - Text file busy 666 * @throws { BusinessError } 13900030 - File name too long 667 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 668 * @syscap SystemCapability.FileManagement.File.FileIO 669 * @since 12 670 */ 671declare function accessSync(path: string, mode: AccessModeType, flag: AccessFlagType): boolean; 672 673/** 674 * Close file or fd. 675 * 676 * @param { number | File } file - file object or fd. 677 * @returns { Promise<void> } The promise returned by the function. 678 * @throws { BusinessError } 13900004 - Interrupted system call 679 * @throws { BusinessError } 13900005 - I/O error 680 * @throws { BusinessError } 13900008 - Bad file descriptor 681 * @throws { BusinessError } 13900025 - No space left on device 682 * @throws { BusinessError } 13900041 - Quota exceeded 683 * @throws { BusinessError } 13900042 - Unknown error 684 * @syscap SystemCapability.FileManagement.File.FileIO 685 * @since 9 686 */ 687/** 688 * Close file or fd. 689 * 690 * @param { number | File } file - file object or fd. 691 * @returns { Promise<void> } The promise returned by the function. 692 * @throws { BusinessError } 13900004 - Interrupted system call 693 * @throws { BusinessError } 13900005 - I/O error 694 * @throws { BusinessError } 13900008 - Bad file descriptor 695 * @throws { BusinessError } 13900025 - No space left on device 696 * @throws { BusinessError } 13900041 - Quota exceeded 697 * @throws { BusinessError } 13900042 - Unknown error 698 * @syscap SystemCapability.FileManagement.File.FileIO 699 * @crossplatform 700 * @since 10 701 */ 702/** 703 * Close file or fd. 704 * 705 * @param { number | File } file - file object or fd. 706 * @returns { Promise<void> } The promise returned by the function. 707 * @throws { BusinessError } 13900004 - Interrupted system call 708 * @throws { BusinessError } 13900005 - I/O error 709 * @throws { BusinessError } 13900008 - Bad file descriptor 710 * @throws { BusinessError } 13900025 - No space left on device 711 * @throws { BusinessError } 13900041 - Quota exceeded 712 * @throws { BusinessError } 13900042 - Unknown error 713 * @syscap SystemCapability.FileManagement.File.FileIO 714 * @crossplatform 715 * @atomicservice 716 * @since 11 717 */ 718declare function close(file: number | File): Promise<void>; 719 720/** 721 * Close file or fd. 722 * 723 * @param { number | File } file - file object or fd. 724 * @param { AsyncCallback<void> } callback - Return the callback function. 725 * @throws { BusinessError } 13900004 - Interrupted system call 726 * @throws { BusinessError } 13900005 - I/O error 727 * @throws { BusinessError } 13900008 - Bad file descriptor 728 * @throws { BusinessError } 13900025 - No space left on device 729 * @throws { BusinessError } 13900041 - Quota exceeded 730 * @throws { BusinessError } 13900042 - Unknown error 731 * @syscap SystemCapability.FileManagement.File.FileIO 732 * @since 9 733 */ 734/** 735 * Close file or fd. 736 * 737 * @param { number | File } file - file object or fd. 738 * @param { AsyncCallback<void> } callback - Return the callback function. 739 * @throws { BusinessError } 13900004 - Interrupted system call 740 * @throws { BusinessError } 13900005 - I/O error 741 * @throws { BusinessError } 13900008 - Bad file descriptor 742 * @throws { BusinessError } 13900025 - No space left on device 743 * @throws { BusinessError } 13900041 - Quota exceeded 744 * @throws { BusinessError } 13900042 - Unknown error 745 * @syscap SystemCapability.FileManagement.File.FileIO 746 * @crossplatform 747 * @since 10 748 */ 749/** 750 * Close file or fd. 751 * 752 * @param { number | File } file - file object or fd. 753 * @param { AsyncCallback<void> } callback - Return the callback function. 754 * @throws { BusinessError } 13900004 - Interrupted system call 755 * @throws { BusinessError } 13900005 - I/O error 756 * @throws { BusinessError } 13900008 - Bad file descriptor 757 * @throws { BusinessError } 13900025 - No space left on device 758 * @throws { BusinessError } 13900041 - Quota exceeded 759 * @throws { BusinessError } 13900042 - Unknown error 760 * @syscap SystemCapability.FileManagement.File.FileIO 761 * @crossplatform 762 * @atomicservice 763 * @since 11 764 */ 765declare function close(file: number | File, callback: AsyncCallback<void>): void; 766 767/** 768 * Close file or fd with sync interface. 769 * 770 * @param { number | File } file - file object or fd. 771 * @throws { BusinessError } 13900004 - Interrupted system call 772 * @throws { BusinessError } 13900005 - I/O error 773 * @throws { BusinessError } 13900008 - Bad file descriptor 774 * @throws { BusinessError } 13900025 - No space left on device 775 * @throws { BusinessError } 13900041 - Quota exceeded 776 * @throws { BusinessError } 13900042 - Unknown error 777 * @syscap SystemCapability.FileManagement.File.FileIO 778 * @since 9 779 */ 780/** 781 * Close file or fd with sync interface. 782 * 783 * @param { number | File } file - file object or fd. 784 * @throws { BusinessError } 13900004 - Interrupted system call 785 * @throws { BusinessError } 13900005 - I/O error 786 * @throws { BusinessError } 13900008 - Bad file descriptor 787 * @throws { BusinessError } 13900025 - No space left on device 788 * @throws { BusinessError } 13900041 - Quota exceeded 789 * @throws { BusinessError } 13900042 - Unknown error 790 * @syscap SystemCapability.FileManagement.File.FileIO 791 * @crossplatform 792 * @since 10 793 */ 794/** 795 * Close file or fd with sync interface. 796 * 797 * @param { number | File } file - file object or fd. 798 * @throws { BusinessError } 13900004 - Interrupted system call 799 * @throws { BusinessError } 13900005 - I/O error 800 * @throws { BusinessError } 13900008 - Bad file descriptor 801 * @throws { BusinessError } 13900025 - No space left on device 802 * @throws { BusinessError } 13900041 - Quota exceeded 803 * @throws { BusinessError } 13900042 - Unknown error 804 * @syscap SystemCapability.FileManagement.File.FileIO 805 * @crossplatform 806 * @atomicservice 807 * @since 11 808 */ 809declare function closeSync(file: number | File): void; 810 811/** 812 * Copy file or directory. 813 * 814 * @param { string } srcUri - src uri. 815 * @param { string } destUri - dest uri. 816 * @param { CopyOptions } [options] - options. 817 * @returns { Promise<void> } The promise returned by the function. 818 * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 819 * <br>2.Incorrect parameter types. 820 * @throws { BusinessError } 13900001 - Operation not permitted 821 * @throws { BusinessError } 13900002 - No such file or directory 822 * @throws { BusinessError } 13900004 - Interrupted system call 823 * @throws { BusinessError } 13900005 - I/O error 824 * @throws { BusinessError } 13900008 - Bad file descriptor 825 * @throws { BusinessError } 13900010 - Try again 826 * @throws { BusinessError } 13900011 - Out of memory 827 * @throws { BusinessError } 13900012 - Permission denied by the file system 828 * @throws { BusinessError } 13900015 - File exists 829 * @throws { BusinessError } 13900018 - Not a directory 830 * @throws { BusinessError } 13900019 - Is a directory 831 * @throws { BusinessError } 13900020 - Invalid argument 832 * @throws { BusinessError } 13900021 - File table overflow 833 * @throws { BusinessError } 13900022 - Too many open files 834 * @throws { BusinessError } 13900024 - File too large 835 * @throws { BusinessError } 13900025 - No space left on device 836 * @throws { BusinessError } 13900027 - Read-only file system 837 * @throws { BusinessError } 13900028 - Too many links 838 * @throws { BusinessError } 13900030 - File name too long 839 * @throws { BusinessError } 13900031 - Function not implemented 840 * @throws { BusinessError } 13900034 - Operation would block 841 * @throws { BusinessError } 13900038 - Value too large for defined data type 842 * @throws { BusinessError } 13900041 - Quota exceeded 843 * @throws { BusinessError } 13900042 - Unknown error 844 * @syscap SystemCapability.FileManagement.File.FileIO 845 * @since 11 846 */ 847/** 848 * Copy file or directory. 849 * 850 * @param { string } srcUri - src uri. 851 * @param { string } destUri - dest uri. 852 * @param { CopyOptions } [options] - options. 853 * @returns { Promise<void> } The promise returned by the function. 854 * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 855 * <br>2.Incorrect parameter types. 856 * @throws { BusinessError } 13900001 - Operation not permitted 857 * @throws { BusinessError } 13900002 - No such file or directory 858 * @throws { BusinessError } 13900004 - Interrupted system call 859 * @throws { BusinessError } 13900005 - I/O error 860 * @throws { BusinessError } 13900008 - Bad file descriptor 861 * @throws { BusinessError } 13900010 - Try again 862 * @throws { BusinessError } 13900011 - Out of memory 863 * @throws { BusinessError } 13900012 - Permission denied by the file system 864 * @throws { BusinessError } 13900015 - File exists 865 * @throws { BusinessError } 13900018 - Not a directory 866 * @throws { BusinessError } 13900019 - Is a directory 867 * @throws { BusinessError } 13900020 - Invalid argument 868 * @throws { BusinessError } 13900021 - File table overflow 869 * @throws { BusinessError } 13900022 - Too many open files 870 * @throws { BusinessError } 13900024 - File too large 871 * @throws { BusinessError } 13900025 - No space left on device 872 * @throws { BusinessError } 13900027 - Read-only file system 873 * @throws { BusinessError } 13900028 - Too many links 874 * @throws { BusinessError } 13900030 - File name too long 875 * @throws { BusinessError } 13900031 - Function not implemented 876 * @throws { BusinessError } 13900034 - Operation would block 877 * @throws { BusinessError } 13900038 - Value too large for defined data type 878 * @throws { BusinessError } 13900041 - Quota exceeded 879 * @throws { BusinessError } 13900042 - Unknown error 880 * @throws { BusinessError } 13900044 - Network is unreachable 881 * @syscap SystemCapability.FileManagement.File.FileIO 882 * @since 12 883 */ 884declare function copy(srcUri: string, destUri: string, options?: CopyOptions): Promise<void>; 885 886/** 887 * Copy file or directory. 888 * 889 * @param { string } srcUri - src uri. 890 * @param { string } destUri - dest uri. 891 * @param { AsyncCallback<void> } callback - Return the callback function. 892 * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 893 * <br>2.Incorrect parameter types. 894 * @throws { BusinessError } 13900001 - Operation not permitted 895 * @throws { BusinessError } 13900002 - No such file or directory 896 * @throws { BusinessError } 13900004 - Interrupted system call 897 * @throws { BusinessError } 13900005 - I/O error 898 * @throws { BusinessError } 13900008 - Bad file descriptor 899 * @throws { BusinessError } 13900010 - Try again 900 * @throws { BusinessError } 13900011 - Out of memory 901 * @throws { BusinessError } 13900012 - Permission denied by the file system 902 * @throws { BusinessError } 13900015 - File exists 903 * @throws { BusinessError } 13900018 - Not a directory 904 * @throws { BusinessError } 13900019 - Is a directory 905 * @throws { BusinessError } 13900020 - Invalid argument 906 * @throws { BusinessError } 13900021 - File table overflow 907 * @throws { BusinessError } 13900022 - Too many open files 908 * @throws { BusinessError } 13900024 - File too large 909 * @throws { BusinessError } 13900025 - No space left on device 910 * @throws { BusinessError } 13900027 - Read-only file system 911 * @throws { BusinessError } 13900028 - Too many links 912 * @throws { BusinessError } 13900030 - File name too long 913 * @throws { BusinessError } 13900031 - Function not implemented 914 * @throws { BusinessError } 13900034 - Operation would block 915 * @throws { BusinessError } 13900038 - Value too large for defined data type 916 * @throws { BusinessError } 13900041 - Quota exceeded 917 * @throws { BusinessError } 13900042 - Unknown error 918 * @syscap SystemCapability.FileManagement.File.FileIO 919 * @since 11 920 */ 921declare function copy(srcUri: string, destUri: string, callback: AsyncCallback<void>): void; 922 923/** 924 * Copy file or directory. 925 * 926 * @param { string } srcUri - src uri. 927 * @param { string } destUri - dest uri. 928 * @param { CopyOptions } options - options. 929 * @param { AsyncCallback<void> } callback - Return the callback function. 930 * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 931 * <br>2.Incorrect parameter types. 932 * @throws { BusinessError } 13900001 - Operation not permitted 933 * @throws { BusinessError } 13900002 - No such file or directory 934 * @throws { BusinessError } 13900004 - Interrupted system call 935 * @throws { BusinessError } 13900005 - I/O error 936 * @throws { BusinessError } 13900008 - Bad file descriptor 937 * @throws { BusinessError } 13900010 - Try again 938 * @throws { BusinessError } 13900011 - Out of memory 939 * @throws { BusinessError } 13900012 - Permission denied by the file system 940 * @throws { BusinessError } 13900015 - File exists 941 * @throws { BusinessError } 13900018 - Not a directory 942 * @throws { BusinessError } 13900019 - Is a directory 943 * @throws { BusinessError } 13900020 - Invalid argument 944 * @throws { BusinessError } 13900021 - File table overflow 945 * @throws { BusinessError } 13900022 - Too many open files 946 * @throws { BusinessError } 13900024 - File too large 947 * @throws { BusinessError } 13900025 - No space left on device 948 * @throws { BusinessError } 13900027 - Read-only file system 949 * @throws { BusinessError } 13900028 - Too many links 950 * @throws { BusinessError } 13900030 - File name too long 951 * @throws { BusinessError } 13900031 - Function not implemented 952 * @throws { BusinessError } 13900034 - Operation would block 953 * @throws { BusinessError } 13900038 - Value too large for defined data type 954 * @throws { BusinessError } 13900041 - Quota exceeded 955 * @throws { BusinessError } 13900042 - Unknown error 956 * @syscap SystemCapability.FileManagement.File.FileIO 957 * @since 11 958 */ 959declare function copy(srcUri: string, destUri: string, options: CopyOptions, callback: AsyncCallback<void>): void; 960 961/** 962 * Copy directory. 963 * 964 * @param { string } src - source path. 965 * @param { string } dest - destination path. 966 * @param { number } [mode = 0] - mode. 967 * @returns { Promise<void> } The promise returned by the function. 968 * @throws { BusinessError } 13900002 - No such file or directory 969 * @throws { BusinessError } 13900004 - Interrupted system call 970 * @throws { BusinessError } 13900005 - I/O error 971 * @throws { BusinessError } 13900008 - Bad file descriptor 972 * @throws { BusinessError } 13900010 - Try again 973 * @throws { BusinessError } 13900011 - Out of memory 974 * @throws { BusinessError } 13900012 - Permission denied 975 * @throws { BusinessError } 13900013 - Bad address 976 * @throws { BusinessError } 13900018 - Not a directory 977 * @throws { BusinessError } 13900019 - Is a directory 978 * @throws { BusinessError } 13900020 - Invalid argument 979 * @throws { BusinessError } 13900030 - File name too long 980 * @throws { BusinessError } 13900031 - Function not implemented 981 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 982 * @throws { BusinessError } 13900034 - Operation would block 983 * @throws { BusinessError } 13900038 - Value too large for defined data type 984 * @throws { BusinessError } 13900042 - Unknown error 985 * @syscap SystemCapability.FileManagement.File.FileIO 986 * @since 10 987 */ 988/** 989 * Copy directory. 990 * 991 * @param { string } src - source path. 992 * @param { string } dest - destination path. 993 * @param { number } [mode = 0] - mode. 994 * @returns { Promise<void> } The promise returned by the function. 995 * @throws { BusinessError } 13900002 - No such file or directory 996 * @throws { BusinessError } 13900004 - Interrupted system call 997 * @throws { BusinessError } 13900005 - I/O error 998 * @throws { BusinessError } 13900008 - Bad file descriptor 999 * @throws { BusinessError } 13900010 - Try again 1000 * @throws { BusinessError } 13900011 - Out of memory 1001 * @throws { BusinessError } 13900012 - Permission denied 1002 * @throws { BusinessError } 13900013 - Bad address 1003 * @throws { BusinessError } 13900018 - Not a directory 1004 * @throws { BusinessError } 13900019 - Is a directory 1005 * @throws { BusinessError } 13900020 - Invalid argument 1006 * @throws { BusinessError } 13900030 - File name too long 1007 * @throws { BusinessError } 13900031 - Function not implemented 1008 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 1009 * @throws { BusinessError } 13900034 - Operation would block 1010 * @throws { BusinessError } 13900038 - Value too large for defined data type 1011 * @throws { BusinessError } 13900042 - Unknown error 1012 * @throws { BusinessError } 13900044 - Network is unreachable 1013 * @syscap SystemCapability.FileManagement.File.FileIO 1014 * @since 12 1015 */ 1016declare function copyDir(src: string, dest: string, mode?: number): Promise<void>; 1017 1018/** 1019 * Copy directory. 1020 * 1021 * @param { string } src - source path. 1022 * @param { string } dest - destination path. 1023 * @param { AsyncCallback<void> } callback - Return the callback function. 1024 * @throws { BusinessError } 13900002 - No such file or directory 1025 * @throws { BusinessError } 13900004 - Interrupted system call 1026 * @throws { BusinessError } 13900005 - I/O error 1027 * @throws { BusinessError } 13900008 - Bad file descriptor 1028 * @throws { BusinessError } 13900010 - Try again 1029 * @throws { BusinessError } 13900011 - Out of memory 1030 * @throws { BusinessError } 13900012 - Permission denied 1031 * @throws { BusinessError } 13900013 - Bad address 1032 * @throws { BusinessError } 13900018 - Not a directory 1033 * @throws { BusinessError } 13900019 - Is a directory 1034 * @throws { BusinessError } 13900020 - Invalid argument 1035 * @throws { BusinessError } 13900030 - File name too long 1036 * @throws { BusinessError } 13900031 - Function not implemented 1037 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 1038 * @throws { BusinessError } 13900034 - Operation would block 1039 * @throws { BusinessError } 13900038 - Value too large for defined data type 1040 * @throws { BusinessError } 13900042 - Unknown error 1041 * @syscap SystemCapability.FileManagement.File.FileIO 1042 * @since 10 1043 */ 1044declare function copyDir(src: string, dest: string, callback: AsyncCallback<void>): void; 1045 1046/** 1047 * Copy directory. 1048 * 1049 * @param { string } src - source path. 1050 * @param { string } dest - destination path. 1051 * @param { AsyncCallback<void, Array<ConflictFiles>> } callback - Return the callback function. 1052 * @throws { BusinessError } 13900015 - File exists 1053 * @syscap SystemCapability.FileManagement.File.FileIO 1054 * @since 10 1055 */ 1056declare function copyDir(src: string, dest: string, callback: AsyncCallback<void, Array<ConflictFiles>>): void; 1057 1058 1059/** 1060 * Copy directory. 1061 * 1062 * @param { string } src - source path. 1063 * @param { string } dest - destination path. 1064 * @param { number } mode - mode. 1065 * @param { AsyncCallback<void> } callback - Return the callback function. 1066 * @throws { BusinessError } 13900002 - No such file or directory 1067 * @throws { BusinessError } 13900004 - Interrupted system call 1068 * @throws { BusinessError } 13900005 - I/O error 1069 * @throws { BusinessError } 13900008 - Bad file descriptor 1070 * @throws { BusinessError } 13900010 - Try again 1071 * @throws { BusinessError } 13900011 - Out of memory 1072 * @throws { BusinessError } 13900012 - Permission denied 1073 * @throws { BusinessError } 13900013 - Bad address 1074 * @throws { BusinessError } 13900018 - Not a directory 1075 * @throws { BusinessError } 13900019 - Is a directory 1076 * @throws { BusinessError } 13900020 - Invalid argument 1077 * @throws { BusinessError } 13900030 - File name too long 1078 * @throws { BusinessError } 13900031 - Function not implemented 1079 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 1080 * @throws { BusinessError } 13900034 - Operation would block 1081 * @throws { BusinessError } 13900038 - Value too large for defined data type 1082 * @throws { BusinessError } 13900042 - Unknown error 1083 * @syscap SystemCapability.FileManagement.File.FileIO 1084 * @since 10 1085 */ 1086declare function copyDir(src: string, dest: string, mode: number, callback: AsyncCallback<void>): void; 1087 1088/** 1089 * Copy directory. 1090 * 1091 * @param { string } src - source path. 1092 * @param { string } dest - destination path. 1093 * @param { number } mode - mode. 1094 * @param { AsyncCallback<void, Array<ConflictFiles>> } callback - Return the callback function. 1095 * @throws { BusinessError } 13900015 - File exists 1096 * @syscap SystemCapability.FileManagement.File.FileIO 1097 * @since 10 1098 */ 1099declare function copyDir(src: string, dest: string, mode: number, callback: AsyncCallback<void, Array<ConflictFiles>>): void; 1100 1101/** 1102 * Copy directory with sync interface. 1103 * 1104 * @param { string } src - source path. 1105 * @param { string } dest - destination path. 1106 * @param { number } [mode = 0] - mode. 1107 * @throws { BusinessError } 13900002 - No such file or directory 1108 * @throws { BusinessError } 13900004 - Interrupted system call 1109 * @throws { BusinessError } 13900005 - I/O error 1110 * @throws { BusinessError } 13900008 - Bad file descriptor 1111 * @throws { BusinessError } 13900010 - Try again 1112 * @throws { BusinessError } 13900011 - Out of memory 1113 * @throws { BusinessError } 13900012 - Permission denied 1114 * @throws { BusinessError } 13900013 - Bad address 1115 * @throws { BusinessError } 13900015 - File exists 1116 * @throws { BusinessError } 13900018 - Not a directory 1117 * @throws { BusinessError } 13900019 - Is a directory 1118 * @throws { BusinessError } 13900020 - Invalid argument 1119 * @throws { BusinessError } 13900030 - File name too long 1120 * @throws { BusinessError } 13900031 - Function not implemented 1121 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 1122 * @throws { BusinessError } 13900034 - Operation would block 1123 * @throws { BusinessError } 13900038 - Value too large for defined data type 1124 * @throws { BusinessError } 13900042 - Unknown error 1125 * @syscap SystemCapability.FileManagement.File.FileIO 1126 * @since 10 1127 */ 1128/** 1129 * Copy directory with sync interface. 1130 * 1131 * @param { string } src - source path. 1132 * @param { string } dest - destination path. 1133 * @param { number } [mode = 0] - mode. 1134 * @throws { BusinessError } 13900002 - No such file or directory 1135 * @throws { BusinessError } 13900004 - Interrupted system call 1136 * @throws { BusinessError } 13900005 - I/O error 1137 * @throws { BusinessError } 13900008 - Bad file descriptor 1138 * @throws { BusinessError } 13900010 - Try again 1139 * @throws { BusinessError } 13900011 - Out of memory 1140 * @throws { BusinessError } 13900012 - Permission denied 1141 * @throws { BusinessError } 13900013 - Bad address 1142 * @throws { BusinessError } 13900015 - File exists 1143 * @throws { BusinessError } 13900018 - Not a directory 1144 * @throws { BusinessError } 13900019 - Is a directory 1145 * @throws { BusinessError } 13900020 - Invalid argument 1146 * @throws { BusinessError } 13900030 - File name too long 1147 * @throws { BusinessError } 13900031 - Function not implemented 1148 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 1149 * @throws { BusinessError } 13900034 - Operation would block 1150 * @throws { BusinessError } 13900038 - Value too large for defined data type 1151 * @throws { BusinessError } 13900042 - Unknown error 1152 * @throws { BusinessError } 13900044 - Network is unreachable 1153 * @syscap SystemCapability.FileManagement.File.FileIO 1154 * @since 12 1155 */ 1156declare function copyDirSync(src: string, dest: string, mode?: number): void; 1157 1158/** 1159 * Copy file. 1160 * 1161 * @param { string | number } src - src. 1162 * @param { string | number } dest - dest. 1163 * @param { number } [mode = 0] - mode. 1164 * @returns { Promise<void> } The promise returned by the function. 1165 * @throws { BusinessError } 13900002 - No such file or directory 1166 * @throws { BusinessError } 13900004 - Interrupted system call 1167 * @throws { BusinessError } 13900005 - I/O error 1168 * @throws { BusinessError } 13900008 - Bad file descriptor 1169 * @throws { BusinessError } 13900010 - Try again 1170 * @throws { BusinessError } 13900011 - Out of memory 1171 * @throws { BusinessError } 13900012 - Permission denied 1172 * @throws { BusinessError } 13900013 - Bad address 1173 * @throws { BusinessError } 13900018 - Not a directory 1174 * @throws { BusinessError } 13900019 - Is a directory 1175 * @throws { BusinessError } 13900020 - Invalid argument 1176 * @throws { BusinessError } 13900030 - File name too long 1177 * @throws { BusinessError } 13900031 - Function not implemented 1178 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 1179 * @throws { BusinessError } 13900034 - Operation would block 1180 * @throws { BusinessError } 13900038 - Value too large for defined data type 1181 * @throws { BusinessError } 13900042 - Unknown error 1182 * @syscap SystemCapability.FileManagement.File.FileIO 1183 * @since 9 1184 */ 1185/** 1186 * Copy file. 1187 * 1188 * @param { string | number } src - src. 1189 * @param { string | number } dest - dest. 1190 * @param { number } [mode = 0] - mode. 1191 * @returns { Promise<void> } The promise returned by the function. 1192 * @throws { BusinessError } 13900002 - No such file or directory 1193 * @throws { BusinessError } 13900004 - Interrupted system call 1194 * @throws { BusinessError } 13900005 - I/O error 1195 * @throws { BusinessError } 13900008 - Bad file descriptor 1196 * @throws { BusinessError } 13900010 - Try again 1197 * @throws { BusinessError } 13900011 - Out of memory 1198 * @throws { BusinessError } 13900012 - Permission denied 1199 * @throws { BusinessError } 13900013 - Bad address 1200 * @throws { BusinessError } 13900018 - Not a directory 1201 * @throws { BusinessError } 13900019 - Is a directory 1202 * @throws { BusinessError } 13900020 - Invalid argument 1203 * @throws { BusinessError } 13900030 - File name too long 1204 * @throws { BusinessError } 13900031 - Function not implemented 1205 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 1206 * @throws { BusinessError } 13900034 - Operation would block 1207 * @throws { BusinessError } 13900038 - Value too large for defined data type 1208 * @throws { BusinessError } 13900042 - Unknown error 1209 * @syscap SystemCapability.FileManagement.File.FileIO 1210 * @crossplatform 1211 * @since 10 1212 */ 1213/** 1214 * Copy file. 1215 * 1216 * @param { string | number } src - src. 1217 * @param { string | number } dest - dest. 1218 * @param { number } [mode = 0] - mode. 1219 * @returns { Promise<void> } The promise returned by the function. 1220 * @throws { BusinessError } 13900002 - No such file or directory 1221 * @throws { BusinessError } 13900004 - Interrupted system call 1222 * @throws { BusinessError } 13900005 - I/O error 1223 * @throws { BusinessError } 13900008 - Bad file descriptor 1224 * @throws { BusinessError } 13900010 - Try again 1225 * @throws { BusinessError } 13900011 - Out of memory 1226 * @throws { BusinessError } 13900012 - Permission denied 1227 * @throws { BusinessError } 13900013 - Bad address 1228 * @throws { BusinessError } 13900018 - Not a directory 1229 * @throws { BusinessError } 13900019 - Is a directory 1230 * @throws { BusinessError } 13900020 - Invalid argument 1231 * @throws { BusinessError } 13900030 - File name too long 1232 * @throws { BusinessError } 13900031 - Function not implemented 1233 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 1234 * @throws { BusinessError } 13900034 - Operation would block 1235 * @throws { BusinessError } 13900038 - Value too large for defined data type 1236 * @throws { BusinessError } 13900042 - Unknown error 1237 * @syscap SystemCapability.FileManagement.File.FileIO 1238 * @crossplatform 1239 * @atomicservice 1240 * @since 11 1241 */ 1242/** 1243 * Copy file. 1244 * 1245 * @param { string | number } src - src. 1246 * @param { string | number } dest - dest. 1247 * @param { number } [mode = 0] - mode. 1248 * @returns { Promise<void> } The promise returned by the function. 1249 * @throws { BusinessError } 13900002 - No such file or directory 1250 * @throws { BusinessError } 13900004 - Interrupted system call 1251 * @throws { BusinessError } 13900005 - I/O error 1252 * @throws { BusinessError } 13900008 - Bad file descriptor 1253 * @throws { BusinessError } 13900010 - Try again 1254 * @throws { BusinessError } 13900011 - Out of memory 1255 * @throws { BusinessError } 13900012 - Permission denied 1256 * @throws { BusinessError } 13900013 - Bad address 1257 * @throws { BusinessError } 13900018 - Not a directory 1258 * @throws { BusinessError } 13900019 - Is a directory 1259 * @throws { BusinessError } 13900020 - Invalid argument 1260 * @throws { BusinessError } 13900030 - File name too long 1261 * @throws { BusinessError } 13900031 - Function not implemented 1262 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 1263 * @throws { BusinessError } 13900034 - Operation would block 1264 * @throws { BusinessError } 13900038 - Value too large for defined data type 1265 * @throws { BusinessError } 13900042 - Unknown error 1266 * @throws { BusinessError } 13900044 - Network is unreachable 1267 * @syscap SystemCapability.FileManagement.File.FileIO 1268 * @crossplatform 1269 * @atomicservice 1270 * @since 12 1271 */ 1272declare function copyFile(src: string | number, dest: string | number, mode?: number): Promise<void>; 1273 1274/** 1275 * Copy file. 1276 * 1277 * @param { string | number } src - src. 1278 * @param { string | number } dest - dest. 1279 * @param { AsyncCallback<void> } callback - Return the callback function. 1280 * @throws { BusinessError } 13900002 - No such file or directory 1281 * @throws { BusinessError } 13900004 - Interrupted system call 1282 * @throws { BusinessError } 13900005 - I/O error 1283 * @throws { BusinessError } 13900008 - Bad file descriptor 1284 * @throws { BusinessError } 13900010 - Try again 1285 * @throws { BusinessError } 13900011 - Out of memory 1286 * @throws { BusinessError } 13900012 - Permission denied 1287 * @throws { BusinessError } 13900013 - Bad address 1288 * @throws { BusinessError } 13900018 - Not a directory 1289 * @throws { BusinessError } 13900019 - Is a directory 1290 * @throws { BusinessError } 13900020 - Invalid argument 1291 * @throws { BusinessError } 13900030 - File name too long 1292 * @throws { BusinessError } 13900031 - Function not implemented 1293 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 1294 * @throws { BusinessError } 13900034 - Operation would block 1295 * @throws { BusinessError } 13900038 - Value too large for defined data type 1296 * @throws { BusinessError } 13900042 - Unknown error 1297 * @syscap SystemCapability.FileManagement.File.FileIO 1298 * @since 9 1299 */ 1300/** 1301 * Copy file. 1302 * 1303 * @param { string | number } src - src. 1304 * @param { string | number } dest - dest. 1305 * @param { AsyncCallback<void> } callback - Return the callback function. 1306 * @throws { BusinessError } 13900002 - No such file or directory 1307 * @throws { BusinessError } 13900004 - Interrupted system call 1308 * @throws { BusinessError } 13900005 - I/O error 1309 * @throws { BusinessError } 13900008 - Bad file descriptor 1310 * @throws { BusinessError } 13900010 - Try again 1311 * @throws { BusinessError } 13900011 - Out of memory 1312 * @throws { BusinessError } 13900012 - Permission denied 1313 * @throws { BusinessError } 13900013 - Bad address 1314 * @throws { BusinessError } 13900018 - Not a directory 1315 * @throws { BusinessError } 13900019 - Is a directory 1316 * @throws { BusinessError } 13900020 - Invalid argument 1317 * @throws { BusinessError } 13900030 - File name too long 1318 * @throws { BusinessError } 13900031 - Function not implemented 1319 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 1320 * @throws { BusinessError } 13900034 - Operation would block 1321 * @throws { BusinessError } 13900038 - Value too large for defined data type 1322 * @throws { BusinessError } 13900042 - Unknown error 1323 * @syscap SystemCapability.FileManagement.File.FileIO 1324 * @crossplatform 1325 * @since 10 1326 */ 1327/** 1328 * Copy file. 1329 * 1330 * @param { string | number } src - src. 1331 * @param { string | number } dest - dest. 1332 * @param { AsyncCallback<void> } callback - Return the callback function. 1333 * @throws { BusinessError } 13900002 - No such file or directory 1334 * @throws { BusinessError } 13900004 - Interrupted system call 1335 * @throws { BusinessError } 13900005 - I/O error 1336 * @throws { BusinessError } 13900008 - Bad file descriptor 1337 * @throws { BusinessError } 13900010 - Try again 1338 * @throws { BusinessError } 13900011 - Out of memory 1339 * @throws { BusinessError } 13900012 - Permission denied 1340 * @throws { BusinessError } 13900013 - Bad address 1341 * @throws { BusinessError } 13900018 - Not a directory 1342 * @throws { BusinessError } 13900019 - Is a directory 1343 * @throws { BusinessError } 13900020 - Invalid argument 1344 * @throws { BusinessError } 13900030 - File name too long 1345 * @throws { BusinessError } 13900031 - Function not implemented 1346 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 1347 * @throws { BusinessError } 13900034 - Operation would block 1348 * @throws { BusinessError } 13900038 - Value too large for defined data type 1349 * @throws { BusinessError } 13900042 - Unknown error 1350 * @syscap SystemCapability.FileManagement.File.FileIO 1351 * @crossplatform 1352 * @atomicservice 1353 * @since 11 1354 */ 1355declare function copyFile(src: string | number, dest: string | number, callback: AsyncCallback<void>): void; 1356 1357/** 1358 * Copy file. 1359 * 1360 * @param { string | number } src - src. 1361 * @param { string | number } dest - dest. 1362 * @param { number } [mode = 0] - mode. 1363 * @param { AsyncCallback<void> } callback - Return the callback function. 1364 * @throws { BusinessError } 13900002 - No such file or directory 1365 * @throws { BusinessError } 13900004 - Interrupted system call 1366 * @throws { BusinessError } 13900005 - I/O error 1367 * @throws { BusinessError } 13900008 - Bad file descriptor 1368 * @throws { BusinessError } 13900010 - Try again 1369 * @throws { BusinessError } 13900011 - Out of memory 1370 * @throws { BusinessError } 13900012 - Permission denied 1371 * @throws { BusinessError } 13900013 - Bad address 1372 * @throws { BusinessError } 13900018 - Not a directory 1373 * @throws { BusinessError } 13900019 - Is a directory 1374 * @throws { BusinessError } 13900020 - Invalid argument 1375 * @throws { BusinessError } 13900030 - File name too long 1376 * @throws { BusinessError } 13900031 - Function not implemented 1377 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 1378 * @throws { BusinessError } 13900034 - Operation would block 1379 * @throws { BusinessError } 13900038 - Value too large for defined data type 1380 * @throws { BusinessError } 13900042 - Unknown error 1381 * @syscap SystemCapability.FileManagement.File.FileIO 1382 * @since 9 1383 */ 1384/** 1385 * Copy file. 1386 * 1387 * @param { string | number } src - src. 1388 * @param { string | number } dest - dest. 1389 * @param { number } [mode = 0] - mode. 1390 * @param { AsyncCallback<void> } callback - Return the callback function. 1391 * @throws { BusinessError } 13900002 - No such file or directory 1392 * @throws { BusinessError } 13900004 - Interrupted system call 1393 * @throws { BusinessError } 13900005 - I/O error 1394 * @throws { BusinessError } 13900008 - Bad file descriptor 1395 * @throws { BusinessError } 13900010 - Try again 1396 * @throws { BusinessError } 13900011 - Out of memory 1397 * @throws { BusinessError } 13900012 - Permission denied 1398 * @throws { BusinessError } 13900013 - Bad address 1399 * @throws { BusinessError } 13900018 - Not a directory 1400 * @throws { BusinessError } 13900019 - Is a directory 1401 * @throws { BusinessError } 13900020 - Invalid argument 1402 * @throws { BusinessError } 13900030 - File name too long 1403 * @throws { BusinessError } 13900031 - Function not implemented 1404 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 1405 * @throws { BusinessError } 13900034 - Operation would block 1406 * @throws { BusinessError } 13900038 - Value too large for defined data type 1407 * @throws { BusinessError } 13900042 - Unknown error 1408 * @syscap SystemCapability.FileManagement.File.FileIO 1409 * @crossplatform 1410 * @since 10 1411 */ 1412/** 1413 * Copy file. 1414 * 1415 * @param { string | number } src - src. 1416 * @param { string | number } dest - dest. 1417 * @param { number } [mode = 0] - mode. 1418 * @param { AsyncCallback<void> } callback - Return the callback function. 1419 * @throws { BusinessError } 13900002 - No such file or directory 1420 * @throws { BusinessError } 13900004 - Interrupted system call 1421 * @throws { BusinessError } 13900005 - I/O error 1422 * @throws { BusinessError } 13900008 - Bad file descriptor 1423 * @throws { BusinessError } 13900010 - Try again 1424 * @throws { BusinessError } 13900011 - Out of memory 1425 * @throws { BusinessError } 13900012 - Permission denied 1426 * @throws { BusinessError } 13900013 - Bad address 1427 * @throws { BusinessError } 13900018 - Not a directory 1428 * @throws { BusinessError } 13900019 - Is a directory 1429 * @throws { BusinessError } 13900020 - Invalid argument 1430 * @throws { BusinessError } 13900030 - File name too long 1431 * @throws { BusinessError } 13900031 - Function not implemented 1432 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 1433 * @throws { BusinessError } 13900034 - Operation would block 1434 * @throws { BusinessError } 13900038 - Value too large for defined data type 1435 * @throws { BusinessError } 13900042 - Unknown error 1436 * @syscap SystemCapability.FileManagement.File.FileIO 1437 * @crossplatform 1438 * @atomicservice 1439 * @since 11 1440 */ 1441declare function copyFile( 1442 src: string | number, 1443 dest: string | number, 1444 mode: number, 1445 callback: AsyncCallback<void> 1446): void; 1447 1448/** 1449 * Copy file with sync interface. 1450 * 1451 * @param { string | number } src - src. 1452 * @param { string | number } dest - dest. 1453 * @param { number } [mode = 0] - mode. 1454 * @throws { BusinessError } 13900002 - No such file or directory 1455 * @throws { BusinessError } 13900004 - Interrupted system call 1456 * @throws { BusinessError } 13900005 - I/O error 1457 * @throws { BusinessError } 13900008 - Bad file descriptor 1458 * @throws { BusinessError } 13900010 - Try again 1459 * @throws { BusinessError } 13900011 - Out of memory 1460 * @throws { BusinessError } 13900012 - Permission denied 1461 * @throws { BusinessError } 13900013 - Bad address 1462 * @throws { BusinessError } 13900018 - Not a directory 1463 * @throws { BusinessError } 13900019 - Is a directory 1464 * @throws { BusinessError } 13900020 - Invalid argument 1465 * @throws { BusinessError } 13900030 - File name too long 1466 * @throws { BusinessError } 13900031 - Function not implemented 1467 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 1468 * @throws { BusinessError } 13900034 - Operation would block 1469 * @throws { BusinessError } 13900038 - Value too large for defined data type 1470 * @throws { BusinessError } 13900042 - Unknown error 1471 * @syscap SystemCapability.FileManagement.File.FileIO 1472 * @since 9 1473 */ 1474/** 1475 * Copy file with sync interface. 1476 * 1477 * @param { string | number } src - src. 1478 * @param { string | number } dest - dest. 1479 * @param { number } [mode = 0] - mode. 1480 * @throws { BusinessError } 13900002 - No such file or directory 1481 * @throws { BusinessError } 13900004 - Interrupted system call 1482 * @throws { BusinessError } 13900005 - I/O error 1483 * @throws { BusinessError } 13900008 - Bad file descriptor 1484 * @throws { BusinessError } 13900010 - Try again 1485 * @throws { BusinessError } 13900011 - Out of memory 1486 * @throws { BusinessError } 13900012 - Permission denied 1487 * @throws { BusinessError } 13900013 - Bad address 1488 * @throws { BusinessError } 13900018 - Not a directory 1489 * @throws { BusinessError } 13900019 - Is a directory 1490 * @throws { BusinessError } 13900020 - Invalid argument 1491 * @throws { BusinessError } 13900030 - File name too long 1492 * @throws { BusinessError } 13900031 - Function not implemented 1493 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 1494 * @throws { BusinessError } 13900034 - Operation would block 1495 * @throws { BusinessError } 13900038 - Value too large for defined data type 1496 * @throws { BusinessError } 13900042 - Unknown error 1497 * @syscap SystemCapability.FileManagement.File.FileIO 1498 * @crossplatform 1499 * @since 10 1500 */ 1501/** 1502 * Copy file with sync interface. 1503 * 1504 * @param { string | number } src - src. 1505 * @param { string | number } dest - dest. 1506 * @param { number } [mode = 0] - mode. 1507 * @throws { BusinessError } 13900002 - No such file or directory 1508 * @throws { BusinessError } 13900004 - Interrupted system call 1509 * @throws { BusinessError } 13900005 - I/O error 1510 * @throws { BusinessError } 13900008 - Bad file descriptor 1511 * @throws { BusinessError } 13900010 - Try again 1512 * @throws { BusinessError } 13900011 - Out of memory 1513 * @throws { BusinessError } 13900012 - Permission denied 1514 * @throws { BusinessError } 13900013 - Bad address 1515 * @throws { BusinessError } 13900018 - Not a directory 1516 * @throws { BusinessError } 13900019 - Is a directory 1517 * @throws { BusinessError } 13900020 - Invalid argument 1518 * @throws { BusinessError } 13900030 - File name too long 1519 * @throws { BusinessError } 13900031 - Function not implemented 1520 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 1521 * @throws { BusinessError } 13900034 - Operation would block 1522 * @throws { BusinessError } 13900038 - Value too large for defined data type 1523 * @throws { BusinessError } 13900042 - Unknown error 1524 * @syscap SystemCapability.FileManagement.File.FileIO 1525 * @crossplatform 1526 * @atomicservice 1527 * @since 11 1528 */ 1529/** 1530 * Copy file with sync interface. 1531 * 1532 * @param { string | number } src - src. 1533 * @param { string | number } dest - dest. 1534 * @param { number } [mode = 0] - mode. 1535 * @throws { BusinessError } 13900002 - No such file or directory 1536 * @throws { BusinessError } 13900004 - Interrupted system call 1537 * @throws { BusinessError } 13900005 - I/O error 1538 * @throws { BusinessError } 13900008 - Bad file descriptor 1539 * @throws { BusinessError } 13900010 - Try again 1540 * @throws { BusinessError } 13900011 - Out of memory 1541 * @throws { BusinessError } 13900012 - Permission denied 1542 * @throws { BusinessError } 13900013 - Bad address 1543 * @throws { BusinessError } 13900018 - Not a directory 1544 * @throws { BusinessError } 13900019 - Is a directory 1545 * @throws { BusinessError } 13900020 - Invalid argument 1546 * @throws { BusinessError } 13900030 - File name too long 1547 * @throws { BusinessError } 13900031 - Function not implemented 1548 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 1549 * @throws { BusinessError } 13900034 - Operation would block 1550 * @throws { BusinessError } 13900038 - Value too large for defined data type 1551 * @throws { BusinessError } 13900042 - Unknown error 1552 * @throws { BusinessError } 13900044 - Network is unreachable 1553 * @syscap SystemCapability.FileManagement.File.FileIO 1554 * @crossplatform 1555 * @atomicservice 1556 * @since 12 1557 */ 1558declare function copyFileSync(src: string | number, dest: string | number, mode?: number): void; 1559 1560/** 1561 * Create class Stream. 1562 * 1563 * @param { string } path - path. 1564 * @param { string } mode - mode. 1565 * @returns { Promise<Stream> } return Promise 1566 * @throws { BusinessError } 13900001 - Operation not permitted 1567 * @throws { BusinessError } 13900002 - No such file or directory 1568 * @throws { BusinessError } 13900004 - Interrupted system call 1569 * @throws { BusinessError } 13900006 - No such device or address 1570 * @throws { BusinessError } 13900008 - Bad file descriptor 1571 * @throws { BusinessError } 13900011 - Out of memory 1572 * @throws { BusinessError } 13900012 - Permission denied 1573 * @throws { BusinessError } 13900013 - Bad address 1574 * @throws { BusinessError } 13900014 - Device or resource busy 1575 * @throws { BusinessError } 13900015 - File exists 1576 * @throws { BusinessError } 13900017 - No such device 1577 * @throws { BusinessError } 13900018 - Not a directory 1578 * @throws { BusinessError } 13900019 - Is a directory 1579 * @throws { BusinessError } 13900020 - Invalid argument 1580 * @throws { BusinessError } 13900022 - Too many open files 1581 * @throws { BusinessError } 13900023 - Text file busy 1582 * @throws { BusinessError } 13900024 - File too large 1583 * @throws { BusinessError } 13900025 - No space left on device 1584 * @throws { BusinessError } 13900027 - Read-only file system 1585 * @throws { BusinessError } 13900029 - Resource deadlock would occur 1586 * @throws { BusinessError } 13900030 - File name too long 1587 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 1588 * @throws { BusinessError } 13900034 - Operation would block 1589 * @throws { BusinessError } 13900038 - Value too large for defined data type 1590 * @throws { BusinessError } 13900041 - Quota exceeded 1591 * @throws { BusinessError } 13900042 - Unknown error 1592 * @syscap SystemCapability.FileManagement.File.FileIO 1593 * @since 9 1594 */ 1595/** 1596 * Create class Stream. 1597 * 1598 * @param { string } path - path. 1599 * @param { string } mode - mode. 1600 * @returns { Promise<Stream> } return Promise 1601 * @throws { BusinessError } 13900001 - Operation not permitted 1602 * @throws { BusinessError } 13900002 - No such file or directory 1603 * @throws { BusinessError } 13900004 - Interrupted system call 1604 * @throws { BusinessError } 13900006 - No such device or address 1605 * @throws { BusinessError } 13900008 - Bad file descriptor 1606 * @throws { BusinessError } 13900011 - Out of memory 1607 * @throws { BusinessError } 13900012 - Permission denied 1608 * @throws { BusinessError } 13900013 - Bad address 1609 * @throws { BusinessError } 13900014 - Device or resource busy 1610 * @throws { BusinessError } 13900015 - File exists 1611 * @throws { BusinessError } 13900017 - No such device 1612 * @throws { BusinessError } 13900018 - Not a directory 1613 * @throws { BusinessError } 13900019 - Is a directory 1614 * @throws { BusinessError } 13900020 - Invalid argument 1615 * @throws { BusinessError } 13900022 - Too many open files 1616 * @throws { BusinessError } 13900023 - Text file busy 1617 * @throws { BusinessError } 13900024 - File too large 1618 * @throws { BusinessError } 13900025 - No space left on device 1619 * @throws { BusinessError } 13900027 - Read-only file system 1620 * @throws { BusinessError } 13900029 - Resource deadlock would occur 1621 * @throws { BusinessError } 13900030 - File name too long 1622 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 1623 * @throws { BusinessError } 13900034 - Operation would block 1624 * @throws { BusinessError } 13900038 - Value too large for defined data type 1625 * @throws { BusinessError } 13900041 - Quota exceeded 1626 * @throws { BusinessError } 13900042 - Unknown error 1627 * @throws { BusinessError } 13900044 - Network is unreachable 1628 * @syscap SystemCapability.FileManagement.File.FileIO 1629 * @since 12 1630 */ 1631declare function createStream(path: string, mode: string): Promise<Stream>; 1632 1633/** 1634 * Create class Stream. 1635 * 1636 * @param { string } path - path. 1637 * @param { string } mode - mode. 1638 * @param { AsyncCallback<Stream> } callback - callback. 1639 * @throws { BusinessError } 13900001 - Operation not permitted 1640 * @throws { BusinessError } 13900002 - No such file or directory 1641 * @throws { BusinessError } 13900004 - Interrupted system call 1642 * @throws { BusinessError } 13900006 - No such device or address 1643 * @throws { BusinessError } 13900008 - Bad file descriptor 1644 * @throws { BusinessError } 13900011 - Out of memory 1645 * @throws { BusinessError } 13900012 - Permission denied 1646 * @throws { BusinessError } 13900013 - Bad address 1647 * @throws { BusinessError } 13900014 - Device or resource busy 1648 * @throws { BusinessError } 13900015 - File exists 1649 * @throws { BusinessError } 13900017 - No such device 1650 * @throws { BusinessError } 13900018 - Not a directory 1651 * @throws { BusinessError } 13900019 - Is a directory 1652 * @throws { BusinessError } 13900020 - Invalid argument 1653 * @throws { BusinessError } 13900022 - Too many open files 1654 * @throws { BusinessError } 13900023 - Text file busy 1655 * @throws { BusinessError } 13900024 - File too large 1656 * @throws { BusinessError } 13900025 - No space left on device 1657 * @throws { BusinessError } 13900027 - Read-only file system 1658 * @throws { BusinessError } 13900029 - Resource deadlock would occur 1659 * @throws { BusinessError } 13900030 - File name too long 1660 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 1661 * @throws { BusinessError } 13900034 - Operation would block 1662 * @throws { BusinessError } 13900038 - Value too large for defined data type 1663 * @throws { BusinessError } 13900041 - Quota exceeded 1664 * @throws { BusinessError } 13900042 - Unknown error 1665 * @syscap SystemCapability.FileManagement.File.FileIO 1666 * @since 9 1667 */ 1668declare function createStream(path: string, mode: string, callback: AsyncCallback<Stream>): void; 1669 1670/** 1671 * Create class Stream with sync interface. 1672 * 1673 * @param { string } path - path. 1674 * @param { string } mode - mode. 1675 * @returns { Stream } createStream 1676 * @throws { BusinessError } 13900001 - Operation not permitted 1677 * @throws { BusinessError } 13900002 - No such file or directory 1678 * @throws { BusinessError } 13900004 - Interrupted system call 1679 * @throws { BusinessError } 13900006 - No such device or address 1680 * @throws { BusinessError } 13900008 - Bad file descriptor 1681 * @throws { BusinessError } 13900011 - Out of memory 1682 * @throws { BusinessError } 13900012 - Permission denied 1683 * @throws { BusinessError } 13900013 - Bad address 1684 * @throws { BusinessError } 13900014 - Device or resource busy 1685 * @throws { BusinessError } 13900015 - File exists 1686 * @throws { BusinessError } 13900017 - No such device 1687 * @throws { BusinessError } 13900018 - Not a directory 1688 * @throws { BusinessError } 13900019 - Is a directory 1689 * @throws { BusinessError } 13900020 - Invalid argument 1690 * @throws { BusinessError } 13900022 - Too many open files 1691 * @throws { BusinessError } 13900023 - Text file busy 1692 * @throws { BusinessError } 13900024 - File too large 1693 * @throws { BusinessError } 13900025 - No space left on device 1694 * @throws { BusinessError } 13900027 - Read-only file system 1695 * @throws { BusinessError } 13900029 - Resource deadlock would occur 1696 * @throws { BusinessError } 13900030 - File name too long 1697 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 1698 * @throws { BusinessError } 13900034 - Operation would block 1699 * @throws { BusinessError } 13900038 - Value too large for defined data type 1700 * @throws { BusinessError } 13900041 - Quota exceeded 1701 * @throws { BusinessError } 13900042 - Unknown error 1702 * @syscap SystemCapability.FileManagement.File.FileIO 1703 * @since 9 1704 */ 1705/** 1706 * Create class Stream with sync interface. 1707 * 1708 * @param { string } path - path. 1709 * @param { string } mode - mode. 1710 * @returns { Stream } createStream 1711 * @throws { BusinessError } 13900001 - Operation not permitted 1712 * @throws { BusinessError } 13900002 - No such file or directory 1713 * @throws { BusinessError } 13900004 - Interrupted system call 1714 * @throws { BusinessError } 13900006 - No such device or address 1715 * @throws { BusinessError } 13900008 - Bad file descriptor 1716 * @throws { BusinessError } 13900011 - Out of memory 1717 * @throws { BusinessError } 13900012 - Permission denied 1718 * @throws { BusinessError } 13900013 - Bad address 1719 * @throws { BusinessError } 13900014 - Device or resource busy 1720 * @throws { BusinessError } 13900015 - File exists 1721 * @throws { BusinessError } 13900017 - No such device 1722 * @throws { BusinessError } 13900018 - Not a directory 1723 * @throws { BusinessError } 13900019 - Is a directory 1724 * @throws { BusinessError } 13900020 - Invalid argument 1725 * @throws { BusinessError } 13900022 - Too many open files 1726 * @throws { BusinessError } 13900023 - Text file busy 1727 * @throws { BusinessError } 13900024 - File too large 1728 * @throws { BusinessError } 13900025 - No space left on device 1729 * @throws { BusinessError } 13900027 - Read-only file system 1730 * @throws { BusinessError } 13900029 - Resource deadlock would occur 1731 * @throws { BusinessError } 13900030 - File name too long 1732 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 1733 * @throws { BusinessError } 13900034 - Operation would block 1734 * @throws { BusinessError } 13900038 - Value too large for defined data type 1735 * @throws { BusinessError } 13900041 - Quota exceeded 1736 * @throws { BusinessError } 13900042 - Unknown error 1737 * @throws { BusinessError } 13900044 - Network is unreachable 1738 * @syscap SystemCapability.FileManagement.File.FileIO 1739 * @since 12 1740 */ 1741declare function createStreamSync(path: string, mode: string): Stream; 1742 1743 1744/** 1745 * Create class RandomAccessFile. 1746 * 1747 * @param { string | File } file - file path, object. 1748 * @param { number } [mode = OpenMode.READ_ONLY] - mode. 1749 * @returns { Promise<RandomAccessFile> } Returns the RandomAccessFile object which has been created in promise mode. 1750 * @throws { BusinessError } 13900001 - Operation not permitted 1751 * @throws { BusinessError } 13900002 - No such file or directory 1752 * @throws { BusinessError } 13900004 - Interrupted system call 1753 * @throws { BusinessError } 13900006 - No such device or address 1754 * @throws { BusinessError } 13900008 - Bad file descriptor 1755 * @throws { BusinessError } 13900011 - Out of memory 1756 * @throws { BusinessError } 13900012 - Permission denied 1757 * @throws { BusinessError } 13900013 - Bad address 1758 * @throws { BusinessError } 13900014 - Device or resource busy 1759 * @throws { BusinessError } 13900015 - File exists 1760 * @throws { BusinessError } 13900017 - No such device 1761 * @throws { BusinessError } 13900018 - Not a directory 1762 * @throws { BusinessError } 13900019 - Is a directory 1763 * @throws { BusinessError } 13900020 - Invalid argument 1764 * @throws { BusinessError } 13900022 - Too many open files 1765 * @throws { BusinessError } 13900023 - Text file busy 1766 * @throws { BusinessError } 13900024 - File too large 1767 * @throws { BusinessError } 13900025 - No space left on device 1768 * @throws { BusinessError } 13900027 - Read-only file system 1769 * @throws { BusinessError } 13900029 - Resource deadlock would occur 1770 * @throws { BusinessError } 13900030 - File name too long 1771 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 1772 * @throws { BusinessError } 13900034 - Operation would block 1773 * @throws { BusinessError } 13900038 - Value too large for defined data type 1774 * @throws { BusinessError } 13900041 - Quota exceeded 1775 * @throws { BusinessError } 13900042 - Unknown error 1776 * @syscap SystemCapability.FileManagement.File.FileIO 1777 * @since 10 1778 */ 1779/** 1780 * Create class RandomAccessFile. 1781 * 1782 * @param { string | File } file - file path, object. 1783 * @param { number } [mode = OpenMode.READ_ONLY] - mode. 1784 * @param { RandomAccessFileOptions } [options] - RandomAccessFile options 1785 * @returns { Promise<RandomAccessFile> } Returns the RandomAccessFile object which has been created in promise mode. 1786 * @throws { BusinessError } 13900001 - Operation not permitted 1787 * @throws { BusinessError } 13900002 - No such file or directory 1788 * @throws { BusinessError } 13900004 - Interrupted system call 1789 * @throws { BusinessError } 13900006 - No such device or address 1790 * @throws { BusinessError } 13900008 - Bad file descriptor 1791 * @throws { BusinessError } 13900011 - Out of memory 1792 * @throws { BusinessError } 13900012 - Permission denied 1793 * @throws { BusinessError } 13900013 - Bad address 1794 * @throws { BusinessError } 13900014 - Device or resource busy 1795 * @throws { BusinessError } 13900015 - File exists 1796 * @throws { BusinessError } 13900017 - No such device 1797 * @throws { BusinessError } 13900018 - Not a directory 1798 * @throws { BusinessError } 13900019 - Is a directory 1799 * @throws { BusinessError } 13900020 - Invalid argument 1800 * @throws { BusinessError } 13900022 - Too many open files 1801 * @throws { BusinessError } 13900023 - Text file busy 1802 * @throws { BusinessError } 13900024 - File too large 1803 * @throws { BusinessError } 13900025 - No space left on device 1804 * @throws { BusinessError } 13900027 - Read-only file system 1805 * @throws { BusinessError } 13900029 - Resource deadlock would occur 1806 * @throws { BusinessError } 13900030 - File name too long 1807 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 1808 * @throws { BusinessError } 13900034 - Operation would block 1809 * @throws { BusinessError } 13900038 - Value too large for defined data type 1810 * @throws { BusinessError } 13900041 - Quota exceeded 1811 * @throws { BusinessError } 13900042 - Unknown error 1812 * @throws { BusinessError } 13900044 - Network is unreachable 1813 * @syscap SystemCapability.FileManagement.File.FileIO 1814 * @since 12 1815 */ 1816declare function createRandomAccessFile(file: string | File, mode?: number, 1817 options?: RandomAccessFileOptions): Promise<RandomAccessFile>; 1818 1819/** 1820 * Create class RandomAccessFile. 1821 * 1822 * @param { string | File } file - file path, object. 1823 * @param { AsyncCallback<RandomAccessFile> } callback - The callback is used to return the RandomAccessFile object which has been created. 1824 * @throws { BusinessError } 13900001 - Operation not permitted 1825 * @throws { BusinessError } 13900002 - No such file or directory 1826 * @throws { BusinessError } 13900004 - Interrupted system call 1827 * @throws { BusinessError } 13900006 - No such device or address 1828 * @throws { BusinessError } 13900008 - Bad file descriptor 1829 * @throws { BusinessError } 13900011 - Out of memory 1830 * @throws { BusinessError } 13900012 - Permission denied 1831 * @throws { BusinessError } 13900013 - Bad address 1832 * @throws { BusinessError } 13900014 - Device or resource busy 1833 * @throws { BusinessError } 13900015 - File exists 1834 * @throws { BusinessError } 13900017 - No such device 1835 * @throws { BusinessError } 13900018 - Not a directory 1836 * @throws { BusinessError } 13900019 - Is a directory 1837 * @throws { BusinessError } 13900020 - Invalid argument 1838 * @throws { BusinessError } 13900022 - Too many open files 1839 * @throws { BusinessError } 13900023 - Text file busy 1840 * @throws { BusinessError } 13900024 - File too large 1841 * @throws { BusinessError } 13900025 - No space left on device 1842 * @throws { BusinessError } 13900027 - Read-only file system 1843 * @throws { BusinessError } 13900029 - Resource deadlock would occur 1844 * @throws { BusinessError } 13900030 - File name too long 1845 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 1846 * @throws { BusinessError } 13900034 - Operation would block 1847 * @throws { BusinessError } 13900038 - Value too large for defined data type 1848 * @throws { BusinessError } 13900041 - Quota exceeded 1849 * @throws { BusinessError } 13900042 - Unknown error 1850 * @syscap SystemCapability.FileManagement.File.FileIO 1851 * @since 10 1852 */ 1853declare function createRandomAccessFile(file: string | File, callback: AsyncCallback<RandomAccessFile>): void; 1854 1855/** 1856 * Create class RandomAccessFile. 1857 * 1858 * @param { string | File } file - file path, object. 1859 * @param { number } [mode = OpenMode.READ_ONLY] - mode. 1860 * @param { AsyncCallback<RandomAccessFile> } callback - The callback is used to return the RandomAccessFile object which has been created. 1861 * @throws { BusinessError } 13900001 - Operation not permitted 1862 * @throws { BusinessError } 13900002 - No such file or directory 1863 * @throws { BusinessError } 13900004 - Interrupted system call 1864 * @throws { BusinessError } 13900006 - No such device or address 1865 * @throws { BusinessError } 13900008 - Bad file descriptor 1866 * @throws { BusinessError } 13900011 - Out of memory 1867 * @throws { BusinessError } 13900012 - Permission denied 1868 * @throws { BusinessError } 13900013 - Bad address 1869 * @throws { BusinessError } 13900014 - Device or resource busy 1870 * @throws { BusinessError } 13900015 - File exists 1871 * @throws { BusinessError } 13900017 - No such device 1872 * @throws { BusinessError } 13900018 - Not a directory 1873 * @throws { BusinessError } 13900019 - Is a directory 1874 * @throws { BusinessError } 13900020 - Invalid argument 1875 * @throws { BusinessError } 13900022 - Too many open files 1876 * @throws { BusinessError } 13900023 - Text file busy 1877 * @throws { BusinessError } 13900024 - File too large 1878 * @throws { BusinessError } 13900025 - No space left on device 1879 * @throws { BusinessError } 13900027 - Read-only file system 1880 * @throws { BusinessError } 13900029 - Resource deadlock would occur 1881 * @throws { BusinessError } 13900030 - File name too long 1882 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 1883 * @throws { BusinessError } 13900034 - Operation would block 1884 * @throws { BusinessError } 13900038 - Value too large for defined data type 1885 * @throws { BusinessError } 13900041 - Quota exceeded 1886 * @throws { BusinessError } 13900042 - Unknown error 1887 * @syscap SystemCapability.FileManagement.File.FileIO 1888 * @since 10 1889 */ 1890declare function createRandomAccessFile(file: string | File, mode: number, callback: AsyncCallback<RandomAccessFile>): void; 1891 1892/** 1893 * Create class RandomAccessFile with sync interface. 1894 * 1895 * @param { string | File } file - file path, object. 1896 * @param { number } [mode = OpenMode.READ_ONLY] - mode. 1897 * @returns { RandomAccessFile } Returns the RandomAccessFile object which has been created. 1898 * @throws { BusinessError } 13900001 - Operation not permitted 1899 * @throws { BusinessError } 13900002 - No such file or directory 1900 * @throws { BusinessError } 13900004 - Interrupted system call 1901 * @throws { BusinessError } 13900006 - No such device or address 1902 * @throws { BusinessError } 13900008 - Bad file descriptor 1903 * @throws { BusinessError } 13900011 - Out of memory 1904 * @throws { BusinessError } 13900012 - Permission denied 1905 * @throws { BusinessError } 13900013 - Bad address 1906 * @throws { BusinessError } 13900014 - Device or resource busy 1907 * @throws { BusinessError } 13900015 - File exists 1908 * @throws { BusinessError } 13900017 - No such device 1909 * @throws { BusinessError } 13900018 - Not a directory 1910 * @throws { BusinessError } 13900019 - Is a directory 1911 * @throws { BusinessError } 13900020 - Invalid argument 1912 * @throws { BusinessError } 13900022 - Too many open files 1913 * @throws { BusinessError } 13900023 - Text file busy 1914 * @throws { BusinessError } 13900024 - File too large 1915 * @throws { BusinessError } 13900025 - No space left on device 1916 * @throws { BusinessError } 13900027 - Read-only file system 1917 * @throws { BusinessError } 13900029 - Resource deadlock would occur 1918 * @throws { BusinessError } 13900030 - File name too long 1919 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 1920 * @throws { BusinessError } 13900034 - Operation would block 1921 * @throws { BusinessError } 13900038 - Value too large for defined data type 1922 * @throws { BusinessError } 13900041 - Quota exceeded 1923 * @throws { BusinessError } 13900042 - Unknown error 1924 * @syscap SystemCapability.FileManagement.File.FileIO 1925 * @since 10 1926 */ 1927/** 1928 * Create class RandomAccessFile with sync interface. 1929 * 1930 * @param { string | File } file - file path, object. 1931 * @param { number } [mode = OpenMode.READ_ONLY] - mode. 1932 * @param { RandomAccessFileOptions } [options] - RandomAccessFile options 1933 * @returns { RandomAccessFile } Returns the RandomAccessFile object which has been created. 1934 * @throws { BusinessError } 13900001 - Operation not permitted 1935 * @throws { BusinessError } 13900002 - No such file or directory 1936 * @throws { BusinessError } 13900004 - Interrupted system call 1937 * @throws { BusinessError } 13900006 - No such device or address 1938 * @throws { BusinessError } 13900008 - Bad file descriptor 1939 * @throws { BusinessError } 13900011 - Out of memory 1940 * @throws { BusinessError } 13900012 - Permission denied 1941 * @throws { BusinessError } 13900013 - Bad address 1942 * @throws { BusinessError } 13900014 - Device or resource busy 1943 * @throws { BusinessError } 13900015 - File exists 1944 * @throws { BusinessError } 13900017 - No such device 1945 * @throws { BusinessError } 13900018 - Not a directory 1946 * @throws { BusinessError } 13900019 - Is a directory 1947 * @throws { BusinessError } 13900020 - Invalid argument 1948 * @throws { BusinessError } 13900022 - Too many open files 1949 * @throws { BusinessError } 13900023 - Text file busy 1950 * @throws { BusinessError } 13900024 - File too large 1951 * @throws { BusinessError } 13900025 - No space left on device 1952 * @throws { BusinessError } 13900027 - Read-only file system 1953 * @throws { BusinessError } 13900029 - Resource deadlock would occur 1954 * @throws { BusinessError } 13900030 - File name too long 1955 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 1956 * @throws { BusinessError } 13900034 - Operation would block 1957 * @throws { BusinessError } 13900038 - Value too large for defined data type 1958 * @throws { BusinessError } 13900041 - Quota exceeded 1959 * @throws { BusinessError } 13900042 - Unknown error 1960 * @throws { BusinessError } 13900044 - Network is unreachable 1961 * @syscap SystemCapability.FileManagement.File.FileIO 1962 * @since 12 1963 */ 1964declare function createRandomAccessFileSync(file: string | File, mode?: number, 1965 options?: RandomAccessFileOptions): RandomAccessFile; 1966 1967/** 1968 * Create file read stream. 1969 * 1970 * @param { string } path - file path. 1971 * @param { ReadStreamOptions } [options] - Optional parameters for ReadStream. 1972 * @returns { ReadStream } Returns the ReadStream object which has been created. 1973 * @throws { BusinessError } 401 - Parameter error 1974 * @throws { BusinessError } 13900001 - Operation not permitted 1975 * @throws { BusinessError } 13900002 - No such file or directory 1976 * @throws { BusinessError } 13900004 - Interrupted system call 1977 * @throws { BusinessError } 13900011 - Out of memory 1978 * @throws { BusinessError } 13900012 - Permission denied 1979 * @throws { BusinessError } 13900017 - No such device 1980 * @throws { BusinessError } 13900019 - Is a directory 1981 * @throws { BusinessError } 13900020 - Invalid argument 1982 * @throws { BusinessError } 13900022 - Too many open files 1983 * @throws { BusinessError } 13900024 - File too large 1984 * @throws { BusinessError } 13900030 - File name too long 1985 * @throws { BusinessError } 13900038 - Value too large for defined data type 1986 * @throws { BusinessError } 13900041 - Quota exceeded 1987 * @throws { BusinessError } 13900042 - Unknown error 1988 * @throws { BusinessError } 13900044 - Network is unreachable 1989 * @syscap SystemCapability.FileManagement.File.FileIO 1990 * @since 12 1991 */ 1992declare function createReadStream(path: string, options?: ReadStreamOptions): ReadStream; 1993 1994/** 1995 * Create file write stream. 1996 * 1997 * @param { string } path - file path. 1998 * @param { WriteStreamOptions } [options] - Optional parameters for ReadStream. 1999 * @returns { WriteStream } Returns the WriteStream object which has been created. 2000 * @throws { BusinessError } 401 - Parameter error 2001 * @throws { BusinessError } 13900001 - Operation not permitted 2002 * @throws { BusinessError } 13900002 - No such file or directory 2003 * @throws { BusinessError } 13900004 - Interrupted system call 2004 * @throws { BusinessError } 13900011 - Out of memory 2005 * @throws { BusinessError } 13900012 - Permission denied 2006 * @throws { BusinessError } 13900015 - File exists 2007 * @throws { BusinessError } 13900017 - No such device 2008 * @throws { BusinessError } 13900019 - Is a directory 2009 * @throws { BusinessError } 13900020 - Invalid argument 2010 * @throws { BusinessError } 13900022 - Too many open files 2011 * @throws { BusinessError } 13900024 - File too large 2012 * @throws { BusinessError } 13900025 - No space left on device 2013 * @throws { BusinessError } 13900027 - Read-only file system 2014 * @throws { BusinessError } 13900030 - File name too long 2015 * @throws { BusinessError } 13900038 - Value too large for defined data type 2016 * @throws { BusinessError } 13900041 - Quota exceeded 2017 * @throws { BusinessError } 13900042 - Unknown error 2018 * @syscap SystemCapability.FileManagement.File.FileIO 2019 * @since 12 2020 */ 2021declare function createWriteStream(path: string, options?: WriteStreamOptions): WriteStream; 2022 2023/** 2024 * Create watcher to listen for file changes. 2025 * 2026 * @param { string } path - path. 2027 * @param { number } events - listened events. 2028 * @param { WatchEventListener } listener - Callback to invoke when an event of the specified type occurs. 2029 * @returns { Watcher } Returns the Watcher object which has been created. 2030 * @throws { BusinessError } 13900002 - No such file or directory 2031 * @throws { BusinessError } 13900008 - Bad file descriptor 2032 * @throws { BusinessError } 13900011 - Out of memory 2033 * @throws { BusinessError } 13900012 - Permission denied 2034 * @throws { BusinessError } 13900013 - Bad address 2035 * @throws { BusinessError } 13900015 - File exists 2036 * @throws { BusinessError } 13900018 - Not a directory 2037 * @throws { BusinessError } 13900020 - Invalid argument 2038 * @throws { BusinessError } 13900021 - File table overflow 2039 * @throws { BusinessError } 13900022 - Too many open files 2040 * @throws { BusinessError } 13900025 - No space left on device 2041 * @throws { BusinessError } 13900030 - File name too long 2042 * @throws { BusinessError } 13900042 - Unknown error 2043 * @syscap SystemCapability.FileManagement.File.FileIO 2044 * @since 10 2045 */ 2046declare function createWatcher(path: string, events: number, listener: WatchEventListener): Watcher; 2047 2048/** 2049 * Duplicate fd to File Object. 2050 * 2051 * @param { number } fd - fd. 2052 * @returns { File } return File 2053 * @throws { BusinessError } 13900004 - Interrupted system call 2054 * @throws { BusinessError } 13900005 - I/O error 2055 * @throws { BusinessError } 13900008 - Bad file descriptor 2056 * @throws { BusinessError } 13900014 - Device or resource busy 2057 * @throws { BusinessError } 13900020 - Invalid argument 2058 * @throws { BusinessError } 13900022 - Too many open files 2059 * @throws { BusinessError } 13900042 - Unknown error 2060 * @syscap SystemCapability.FileManagement.File.FileIO 2061 * @since 10 2062 */ 2063declare function dup(fd: number): File; 2064 2065/** 2066 * Synchronize file metadata. 2067 * 2068 * @param { number } fd - fd. 2069 * @returns { Promise<void> } The promise returned by the function. 2070 * @throws { BusinessError } 13900005 - I/O error 2071 * @throws { BusinessError } 13900008 - Bad file descriptor 2072 * @throws { BusinessError } 13900020 - Invalid argument 2073 * @throws { BusinessError } 13900025 - No space left on device 2074 * @throws { BusinessError } 13900027 - Read-only file system 2075 * @throws { BusinessError } 13900041 - Quota exceeded 2076 * @throws { BusinessError } 13900042 - Unknown error 2077 * @syscap SystemCapability.FileManagement.File.FileIO 2078 * @since 9 2079 */ 2080/** 2081 * Synchronize file metadata. 2082 * 2083 * @param { number } fd - fd. 2084 * @returns { Promise<void> } The promise returned by the function. 2085 * @throws { BusinessError } 13900005 - I/O error 2086 * @throws { BusinessError } 13900008 - Bad file descriptor 2087 * @throws { BusinessError } 13900020 - Invalid argument 2088 * @throws { BusinessError } 13900025 - No space left on device 2089 * @throws { BusinessError } 13900027 - Read-only file system 2090 * @throws { BusinessError } 13900041 - Quota exceeded 2091 * @throws { BusinessError } 13900042 - Unknown error 2092 * @syscap SystemCapability.FileManagement.File.FileIO 2093 * @crossplatform 2094 * @since 10 2095 */ 2096declare function fdatasync(fd: number): Promise<void>; 2097 2098/** 2099 * Synchronize file metadata. 2100 * 2101 * @param { number } fd - fd. 2102 * @param { AsyncCallback<void> } callback - Return the callback function. 2103 * @throws { BusinessError } 13900005 - I/O error 2104 * @throws { BusinessError } 13900008 - Bad file descriptor 2105 * @throws { BusinessError } 13900020 - Invalid argument 2106 * @throws { BusinessError } 13900025 - No space left on device 2107 * @throws { BusinessError } 13900027 - Read-only file system 2108 * @throws { BusinessError } 13900041 - Quota exceeded 2109 * @throws { BusinessError } 13900042 - Unknown error 2110 * @syscap SystemCapability.FileManagement.File.FileIO 2111 * @since 9 2112 */ 2113/** 2114 * Synchronize file metadata. 2115 * 2116 * @param { number } fd - fd. 2117 * @param { AsyncCallback<void> } callback - Return the callback function. 2118 * @throws { BusinessError } 13900005 - I/O error 2119 * @throws { BusinessError } 13900008 - Bad file descriptor 2120 * @throws { BusinessError } 13900020 - Invalid argument 2121 * @throws { BusinessError } 13900025 - No space left on device 2122 * @throws { BusinessError } 13900027 - Read-only file system 2123 * @throws { BusinessError } 13900041 - Quota exceeded 2124 * @throws { BusinessError } 13900042 - Unknown error 2125 * @syscap SystemCapability.FileManagement.File.FileIO 2126 * @crossplatform 2127 * @since 10 2128 */ 2129declare function fdatasync(fd: number, callback: AsyncCallback<void>): void; 2130 2131/** 2132 * Synchronize file metadata with sync interface. 2133 * 2134 * @param { number } fd - fd. 2135 * @throws { BusinessError } 13900005 - I/O error 2136 * @throws { BusinessError } 13900008 - Bad file descriptor 2137 * @throws { BusinessError } 13900020 - Invalid argument 2138 * @throws { BusinessError } 13900025 - No space left on device 2139 * @throws { BusinessError } 13900027 - Read-only file system 2140 * @throws { BusinessError } 13900041 - Quota exceeded 2141 * @throws { BusinessError } 13900042 - Unknown error 2142 * @syscap SystemCapability.FileManagement.File.FileIO 2143 * @since 9 2144 */ 2145/** 2146 * Synchronize file metadata with sync interface. 2147 * 2148 * @param { number } fd - fd. 2149 * @throws { BusinessError } 13900005 - I/O error 2150 * @throws { BusinessError } 13900008 - Bad file descriptor 2151 * @throws { BusinessError } 13900020 - Invalid argument 2152 * @throws { BusinessError } 13900025 - No space left on device 2153 * @throws { BusinessError } 13900027 - Read-only file system 2154 * @throws { BusinessError } 13900041 - Quota exceeded 2155 * @throws { BusinessError } 13900042 - Unknown error 2156 * @syscap SystemCapability.FileManagement.File.FileIO 2157 * @crossplatform 2158 * @since 10 2159 */ 2160declare function fdatasyncSync(fd: number): void; 2161 2162/** 2163 * Create class Stream by using fd. 2164 * 2165 * @param { number } fd - fd. 2166 * @param { string } mode - mode. 2167 * @returns { Promise<Stream> } Returns the Stream object in promise mode. 2168 * @throws { BusinessError } 13900001 - Operation not permitted 2169 * @throws { BusinessError } 13900002 - No such file or directory 2170 * @throws { BusinessError } 13900004 - Interrupted system call 2171 * @throws { BusinessError } 13900006 - No such device or address 2172 * @throws { BusinessError } 13900008 - Bad file descriptor 2173 * @throws { BusinessError } 13900010 - Try again 2174 * @throws { BusinessError } 13900011 - Out of memory 2175 * @throws { BusinessError } 13900012 - Permission denied 2176 * @throws { BusinessError } 13900013 - Bad address 2177 * @throws { BusinessError } 13900014 - Device or resource busy 2178 * @throws { BusinessError } 13900015 - File exists 2179 * @throws { BusinessError } 13900017 - No such device 2180 * @throws { BusinessError } 13900018 - Not a directory 2181 * @throws { BusinessError } 13900019 - Is a directory 2182 * @throws { BusinessError } 13900020 - Invalid argument 2183 * @throws { BusinessError } 13900022 - Too many open files 2184 * @throws { BusinessError } 13900023 - Text file busy 2185 * @throws { BusinessError } 13900024 - File too large 2186 * @throws { BusinessError } 13900025 - No space left on device 2187 * @throws { BusinessError } 13900027 - Read-only file system 2188 * @throws { BusinessError } 13900029 - Resource deadlock would occur 2189 * @throws { BusinessError } 13900030 - File name too long 2190 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 2191 * @throws { BusinessError } 13900034 - Operation would block 2192 * @throws { BusinessError } 13900038 - Value too large for defined data type 2193 * @throws { BusinessError } 13900041 - Quota exceeded 2194 * @throws { BusinessError } 13900042 - Unknown error 2195 * @syscap SystemCapability.FileManagement.File.FileIO 2196 * @since 9 2197 */ 2198declare function fdopenStream(fd: number, mode: string): Promise<Stream>; 2199 2200/** 2201 * Create class Stream by using fd. 2202 * 2203 * @param { number } fd - fd. 2204 * @param { string } mode - mode. 2205 * @param { AsyncCallback<Stream> } callback - The callback is used to return the Stream object. 2206 * @throws { BusinessError } 13900001 - Operation not permitted 2207 * @throws { BusinessError } 13900002 - No such file or directory 2208 * @throws { BusinessError } 13900004 - Interrupted system call 2209 * @throws { BusinessError } 13900006 - No such device or address 2210 * @throws { BusinessError } 13900008 - Bad file descriptor 2211 * @throws { BusinessError } 13900010 - Try again 2212 * @throws { BusinessError } 13900011 - Out of memory 2213 * @throws { BusinessError } 13900012 - Permission denied 2214 * @throws { BusinessError } 13900013 - Bad address 2215 * @throws { BusinessError } 13900014 - Device or resource busy 2216 * @throws { BusinessError } 13900015 - File exists 2217 * @throws { BusinessError } 13900017 - No such device 2218 * @throws { BusinessError } 13900018 - Not a directory 2219 * @throws { BusinessError } 13900019 - Is a directory 2220 * @throws { BusinessError } 13900020 - Invalid argument 2221 * @throws { BusinessError } 13900022 - Too many open files 2222 * @throws { BusinessError } 13900023 - Text file busy 2223 * @throws { BusinessError } 13900024 - File too large 2224 * @throws { BusinessError } 13900025 - No space left on device 2225 * @throws { BusinessError } 13900027 - Read-only file system 2226 * @throws { BusinessError } 13900029 - Resource deadlock would occur 2227 * @throws { BusinessError } 13900030 - File name too long 2228 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 2229 * @throws { BusinessError } 13900034 - Operation would block 2230 * @throws { BusinessError } 13900038 - Value too large for defined data type 2231 * @throws { BusinessError } 13900041 - Quota exceeded 2232 * @throws { BusinessError } 13900042 - Unknown error 2233 * @syscap SystemCapability.FileManagement.File.FileIO 2234 * @since 9 2235 */ 2236declare function fdopenStream(fd: number, mode: string, callback: AsyncCallback<Stream>): void; 2237 2238/** 2239 * Create class Stream by using fd with sync interface. 2240 * 2241 * @param { number } fd - fd. 2242 * @param { string } mode - mode. 2243 * @returns { Stream } Returns the Stream object. 2244 * @throws { BusinessError } 13900001 - Operation not permitted 2245 * @throws { BusinessError } 13900002 - No such file or directory 2246 * @throws { BusinessError } 13900004 - Interrupted system call 2247 * @throws { BusinessError } 13900006 - No such device or address 2248 * @throws { BusinessError } 13900008 - Bad file descriptor 2249 * @throws { BusinessError } 13900010 - Try again 2250 * @throws { BusinessError } 13900011 - Out of memory 2251 * @throws { BusinessError } 13900012 - Permission denied 2252 * @throws { BusinessError } 13900013 - Bad address 2253 * @throws { BusinessError } 13900014 - Device or resource busy 2254 * @throws { BusinessError } 13900015 - File exists 2255 * @throws { BusinessError } 13900017 - No such device 2256 * @throws { BusinessError } 13900018 - Not a directory 2257 * @throws { BusinessError } 13900019 - Is a directory 2258 * @throws { BusinessError } 13900020 - Invalid argument 2259 * @throws { BusinessError } 13900022 - Too many open files 2260 * @throws { BusinessError } 13900023 - Text file busy 2261 * @throws { BusinessError } 13900024 - File too large 2262 * @throws { BusinessError } 13900025 - No space left on device 2263 * @throws { BusinessError } 13900027 - Read-only file system 2264 * @throws { BusinessError } 13900029 - Resource deadlock would occur 2265 * @throws { BusinessError } 13900030 - File name too long 2266 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 2267 * @throws { BusinessError } 13900034 - Operation would block 2268 * @throws { BusinessError } 13900038 - Value too large for defined data type 2269 * @throws { BusinessError } 13900041 - Quota exceeded 2270 * @throws { BusinessError } 13900042 - Unknown error 2271 * @syscap SystemCapability.FileManagement.File.FileIO 2272 * @since 9 2273 */ 2274declare function fdopenStreamSync(fd: number, mode: string): Stream; 2275 2276/** 2277 * Synchronize file. 2278 * 2279 * @param { number } fd - fd. 2280 * @returns { Promise<void> } The promise returned by the function. 2281 * @throws { BusinessError } 13900005 - I/O error 2282 * @throws { BusinessError } 13900008 - Bad file descriptor 2283 * @throws { BusinessError } 13900020 - Invalid argument 2284 * @throws { BusinessError } 13900025 - No space left on device 2285 * @throws { BusinessError } 13900027 - Read-only file system 2286 * @throws { BusinessError } 13900041 - Quota exceeded 2287 * @throws { BusinessError } 13900042 - Unknown error 2288 * @syscap SystemCapability.FileManagement.File.FileIO 2289 * @since 9 2290 */ 2291/** 2292 * Synchronize file. 2293 * 2294 * @param { number } fd - fd. 2295 * @returns { Promise<void> } The promise returned by the function. 2296 * @throws { BusinessError } 13900005 - I/O error 2297 * @throws { BusinessError } 13900008 - Bad file descriptor 2298 * @throws { BusinessError } 13900020 - Invalid argument 2299 * @throws { BusinessError } 13900025 - No space left on device 2300 * @throws { BusinessError } 13900027 - Read-only file system 2301 * @throws { BusinessError } 13900041 - Quota exceeded 2302 * @throws { BusinessError } 13900042 - Unknown error 2303 * @syscap SystemCapability.FileManagement.File.FileIO 2304 * @crossplatform 2305 * @since 10 2306 */ 2307declare function fsync(fd: number): Promise<void>; 2308 2309/** 2310 * Synchronize file. 2311 * 2312 * @param { number } fd - fd. 2313 * @param { AsyncCallback<void> } callback - Return the callback function. 2314 * @throws { BusinessError } 13900005 - I/O error 2315 * @throws { BusinessError } 13900008 - Bad file descriptor 2316 * @throws { BusinessError } 13900020 - Invalid argument 2317 * @throws { BusinessError } 13900025 - No space left on device 2318 * @throws { BusinessError } 13900027 - Read-only file system 2319 * @throws { BusinessError } 13900041 - Quota exceeded 2320 * @throws { BusinessError } 13900042 - Unknown error 2321 * @syscap SystemCapability.FileManagement.File.FileIO 2322 * @since 9 2323 */ 2324/** 2325 * Synchronize file. 2326 * 2327 * @param { number } fd - fd. 2328 * @param { AsyncCallback<void> } callback - Return the callback function. 2329 * @throws { BusinessError } 13900005 - I/O error 2330 * @throws { BusinessError } 13900008 - Bad file descriptor 2331 * @throws { BusinessError } 13900020 - Invalid argument 2332 * @throws { BusinessError } 13900025 - No space left on device 2333 * @throws { BusinessError } 13900027 - Read-only file system 2334 * @throws { BusinessError } 13900041 - Quota exceeded 2335 * @throws { BusinessError } 13900042 - Unknown error 2336 * @syscap SystemCapability.FileManagement.File.FileIO 2337 * @crossplatform 2338 * @since 10 2339 */ 2340declare function fsync(fd: number, callback: AsyncCallback<void>): void; 2341 2342/** 2343 * Synchronize file with sync interface. 2344 * 2345 * @param { number } fd - fd. 2346 * @throws { BusinessError } 13900005 - I/O error 2347 * @throws { BusinessError } 13900008 - Bad file descriptor 2348 * @throws { BusinessError } 13900020 - Invalid argument 2349 * @throws { BusinessError } 13900025 - No space left on device 2350 * @throws { BusinessError } 13900027 - Read-only file system 2351 * @throws { BusinessError } 13900041 - Quota exceeded 2352 * @throws { BusinessError } 13900042 - Unknown error 2353 * @syscap SystemCapability.FileManagement.File.FileIO 2354 * @since 9 2355 */ 2356/** 2357 * Synchronize file with sync interface. 2358 * 2359 * @param { number } fd - fd. 2360 * @throws { BusinessError } 13900005 - I/O error 2361 * @throws { BusinessError } 13900008 - Bad file descriptor 2362 * @throws { BusinessError } 13900020 - Invalid argument 2363 * @throws { BusinessError } 13900025 - No space left on device 2364 * @throws { BusinessError } 13900027 - Read-only file system 2365 * @throws { BusinessError } 13900041 - Quota exceeded 2366 * @throws { BusinessError } 13900042 - Unknown error 2367 * @syscap SystemCapability.FileManagement.File.FileIO 2368 * @crossplatform 2369 * @since 10 2370 */ 2371declare function fsyncSync(fd: number): void; 2372 2373/** 2374 * List file. 2375 * 2376 * @param { string } path - path. 2377 * @param { object } [options] - options. 2378 * @returns { Promise<string[]> } Returns an Array containing the name of files or directories that meet the filter criteria in promise mode. 2379 * If present, Include the subdirectory structure. 2380 * @throws { BusinessError } 13900002 - No such file or directory 2381 * @throws { BusinessError } 13900008 - Bad file descriptor 2382 * @throws { BusinessError } 13900011 - Out of memory 2383 * @throws { BusinessError } 13900018 - Not a directory 2384 * @throws { BusinessError } 13900042 - Unknown error 2385 * @syscap SystemCapability.FileManagement.File.FileIO 2386 * @since 9 2387 */ 2388/** 2389 * List file. 2390 * 2391 * @param { string } path - path. 2392 * @param { object } [options] - options. 2393 * @returns { Promise<string[]> } Returns an Array containing the name of files or directories that meet the filter criteria. 2394 * If present, Include the subdirectory structure. 2395 * @throws { BusinessError } 13900002 - No such file or directory 2396 * @throws { BusinessError } 13900008 - Bad file descriptor 2397 * @throws { BusinessError } 13900011 - Out of memory 2398 * @throws { BusinessError } 13900018 - Not a directory 2399 * @throws { BusinessError } 13900042 - Unknown error 2400 * @syscap SystemCapability.FileManagement.File.FileIO 2401 * @crossplatform 2402 * @since 10 2403 */ 2404/** 2405 * List file. 2406 * 2407 * @param { string } path - path. 2408 * @param { ListFileOptions } [options] - options. 2409 * @returns { Promise<string[]> } Returns an Array containing the name of files or directories that meet the filter criteria. 2410 * If present, Include the subdirectory structure. 2411 * @throws { BusinessError } 13900002 - No such file or directory 2412 * @throws { BusinessError } 13900008 - Bad file descriptor 2413 * @throws { BusinessError } 13900011 - Out of memory 2414 * @throws { BusinessError } 13900018 - Not a directory 2415 * @throws { BusinessError } 13900042 - Unknown error 2416 * @syscap SystemCapability.FileManagement.File.FileIO 2417 * @crossplatform 2418 * @atomicservice 2419 * @since 11 2420 */ 2421declare function listFile( 2422 path: string, 2423 options?: ListFileOptions 2424): Promise<string[]>; 2425 2426/** 2427 * List file. 2428 * 2429 * @param { string } path - path. 2430 * @param { AsyncCallback<string[]> } callback - The callback is used to return an Array containing the name of files or directories 2431 * that meet the filter criteria in promise mode. If present, Include the subdirectory structure. 2432 * @throws { BusinessError } 13900002 - No such file or directory 2433 * @throws { BusinessError } 13900008 - Bad file descriptor 2434 * @throws { BusinessError } 13900011 - Out of memory 2435 * @throws { BusinessError } 13900018 - Not a directory 2436 * @throws { BusinessError } 13900042 - Unknown error 2437 * @syscap SystemCapability.FileManagement.File.FileIO 2438 * @since 9 2439 */ 2440/** 2441 * List file. 2442 * 2443 * @param { string } path - path. 2444 * @param { AsyncCallback<string[]> } callback - The callback is used to return an Array containing the name of files or directories 2445 * that meet the filter criteria in promise mode. If present, Include the subdirectory structure. 2446 * @throws { BusinessError } 13900002 - No such file or directory 2447 * @throws { BusinessError } 13900008 - Bad file descriptor 2448 * @throws { BusinessError } 13900011 - Out of memory 2449 * @throws { BusinessError } 13900018 - Not a directory 2450 * @throws { BusinessError } 13900042 - Unknown error 2451 * @syscap SystemCapability.FileManagement.File.FileIO 2452 * @crossplatform 2453 * @since 10 2454 */ 2455/** 2456 * List file. 2457 * 2458 * @param { string } path - path. 2459 * @param { AsyncCallback<string[]> } callback - The callback is used to return an Array containing the name of files or directories 2460 * that meet the filter criteria in promise mode. If present, Include the subdirectory structure. 2461 * @throws { BusinessError } 13900002 - No such file or directory 2462 * @throws { BusinessError } 13900008 - Bad file descriptor 2463 * @throws { BusinessError } 13900011 - Out of memory 2464 * @throws { BusinessError } 13900018 - Not a directory 2465 * @throws { BusinessError } 13900042 - Unknown error 2466 * @syscap SystemCapability.FileManagement.File.FileIO 2467 * @crossplatform 2468 * @atomicservice 2469 * @since 11 2470 */ 2471declare function listFile(path: string, callback: AsyncCallback<string[]>): void; 2472 2473/** 2474 * List file. 2475 * 2476 * @param { string } path - path. 2477 * @param { object } [options] - options. 2478 * @param { AsyncCallback<string[]> } callback - The callback is used to return an Array containing the name of files or directories 2479 * that meet the filter criteria in promise mode. If present, Include the subdirectory structure. 2480 * @throws { BusinessError } 13900002 - No such file or directory 2481 * @throws { BusinessError } 13900008 - Bad file descriptor 2482 * @throws { BusinessError } 13900011 - Out of memory 2483 * @throws { BusinessError } 13900018 - Not a directory 2484 * @throws { BusinessError } 13900042 - Unknown error 2485 * @syscap SystemCapability.FileManagement.File.FileIO 2486 * @since 9 2487 */ 2488/** 2489 * List file. 2490 * 2491 * @param { string } path - path. 2492 * @param { object } [options] - options. 2493 * @param { AsyncCallback<string[]> } callback - The callback is used to return an Array containing the name of files or directories 2494 * that meet the filter criteria in promise mode. If present, Include the subdirectory structure. 2495 * @throws { BusinessError } 13900002 - No such file or directory 2496 * @throws { BusinessError } 13900008 - Bad file descriptor 2497 * @throws { BusinessError } 13900011 - Out of memory 2498 * @throws { BusinessError } 13900018 - Not a directory 2499 * @throws { BusinessError } 13900042 - Unknown error 2500 * @syscap SystemCapability.FileManagement.File.FileIO 2501 * @crossplatform 2502 * @since 10 2503 */ 2504/** 2505 * List file. 2506 * 2507 * @param { string } path - path. 2508 * @param { ListFileOptions } [options] - options. 2509 * @param { AsyncCallback<string[]> } callback - The callback is used to return an Array containing the name of files or directories 2510 * that meet the filter criteria in promise mode. If present, Include the subdirectory structure. 2511 * @throws { BusinessError } 13900002 - No such file or directory 2512 * @throws { BusinessError } 13900008 - Bad file descriptor 2513 * @throws { BusinessError } 13900011 - Out of memory 2514 * @throws { BusinessError } 13900018 - Not a directory 2515 * @throws { BusinessError } 13900042 - Unknown error 2516 * @syscap SystemCapability.FileManagement.File.FileIO 2517 * @crossplatform 2518 * @atomicservice 2519 * @since 11 2520 */ 2521declare function listFile( 2522 path: string, 2523 options: ListFileOptions, 2524 callback: AsyncCallback<string[]> 2525): void; 2526 2527/** 2528 * List file with sync interface. 2529 * 2530 * @param { string } path - path. 2531 * @param { object } [options] - options. 2532 * @returns { string[] } Returns an Array containing the name of files or directories that meet the filter criteria. 2533 * @throws { BusinessError } 13900002 - No such file or directory 2534 * @throws { BusinessError } 13900008 - Bad file descriptor 2535 * @throws { BusinessError } 13900011 - Out of memory 2536 * @throws { BusinessError } 13900018 - Not a directory 2537 * @throws { BusinessError } 13900042 - Unknown error 2538 * @syscap SystemCapability.FileManagement.File.FileIO 2539 * @since 9 2540 */ 2541/** 2542 * List file with sync interface. 2543 * 2544 * @param { string } path - path. 2545 * @param { object } [options] - options. 2546 * @returns { string[] } Returns an Array containing the name of files or directories that meet the filter criteria. 2547 * @throws { BusinessError } 13900002 - No such file or directory 2548 * @throws { BusinessError } 13900008 - Bad file descriptor 2549 * @throws { BusinessError } 13900011 - Out of memory 2550 * @throws { BusinessError } 13900018 - Not a directory 2551 * @throws { BusinessError } 13900042 - Unknown error 2552 * @syscap SystemCapability.FileManagement.File.FileIO 2553 * @crossplatform 2554 * @since 10 2555 */ 2556/** 2557 * List file with sync interface. 2558 * 2559 * @param { string } path - path. 2560 * @param { ListFileOptions } [options] - options. 2561 * @returns { string[] } Returns an Array containing the name of files or directories that meet the filter criteria. 2562 * @throws { BusinessError } 13900002 - No such file or directory 2563 * @throws { BusinessError } 13900008 - Bad file descriptor 2564 * @throws { BusinessError } 13900011 - Out of memory 2565 * @throws { BusinessError } 13900018 - Not a directory 2566 * @throws { BusinessError } 13900042 - Unknown error 2567 * @syscap SystemCapability.FileManagement.File.FileIO 2568 * @crossplatform 2569 * @atomicservice 2570 * @since 11 2571 */ 2572declare function listFileSync( 2573 path: string, 2574 options?: ListFileOptions 2575): string[]; 2576 2577/** 2578 * Reposition file offset. 2579 * 2580 * @param { number } fd - file descriptor. 2581 * @param { number } offset - file offset. 2582 * @param { WhenceType } [whence = WhenceType.SEEK_SET] - directive whence. 2583 * @returns { number } Returns the file offset relative to starting position of file. 2584 * @throws { BusinessError } 13900008 - Bad file descriptor 2585 * @throws { BusinessError } 13900020 - Invalid argument 2586 * @throws { BusinessError } 13900026 - Illegal seek 2587 * @throws { BusinessError } 13900038 - Value too large for defined data type 2588 * @throws { BusinessError } 13900042 - Unknown error 2589 * @syscap SystemCapability.FileManagement.File.FileIO 2590 * @since 11 2591 */ 2592/** 2593 * Reposition file offset. 2594 * 2595 * @param { number } fd - file descriptor. 2596 * @param { number } offset - file offset. 2597 * @param { WhenceType } [whence = WhenceType.SEEK_SET] - directive whence. 2598 * @returns { number } Returns the file offset relative to starting position of file. 2599 * @throws { BusinessError } 13900008 - Bad file descriptor 2600 * @throws { BusinessError } 13900020 - Invalid argument 2601 * @throws { BusinessError } 13900026 - Illegal seek 2602 * @throws { BusinessError } 13900038 - Value too large for defined data type 2603 * @throws { BusinessError } 13900042 - Unknown error 2604 * @syscap SystemCapability.FileManagement.File.FileIO 2605 * @crossplatform 2606 * @since 12 2607 */ 2608declare function lseek(fd: number, offset: number, whence?: WhenceType): number; 2609 2610/** 2611 * Stat link file. 2612 * 2613 * @param { string } path - path. 2614 * @returns { Promise<Stat> } Returns the Stat object in promise mode. 2615 * @throws { BusinessError } 13900002 - No such file or directory 2616 * @throws { BusinessError } 13900008 - Bad file descriptor 2617 * @throws { BusinessError } 13900011 - Out of memory 2618 * @throws { BusinessError } 13900012 - Permission denied 2619 * @throws { BusinessError } 13900013 - Bad address 2620 * @throws { BusinessError } 13900018 - Not a directory 2621 * @throws { BusinessError } 13900030 - File name too long 2622 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 2623 * @throws { BusinessError } 13900038 - Value too large for defined data type 2624 * @throws { BusinessError } 13900042 - Unknown error 2625 * @syscap SystemCapability.FileManagement.File.FileIO 2626 * @since 9 2627 */ 2628declare function lstat(path: string): Promise<Stat>; 2629 2630/** 2631 * Stat link file. 2632 * 2633 * @param { string } path - path. 2634 * @param { AsyncCallback<Stat> } callback - The callback is used to return the Stat object. 2635 * @throws { BusinessError } 13900002 - No such file or directory 2636 * @throws { BusinessError } 13900008 - Bad file descriptor 2637 * @throws { BusinessError } 13900011 - Out of memory 2638 * @throws { BusinessError } 13900012 - Permission denied 2639 * @throws { BusinessError } 13900013 - Bad address 2640 * @throws { BusinessError } 13900018 - Not a directory 2641 * @throws { BusinessError } 13900030 - File name too long 2642 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 2643 * @throws { BusinessError } 13900038 - Value too large for defined data type 2644 * @throws { BusinessError } 13900042 - Unknown error 2645 * @syscap SystemCapability.FileManagement.File.FileIO 2646 * @since 9 2647 */ 2648declare function lstat(path: string, callback: AsyncCallback<Stat>): void; 2649 2650/** 2651 * Stat link file with sync interface. 2652 * 2653 * @param { string } path - path. 2654 * @returns { Stat } Returns the Stat object. 2655 * @throws { BusinessError } 13900002 - No such file or directory 2656 * @throws { BusinessError } 13900008 - Bad file descriptor 2657 * @throws { BusinessError } 13900011 - Out of memory 2658 * @throws { BusinessError } 13900012 - Permission denied 2659 * @throws { BusinessError } 13900013 - Bad address 2660 * @throws { BusinessError } 13900018 - Not a directory 2661 * @throws { BusinessError } 13900030 - File name too long 2662 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 2663 * @throws { BusinessError } 13900038 - Value too large for defined data type 2664 * @throws { BusinessError } 13900042 - Unknown error 2665 * @syscap SystemCapability.FileManagement.File.FileIO 2666 * @since 9 2667 */ 2668declare function lstatSync(path: string): Stat; 2669 2670/** 2671 * Make dir. 2672 * 2673 * @param { string } path - path. 2674 * @returns { Promise<void> } The promise returned by the function. 2675 * @throws { BusinessError } 13900001 - Operation not permitted 2676 * @throws { BusinessError } 13900002 - No such file or directory 2677 * @throws { BusinessError } 13900008 - Bad file descriptor 2678 * @throws { BusinessError } 13900011 - Out of memory 2679 * @throws { BusinessError } 13900012 - Permission denied 2680 * @throws { BusinessError } 13900013 - Bad address 2681 * @throws { BusinessError } 13900015 - File exists 2682 * @throws { BusinessError } 13900018 - Not a directory 2683 * @throws { BusinessError } 13900020 - Invalid argument 2684 * @throws { BusinessError } 13900025 - No space left on device 2685 * @throws { BusinessError } 13900028 - Too many links 2686 * @throws { BusinessError } 13900030 - File name too long 2687 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 2688 * @throws { BusinessError } 13900041 - Quota exceeded 2689 * @throws { BusinessError } 13900042 - Unknown error 2690 * @syscap SystemCapability.FileManagement.File.FileIO 2691 * @since 9 2692 */ 2693/** 2694 * Make dir. 2695 * 2696 * @param { string } path - path. 2697 * @returns { Promise<void> } The promise returned by the function. 2698 * @throws { BusinessError } 13900001 - Operation not permitted 2699 * @throws { BusinessError } 13900002 - No such file or directory 2700 * @throws { BusinessError } 13900008 - Bad file descriptor 2701 * @throws { BusinessError } 13900011 - Out of memory 2702 * @throws { BusinessError } 13900012 - Permission denied 2703 * @throws { BusinessError } 13900013 - Bad address 2704 * @throws { BusinessError } 13900015 - File exists 2705 * @throws { BusinessError } 13900018 - Not a directory 2706 * @throws { BusinessError } 13900020 - Invalid argument 2707 * @throws { BusinessError } 13900025 - No space left on device 2708 * @throws { BusinessError } 13900028 - Too many links 2709 * @throws { BusinessError } 13900030 - File name too long 2710 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 2711 * @throws { BusinessError } 13900041 - Quota exceeded 2712 * @throws { BusinessError } 13900042 - Unknown error 2713 * @syscap SystemCapability.FileManagement.File.FileIO 2714 * @crossplatform 2715 * @since 10 2716 */ 2717/** 2718 * Make dir. 2719 * 2720 * @param { string } path - path. 2721 * @returns { Promise<void> } The promise returned by the function. 2722 * @throws { BusinessError } 13900001 - Operation not permitted 2723 * @throws { BusinessError } 13900002 - No such file or directory 2724 * @throws { BusinessError } 13900008 - Bad file descriptor 2725 * @throws { BusinessError } 13900011 - Out of memory 2726 * @throws { BusinessError } 13900012 - Permission denied 2727 * @throws { BusinessError } 13900013 - Bad address 2728 * @throws { BusinessError } 13900015 - File exists 2729 * @throws { BusinessError } 13900018 - Not a directory 2730 * @throws { BusinessError } 13900020 - Invalid argument 2731 * @throws { BusinessError } 13900025 - No space left on device 2732 * @throws { BusinessError } 13900028 - Too many links 2733 * @throws { BusinessError } 13900030 - File name too long 2734 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 2735 * @throws { BusinessError } 13900041 - Quota exceeded 2736 * @throws { BusinessError } 13900042 - Unknown error 2737 * @syscap SystemCapability.FileManagement.File.FileIO 2738 * @crossplatform 2739 * @atomicservice 2740 * @since 11 2741 */ 2742declare function mkdir(path: string): Promise<void>; 2743 2744/** 2745 * Make dir. 2746 * 2747 * @param { string } path - path. 2748 * @param { boolean } recursion - whether to recursively make directory. 2749 * @returns { Promise<void> } The promise returned by the function. 2750 * @throws { BusinessError } 13900001 - Operation not permitted 2751 * @throws { BusinessError } 13900002 - No such file or directory 2752 * @throws { BusinessError } 13900008 - Bad file descriptor 2753 * @throws { BusinessError } 13900011 - Out of memory 2754 * @throws { BusinessError } 13900012 - Permission denied 2755 * @throws { BusinessError } 13900013 - Bad address 2756 * @throws { BusinessError } 13900015 - File exists 2757 * @throws { BusinessError } 13900018 - Not a directory 2758 * @throws { BusinessError } 13900020 - Invalid argument 2759 * @throws { BusinessError } 13900025 - No space left on device 2760 * @throws { BusinessError } 13900028 - Too many links 2761 * @throws { BusinessError } 13900030 - File name too long 2762 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 2763 * @throws { BusinessError } 13900041 - Quota exceeded 2764 * @throws { BusinessError } 13900042 - Unknown error 2765 * @syscap SystemCapability.FileManagement.File.FileIO 2766 * @atomicservice 2767 * @since 11 2768 */ 2769declare function mkdir(path: string, recursion: boolean): Promise<void>; 2770 2771/** 2772 * Make dir. 2773 * 2774 * @param { string } path - path. 2775 * @param { AsyncCallback<void> } callback - Return the callback function. 2776 * @throws { BusinessError } 13900001 - Operation not permitted 2777 * @throws { BusinessError } 13900002 - No such file or directory 2778 * @throws { BusinessError } 13900008 - Bad file descriptor 2779 * @throws { BusinessError } 13900011 - Out of memory 2780 * @throws { BusinessError } 13900012 - Permission denied 2781 * @throws { BusinessError } 13900013 - Bad address 2782 * @throws { BusinessError } 13900015 - File exists 2783 * @throws { BusinessError } 13900018 - Not a directory 2784 * @throws { BusinessError } 13900020 - Invalid argument 2785 * @throws { BusinessError } 13900025 - No space left on device 2786 * @throws { BusinessError } 13900028 - Too many links 2787 * @throws { BusinessError } 13900030 - File name too long 2788 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 2789 * @throws { BusinessError } 13900041 - Quota exceeded 2790 * @throws { BusinessError } 13900042 - Unknown error 2791 * @syscap SystemCapability.FileManagement.File.FileIO 2792 * @since 9 2793 */ 2794/** 2795 * Make dir. 2796 * 2797 * @param { string } path - path. 2798 * @param { AsyncCallback<void> } callback - Return the callback function. 2799 * @throws { BusinessError } 13900001 - Operation not permitted 2800 * @throws { BusinessError } 13900002 - No such file or directory 2801 * @throws { BusinessError } 13900008 - Bad file descriptor 2802 * @throws { BusinessError } 13900011 - Out of memory 2803 * @throws { BusinessError } 13900012 - Permission denied 2804 * @throws { BusinessError } 13900013 - Bad address 2805 * @throws { BusinessError } 13900015 - File exists 2806 * @throws { BusinessError } 13900018 - Not a directory 2807 * @throws { BusinessError } 13900020 - Invalid argument 2808 * @throws { BusinessError } 13900025 - No space left on device 2809 * @throws { BusinessError } 13900028 - Too many links 2810 * @throws { BusinessError } 13900030 - File name too long 2811 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 2812 * @throws { BusinessError } 13900041 - Quota exceeded 2813 * @throws { BusinessError } 13900042 - Unknown error 2814 * @syscap SystemCapability.FileManagement.File.FileIO 2815 * @crossplatform 2816 * @since 10 2817 */ 2818/** 2819 * Make dir. 2820 * 2821 * @param { string } path - path. 2822 * @param { AsyncCallback<void> } callback - Return the callback function. 2823 * @throws { BusinessError } 13900001 - Operation not permitted 2824 * @throws { BusinessError } 13900002 - No such file or directory 2825 * @throws { BusinessError } 13900008 - Bad file descriptor 2826 * @throws { BusinessError } 13900011 - Out of memory 2827 * @throws { BusinessError } 13900012 - Permission denied 2828 * @throws { BusinessError } 13900013 - Bad address 2829 * @throws { BusinessError } 13900015 - File exists 2830 * @throws { BusinessError } 13900018 - Not a directory 2831 * @throws { BusinessError } 13900020 - Invalid argument 2832 * @throws { BusinessError } 13900025 - No space left on device 2833 * @throws { BusinessError } 13900028 - Too many links 2834 * @throws { BusinessError } 13900030 - File name too long 2835 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 2836 * @throws { BusinessError } 13900041 - Quota exceeded 2837 * @throws { BusinessError } 13900042 - Unknown error 2838 * @syscap SystemCapability.FileManagement.File.FileIO 2839 * @crossplatform 2840 * @atomicservice 2841 * @since 11 2842 */ 2843declare function mkdir(path: string, callback: AsyncCallback<void>): void; 2844 2845/** 2846 * Make dir. 2847 * 2848 * @param { string } path - path. 2849 * @param { boolean } recursion - whether to recursively make directory. 2850 * @param { AsyncCallback<void> } callback - Return the callback function. 2851 * @throws { BusinessError } 13900001 - Operation not permitted 2852 * @throws { BusinessError } 13900002 - No such file or directory 2853 * @throws { BusinessError } 13900008 - Bad file descriptor 2854 * @throws { BusinessError } 13900011 - Out of memory 2855 * @throws { BusinessError } 13900012 - Permission denied 2856 * @throws { BusinessError } 13900013 - Bad address 2857 * @throws { BusinessError } 13900015 - File exists 2858 * @throws { BusinessError } 13900018 - Not a directory 2859 * @throws { BusinessError } 13900020 - Invalid argument 2860 * @throws { BusinessError } 13900025 - No space left on device 2861 * @throws { BusinessError } 13900028 - Too many links 2862 * @throws { BusinessError } 13900030 - File name too long 2863 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 2864 * @throws { BusinessError } 13900041 - Quota exceeded 2865 * @throws { BusinessError } 13900042 - Unknown error 2866 * @syscap SystemCapability.FileManagement.File.FileIO 2867 * @atomicservice 2868 * @since 11 2869 */ 2870declare function mkdir(path: string, recursion: boolean, callback: AsyncCallback<void>): void; 2871 2872/** 2873 * Make dir with sync interface. 2874 * 2875 * @param { string } path - path. 2876 * @throws { BusinessError } 13900001 - Operation not permitted 2877 * @throws { BusinessError } 13900002 - No such file or directory 2878 * @throws { BusinessError } 13900008 - Bad file descriptor 2879 * @throws { BusinessError } 13900011 - Out of memory 2880 * @throws { BusinessError } 13900012 - Permission denied 2881 * @throws { BusinessError } 13900013 - Bad address 2882 * @throws { BusinessError } 13900015 - File exists 2883 * @throws { BusinessError } 13900018 - Not a directory 2884 * @throws { BusinessError } 13900020 - Invalid argument 2885 * @throws { BusinessError } 13900025 - No space left on device 2886 * @throws { BusinessError } 13900028 - Too many links 2887 * @throws { BusinessError } 13900030 - File name too long 2888 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 2889 * @throws { BusinessError } 13900041 - Quota exceeded 2890 * @throws { BusinessError } 13900042 - Unknown error 2891 * @syscap SystemCapability.FileManagement.File.FileIO 2892 * @since 9 2893 */ 2894/** 2895 * Make dir with sync interface. 2896 * 2897 * @param { string } path - path. 2898 * @throws { BusinessError } 13900001 - Operation not permitted 2899 * @throws { BusinessError } 13900002 - No such file or directory 2900 * @throws { BusinessError } 13900008 - Bad file descriptor 2901 * @throws { BusinessError } 13900011 - Out of memory 2902 * @throws { BusinessError } 13900012 - Permission denied 2903 * @throws { BusinessError } 13900013 - Bad address 2904 * @throws { BusinessError } 13900015 - File exists 2905 * @throws { BusinessError } 13900018 - Not a directory 2906 * @throws { BusinessError } 13900020 - Invalid argument 2907 * @throws { BusinessError } 13900025 - No space left on device 2908 * @throws { BusinessError } 13900028 - Too many links 2909 * @throws { BusinessError } 13900030 - File name too long 2910 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 2911 * @throws { BusinessError } 13900041 - Quota exceeded 2912 * @throws { BusinessError } 13900042 - Unknown error 2913 * @syscap SystemCapability.FileManagement.File.FileIO 2914 * @crossplatform 2915 * @since 10 2916 */ 2917/** 2918 * Make dir with sync interface. 2919 * 2920 * @param { string } path - path. 2921 * @throws { BusinessError } 13900001 - Operation not permitted 2922 * @throws { BusinessError } 13900002 - No such file or directory 2923 * @throws { BusinessError } 13900008 - Bad file descriptor 2924 * @throws { BusinessError } 13900011 - Out of memory 2925 * @throws { BusinessError } 13900012 - Permission denied 2926 * @throws { BusinessError } 13900013 - Bad address 2927 * @throws { BusinessError } 13900015 - File exists 2928 * @throws { BusinessError } 13900018 - Not a directory 2929 * @throws { BusinessError } 13900020 - Invalid argument 2930 * @throws { BusinessError } 13900025 - No space left on device 2931 * @throws { BusinessError } 13900028 - Too many links 2932 * @throws { BusinessError } 13900030 - File name too long 2933 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 2934 * @throws { BusinessError } 13900041 - Quota exceeded 2935 * @throws { BusinessError } 13900042 - Unknown error 2936 * @syscap SystemCapability.FileManagement.File.FileIO 2937 * @crossplatform 2938 * @atomicservice 2939 * @since 11 2940 */ 2941declare function mkdirSync(path: string): void; 2942 2943/** 2944 * Make dir with sync interface. 2945 * 2946 * @param { string } path - path. 2947 * @param { boolean } recursion - whether to recursively make directory. 2948 * @throws { BusinessError } 13900001 - Operation not permitted 2949 * @throws { BusinessError } 13900002 - No such file or directory 2950 * @throws { BusinessError } 13900008 - Bad file descriptor 2951 * @throws { BusinessError } 13900011 - Out of memory 2952 * @throws { BusinessError } 13900012 - Permission denied 2953 * @throws { BusinessError } 13900013 - Bad address 2954 * @throws { BusinessError } 13900015 - File exists 2955 * @throws { BusinessError } 13900018 - Not a directory 2956 * @throws { BusinessError } 13900020 - Invalid argument 2957 * @throws { BusinessError } 13900025 - No space left on device 2958 * @throws { BusinessError } 13900028 - Too many links 2959 * @throws { BusinessError } 13900030 - File name too long 2960 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 2961 * @throws { BusinessError } 13900041 - Quota exceeded 2962 * @throws { BusinessError } 13900042 - Unknown error 2963 * @syscap SystemCapability.FileManagement.File.FileIO 2964 * @atomicservice 2965 * @since 11 2966 */ 2967declare function mkdirSync(path: string, recursion: boolean): void; 2968 2969/** 2970 * Make temp dir. 2971 * 2972 * @param { string } prefix - dir prefix. 2973 * @returns { Promise<string> } Returns the path to the new directory in promise mode. 2974 * @throws { BusinessError } 13900001 - Operation not permitted 2975 * @throws { BusinessError } 13900002 - No such file or directory 2976 * @throws { BusinessError } 13900008 - Bad file descriptor 2977 * @throws { BusinessError } 13900011 - Out of memory 2978 * @throws { BusinessError } 13900012 - Permission denied 2979 * @throws { BusinessError } 13900013 - Bad address 2980 * @throws { BusinessError } 13900015 - File exists 2981 * @throws { BusinessError } 13900018 - Not a directory 2982 * @throws { BusinessError } 13900020 - Invalid argument 2983 * @throws { BusinessError } 13900025 - No space left on device 2984 * @throws { BusinessError } 13900028 - Too many links 2985 * @throws { BusinessError } 13900030 - File name too long 2986 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 2987 * @throws { BusinessError } 13900041 - Quota exceeded 2988 * @throws { BusinessError } 13900042 - Unknown error 2989 * @syscap SystemCapability.FileManagement.File.FileIO 2990 * @since 9 2991 */ 2992/** 2993 * Make temp dir. 2994 * 2995 * @param { string } prefix - dir prefix. 2996 * @returns { Promise<string> } Returns the path to the new directory in promise mode. 2997 * @throws { BusinessError } 13900001 - Operation not permitted 2998 * @throws { BusinessError } 13900002 - No such file or directory 2999 * @throws { BusinessError } 13900008 - Bad file descriptor 3000 * @throws { BusinessError } 13900011 - Out of memory 3001 * @throws { BusinessError } 13900012 - Permission denied 3002 * @throws { BusinessError } 13900013 - Bad address 3003 * @throws { BusinessError } 13900015 - File exists 3004 * @throws { BusinessError } 13900018 - Not a directory 3005 * @throws { BusinessError } 13900020 - Invalid argument 3006 * @throws { BusinessError } 13900025 - No space left on device 3007 * @throws { BusinessError } 13900028 - Too many links 3008 * @throws { BusinessError } 13900030 - File name too long 3009 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 3010 * @throws { BusinessError } 13900041 - Quota exceeded 3011 * @throws { BusinessError } 13900042 - Unknown error 3012 * @syscap SystemCapability.FileManagement.File.FileIO 3013 * @crossplatform 3014 * @since 10 3015 */ 3016declare function mkdtemp(prefix: string): Promise<string>; 3017 3018/** 3019 * Make temp dir. 3020 * 3021 * @param { string } prefix - dir prefix. 3022 * @param { AsyncCallback<string> } callback - The callback is used to return the path to the new directory. 3023 * @throws { BusinessError } 13900001 - Operation not permitted 3024 * @throws { BusinessError } 13900002 - No such file or directory 3025 * @throws { BusinessError } 13900008 - Bad file descriptor 3026 * @throws { BusinessError } 13900011 - Out of memory 3027 * @throws { BusinessError } 13900012 - Permission denied 3028 * @throws { BusinessError } 13900013 - Bad address 3029 * @throws { BusinessError } 13900015 - File exists 3030 * @throws { BusinessError } 13900018 - Not a directory 3031 * @throws { BusinessError } 13900020 - Invalid argument 3032 * @throws { BusinessError } 13900025 - No space left on device 3033 * @throws { BusinessError } 13900028 - Too many links 3034 * @throws { BusinessError } 13900030 - File name too long 3035 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 3036 * @throws { BusinessError } 13900041 - Quota exceeded 3037 * @throws { BusinessError } 13900042 - Unknown error 3038 * @syscap SystemCapability.FileManagement.File.FileIO 3039 * @since 9 3040 */ 3041/** 3042 * Make temp dir. 3043 * 3044 * @param { string } prefix - dir prefix. 3045 * @param { AsyncCallback<string> } callback - The callback is used to return the path to the new directory. 3046 * @throws { BusinessError } 13900001 - Operation not permitted 3047 * @throws { BusinessError } 13900002 - No such file or directory 3048 * @throws { BusinessError } 13900008 - Bad file descriptor 3049 * @throws { BusinessError } 13900011 - Out of memory 3050 * @throws { BusinessError } 13900012 - Permission denied 3051 * @throws { BusinessError } 13900013 - Bad address 3052 * @throws { BusinessError } 13900015 - File exists 3053 * @throws { BusinessError } 13900018 - Not a directory 3054 * @throws { BusinessError } 13900020 - Invalid argument 3055 * @throws { BusinessError } 13900025 - No space left on device 3056 * @throws { BusinessError } 13900028 - Too many links 3057 * @throws { BusinessError } 13900030 - File name too long 3058 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 3059 * @throws { BusinessError } 13900041 - Quota exceeded 3060 * @throws { BusinessError } 13900042 - Unknown error 3061 * @syscap SystemCapability.FileManagement.File.FileIO 3062 * @crossplatform 3063 * @since 10 3064 */ 3065declare function mkdtemp(prefix: string, callback: AsyncCallback<string>): void; 3066 3067/** 3068 * Make temp dir with sync interface. 3069 * 3070 * @param { string } prefix - dir prefix. 3071 * @returns { string } Returns the path to the new directory. 3072 * @throws { BusinessError } 13900001 - Operation not permitted 3073 * @throws { BusinessError } 13900002 - No such file or directory 3074 * @throws { BusinessError } 13900008 - Bad file descriptor 3075 * @throws { BusinessError } 13900011 - Out of memory 3076 * @throws { BusinessError } 13900012 - Permission denied 3077 * @throws { BusinessError } 13900013 - Bad address 3078 * @throws { BusinessError } 13900015 - File exists 3079 * @throws { BusinessError } 13900018 - Not a directory 3080 * @throws { BusinessError } 13900020 - Invalid argument 3081 * @throws { BusinessError } 13900025 - No space left on device 3082 * @throws { BusinessError } 13900028 - Too many links 3083 * @throws { BusinessError } 13900030 - File name too long 3084 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 3085 * @throws { BusinessError } 13900041 - Quota exceeded 3086 * @throws { BusinessError } 13900042 - Unknown error 3087 * @syscap SystemCapability.FileManagement.File.FileIO 3088 * @since 9 3089 */ 3090/** 3091 * Make temp dir with sync interface. 3092 * 3093 * @param { string } prefix - dir prefix. 3094 * @returns { string } Returns the path to the new directory. 3095 * @throws { BusinessError } 13900001 - Operation not permitted 3096 * @throws { BusinessError } 13900002 - No such file or directory 3097 * @throws { BusinessError } 13900008 - Bad file descriptor 3098 * @throws { BusinessError } 13900011 - Out of memory 3099 * @throws { BusinessError } 13900012 - Permission denied 3100 * @throws { BusinessError } 13900013 - Bad address 3101 * @throws { BusinessError } 13900015 - File exists 3102 * @throws { BusinessError } 13900018 - Not a directory 3103 * @throws { BusinessError } 13900020 - Invalid argument 3104 * @throws { BusinessError } 13900025 - No space left on device 3105 * @throws { BusinessError } 13900028 - Too many links 3106 * @throws { BusinessError } 13900030 - File name too long 3107 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 3108 * @throws { BusinessError } 13900041 - Quota exceeded 3109 * @throws { BusinessError } 13900042 - Unknown error 3110 * @syscap SystemCapability.FileManagement.File.FileIO 3111 * @crossplatform 3112 * @since 10 3113 */ 3114declare function mkdtempSync(prefix: string): string; 3115 3116/** 3117 * Move directory. 3118 * 3119 * @param { string } src - source file path. 3120 * @param { string } dest - destination file path. 3121 * @param { number } [mode = 0] - move mode when duplicate file name exists. 3122 * @returns { Promise<void> } The promise returned by the function. 3123 * @throws { BusinessError } 13900001 - Operation not permitted 3124 * @throws { BusinessError } 13900002 - No such file or directory 3125 * @throws { BusinessError } 13900008 - Bad file descriptor 3126 * @throws { BusinessError } 13900011 - Out of memory 3127 * @throws { BusinessError } 13900012 - Permission denied 3128 * @throws { BusinessError } 13900013 - Bad address 3129 * @throws { BusinessError } 13900014 - Device or resource busy 3130 * @throws { BusinessError } 13900015 - File exists 3131 * @throws { BusinessError } 13900016 - Cross-device link 3132 * @throws { BusinessError } 13900018 - Not a directory 3133 * @throws { BusinessError } 13900019 - Is a directory 3134 * @throws { BusinessError } 13900020 - Invalid argument 3135 * @throws { BusinessError } 13900025 - No space left on device 3136 * @throws { BusinessError } 13900027 - Read-only file system 3137 * @throws { BusinessError } 13900028 - Too many links 3138 * @throws { BusinessError } 13900032 - Directory not empty 3139 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 3140 * @throws { BusinessError } 13900041 - Quota exceeded 3141 * @throws { BusinessError } 13900042 - Unknown error 3142 * @syscap SystemCapability.FileManagement.File.FileIO 3143 * @since 10 3144 */ 3145declare function moveDir(src: string, dest: string, mode?: number): Promise<void>; 3146 3147/** 3148 * Move directory. 3149 * 3150 * @param { string } src - source file path. 3151 * @param { string } dest - destination file path. 3152 * @param { AsyncCallback<void> } callback - Return the callback function. 3153 * @throws { BusinessError } 13900001 - Operation not permitted 3154 * @throws { BusinessError } 13900002 - No such file or directory 3155 * @throws { BusinessError } 13900008 - Bad file descriptor 3156 * @throws { BusinessError } 13900011 - Out of memory 3157 * @throws { BusinessError } 13900012 - Permission denied 3158 * @throws { BusinessError } 13900013 - Bad address 3159 * @throws { BusinessError } 13900014 - Device or resource busy 3160 * @throws { BusinessError } 13900016 - Cross-device link 3161 * @throws { BusinessError } 13900018 - Not a directory 3162 * @throws { BusinessError } 13900019 - Is a directory 3163 * @throws { BusinessError } 13900020 - Invalid argument 3164 * @throws { BusinessError } 13900025 - No space left on device 3165 * @throws { BusinessError } 13900027 - Read-only file system 3166 * @throws { BusinessError } 13900028 - Too many links 3167 * @throws { BusinessError } 13900032 - Directory not empty 3168 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 3169 * @throws { BusinessError } 13900041 - Quota exceeded 3170 * @throws { BusinessError } 13900042 - Unknown error 3171 * @syscap SystemCapability.FileManagement.File.FileIO 3172 * @since 10 3173 */ 3174declare function moveDir(src: string, dest: string, callback: AsyncCallback<void>): void; 3175 3176/** 3177 * Move directory. 3178 * 3179 * @param { string } src - source file path. 3180 * @param { string } dest - destination file path. 3181 * @param { AsyncCallback<void, Array<ConflictFiles>> } callback - Return the callback function. 3182 * @throws { BusinessError } 13900015 - File exists 3183 * @syscap SystemCapability.FileManagement.File.FileIO 3184 * @since 10 3185 */ 3186declare function moveDir(src: string, dest: string, callback: AsyncCallback<void, Array<ConflictFiles>>): void; 3187 3188/** 3189 * Move directory. 3190 * 3191 * @param { string } src - source file path. 3192 * @param { string } dest - destination file path. 3193 * @param { number } mode - move mode when duplicate file name exists. 3194 * @param { AsyncCallback<void> } callback - Return the callback function. 3195 * @throws { BusinessError } 13900001 - Operation not permitted 3196 * @throws { BusinessError } 13900002 - No such file or directory 3197 * @throws { BusinessError } 13900008 - Bad file descriptor 3198 * @throws { BusinessError } 13900011 - Out of memory 3199 * @throws { BusinessError } 13900012 - Permission denied 3200 * @throws { BusinessError } 13900013 - Bad address 3201 * @throws { BusinessError } 13900014 - Device or resource busy 3202 * @throws { BusinessError } 13900016 - Cross-device link 3203 * @throws { BusinessError } 13900018 - Not a directory 3204 * @throws { BusinessError } 13900019 - Is a directory 3205 * @throws { BusinessError } 13900020 - Invalid argument 3206 * @throws { BusinessError } 13900025 - No space left on device 3207 * @throws { BusinessError } 13900027 - Read-only file system 3208 * @throws { BusinessError } 13900028 - Too many links 3209 * @throws { BusinessError } 13900032 - Directory not empty 3210 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 3211 * @throws { BusinessError } 13900041 - Quota exceeded 3212 * @throws { BusinessError } 13900042 - Unknown error 3213 * @syscap SystemCapability.FileManagement.File.FileIO 3214 * @since 10 3215 */ 3216declare function moveDir(src: string, dest: string, mode: number, callback: AsyncCallback<void>): void; 3217 3218/** 3219 * Move directory. 3220 * 3221 * @param { string } src - source file path. 3222 * @param { string } dest - destination file path. 3223 * @param { number } mode - move mode when duplicate file name exists. 3224 * @param { AsyncCallback<void, Array<ConflictFiles>> } callback - Return the callback function. 3225 * @throws { BusinessError } 13900015 - File exists 3226 * @syscap SystemCapability.FileManagement.File.FileIO 3227 * @since 10 3228 */ 3229declare function moveDir(src: string, dest: string, mode: number, callback: AsyncCallback<void, Array<ConflictFiles>>): void; 3230 3231/** 3232 * Move directory with sync interface. 3233 * 3234 * @param { string } src - source file path. 3235 * @param { string } dest - destination file path. 3236 * @param { number } [mode = 0] - move mode when duplicate file name exists. 3237 * @throws { BusinessError } 13900001 - Operation not permitted 3238 * @throws { BusinessError } 13900002 - No such file or directory 3239 * @throws { BusinessError } 13900008 - Bad file descriptor 3240 * @throws { BusinessError } 13900011 - Out of memory 3241 * @throws { BusinessError } 13900012 - Permission denied 3242 * @throws { BusinessError } 13900013 - Bad address 3243 * @throws { BusinessError } 13900014 - Device or resource busy 3244 * @throws { BusinessError } 13900015 - File exists 3245 * @throws { BusinessError } 13900016 - Cross-device link 3246 * @throws { BusinessError } 13900018 - Not a directory 3247 * @throws { BusinessError } 13900019 - Is a directory 3248 * @throws { BusinessError } 13900020 - Invalid argument 3249 * @throws { BusinessError } 13900025 - No space left on device 3250 * @throws { BusinessError } 13900027 - Read-only file system 3251 * @throws { BusinessError } 13900028 - Too many links 3252 * @throws { BusinessError } 13900032 - Directory not empty 3253 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 3254 * @throws { BusinessError } 13900041 - Quota exceeded 3255 * @throws { BusinessError } 13900042 - Unknown error 3256 * @syscap SystemCapability.FileManagement.File.FileIO 3257 * @since 10 3258 */ 3259declare function moveDirSync(src: string, dest: string, mode?: number): void; 3260 3261/** 3262 * Move file. 3263 * 3264 * @param { string } src - source file path. 3265 * @param { string } dest - destination file path. 3266 * @param { number } [mode = 0] - move mode when duplicate file name exists. 3267 * @returns { Promise<void> } The promise returned by the function. 3268 * @throws { BusinessError } 13900001 - Operation not permitted 3269 * @throws { BusinessError } 13900002 - No such file or directory 3270 * @throws { BusinessError } 13900008 - Bad file descriptor 3271 * @throws { BusinessError } 13900011 - Out of memory 3272 * @throws { BusinessError } 13900012 - Permission denied 3273 * @throws { BusinessError } 13900013 - Bad address 3274 * @throws { BusinessError } 13900014 - Device or resource busy 3275 * @throws { BusinessError } 13900015 - File exists 3276 * @throws { BusinessError } 13900016 - Cross-device link 3277 * @throws { BusinessError } 13900018 - Not a directory 3278 * @throws { BusinessError } 13900019 - Is a directory 3279 * @throws { BusinessError } 13900020 - Invalid argument 3280 * @throws { BusinessError } 13900025 - No space left on device 3281 * @throws { BusinessError } 13900027 - Read-only file system 3282 * @throws { BusinessError } 13900028 - Too many links 3283 * @throws { BusinessError } 13900032 - Directory not empty 3284 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 3285 * @throws { BusinessError } 13900041 - Quota exceeded 3286 * @throws { BusinessError } 13900042 - Unknown error 3287 * @syscap SystemCapability.FileManagement.File.FileIO 3288 * @since 9 3289 */ 3290/** 3291 * Move file. 3292 * 3293 * @param { string } src - source file path. 3294 * @param { string } dest - destination file path. 3295 * @param { number } [mode = 0] - move mode when duplicate file name exists. 3296 * @returns { Promise<void> } The promise returned by the function. 3297 * @throws { BusinessError } 13900001 - Operation not permitted 3298 * @throws { BusinessError } 13900002 - No such file or directory 3299 * @throws { BusinessError } 13900008 - Bad file descriptor 3300 * @throws { BusinessError } 13900011 - Out of memory 3301 * @throws { BusinessError } 13900012 - Permission denied 3302 * @throws { BusinessError } 13900013 - Bad address 3303 * @throws { BusinessError } 13900014 - Device or resource busy 3304 * @throws { BusinessError } 13900015 - File exists 3305 * @throws { BusinessError } 13900016 - Cross-device link 3306 * @throws { BusinessError } 13900018 - Not a directory 3307 * @throws { BusinessError } 13900019 - Is a directory 3308 * @throws { BusinessError } 13900020 - Invalid argument 3309 * @throws { BusinessError } 13900025 - No space left on device 3310 * @throws { BusinessError } 13900027 - Read-only file system 3311 * @throws { BusinessError } 13900028 - Too many links 3312 * @throws { BusinessError } 13900032 - Directory not empty 3313 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 3314 * @throws { BusinessError } 13900041 - Quota exceeded 3315 * @throws { BusinessError } 13900042 - Unknown error 3316 * @syscap SystemCapability.FileManagement.File.FileIO 3317 * @crossplatform 3318 * @since 10 3319 */ 3320declare function moveFile(src: string, dest: string, mode?: number): Promise<void>; 3321 3322/** 3323 * Move file. 3324 * 3325 * @param { string } src - source file path. 3326 * @param { string } dest - destination file path. 3327 * @param { AsyncCallback<void> } callback - Return the callback function. 3328 * @throws { BusinessError } 13900001 - Operation not permitted 3329 * @throws { BusinessError } 13900002 - No such file or directory 3330 * @throws { BusinessError } 13900008 - Bad file descriptor 3331 * @throws { BusinessError } 13900011 - Out of memory 3332 * @throws { BusinessError } 13900012 - Permission denied 3333 * @throws { BusinessError } 13900013 - Bad address 3334 * @throws { BusinessError } 13900014 - Device or resource busy 3335 * @throws { BusinessError } 13900015 - File exists 3336 * @throws { BusinessError } 13900016 - Cross-device link 3337 * @throws { BusinessError } 13900018 - Not a directory 3338 * @throws { BusinessError } 13900019 - Is a directory 3339 * @throws { BusinessError } 13900020 - Invalid argument 3340 * @throws { BusinessError } 13900025 - No space left on device 3341 * @throws { BusinessError } 13900027 - Read-only file system 3342 * @throws { BusinessError } 13900028 - Too many links 3343 * @throws { BusinessError } 13900032 - Directory not empty 3344 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 3345 * @throws { BusinessError } 13900041 - Quota exceeded 3346 * @throws { BusinessError } 13900042 - Unknown error 3347 * @syscap SystemCapability.FileManagement.File.FileIO 3348 * @since 9 3349 */ 3350/** 3351 * Move file. 3352 * 3353 * @param { string } src - source file path. 3354 * @param { string } dest - destination file path. 3355 * @param { AsyncCallback<void> } callback - Return the callback function. 3356 * @throws { BusinessError } 13900001 - Operation not permitted 3357 * @throws { BusinessError } 13900002 - No such file or directory 3358 * @throws { BusinessError } 13900008 - Bad file descriptor 3359 * @throws { BusinessError } 13900011 - Out of memory 3360 * @throws { BusinessError } 13900012 - Permission denied 3361 * @throws { BusinessError } 13900013 - Bad address 3362 * @throws { BusinessError } 13900014 - Device or resource busy 3363 * @throws { BusinessError } 13900015 - File exists 3364 * @throws { BusinessError } 13900016 - Cross-device link 3365 * @throws { BusinessError } 13900018 - Not a directory 3366 * @throws { BusinessError } 13900019 - Is a directory 3367 * @throws { BusinessError } 13900020 - Invalid argument 3368 * @throws { BusinessError } 13900025 - No space left on device 3369 * @throws { BusinessError } 13900027 - Read-only file system 3370 * @throws { BusinessError } 13900028 - Too many links 3371 * @throws { BusinessError } 13900032 - Directory not empty 3372 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 3373 * @throws { BusinessError } 13900041 - Quota exceeded 3374 * @throws { BusinessError } 13900042 - Unknown error 3375 * @syscap SystemCapability.FileManagement.File.FileIO 3376 * @crossplatform 3377 * @since 10 3378 */ 3379declare function moveFile(src: string, dest: string, callback: AsyncCallback<void>): void; 3380 3381/** 3382 * Move file. 3383 * 3384 * @param { string } src - source file path. 3385 * @param { string } dest - destination file path. 3386 * @param { number } [mode = 0] - move mode when duplicate file name exists. 3387 * @param { AsyncCallback<void> } callback - Return the callback function. 3388 * @throws { BusinessError } 13900001 - Operation not permitted 3389 * @throws { BusinessError } 13900002 - No such file or directory 3390 * @throws { BusinessError } 13900008 - Bad file descriptor 3391 * @throws { BusinessError } 13900011 - Out of memory 3392 * @throws { BusinessError } 13900012 - Permission denied 3393 * @throws { BusinessError } 13900013 - Bad address 3394 * @throws { BusinessError } 13900014 - Device or resource busy 3395 * @throws { BusinessError } 13900015 - File exists 3396 * @throws { BusinessError } 13900016 - Cross-device link 3397 * @throws { BusinessError } 13900018 - Not a directory 3398 * @throws { BusinessError } 13900019 - Is a directory 3399 * @throws { BusinessError } 13900020 - Invalid argument 3400 * @throws { BusinessError } 13900025 - No space left on device 3401 * @throws { BusinessError } 13900027 - Read-only file system 3402 * @throws { BusinessError } 13900028 - Too many links 3403 * @throws { BusinessError } 13900032 - Directory not empty 3404 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 3405 * @throws { BusinessError } 13900041 - Quota exceeded 3406 * @throws { BusinessError } 13900042 - Unknown error 3407 * @syscap SystemCapability.FileManagement.File.FileIO 3408 * @since 9 3409 */ 3410/** 3411 * Move file. 3412 * 3413 * @param { string } src - source file path. 3414 * @param { string } dest - destination file path. 3415 * @param { number } [mode = 0] - move mode when duplicate file name exists. 3416 * @param { AsyncCallback<void> } callback - Return the callback function. 3417 * @throws { BusinessError } 13900001 - Operation not permitted 3418 * @throws { BusinessError } 13900002 - No such file or directory 3419 * @throws { BusinessError } 13900008 - Bad file descriptor 3420 * @throws { BusinessError } 13900011 - Out of memory 3421 * @throws { BusinessError } 13900012 - Permission denied 3422 * @throws { BusinessError } 13900013 - Bad address 3423 * @throws { BusinessError } 13900014 - Device or resource busy 3424 * @throws { BusinessError } 13900015 - File exists 3425 * @throws { BusinessError } 13900016 - Cross-device link 3426 * @throws { BusinessError } 13900018 - Not a directory 3427 * @throws { BusinessError } 13900019 - Is a directory 3428 * @throws { BusinessError } 13900020 - Invalid argument 3429 * @throws { BusinessError } 13900025 - No space left on device 3430 * @throws { BusinessError } 13900027 - Read-only file system 3431 * @throws { BusinessError } 13900028 - Too many links 3432 * @throws { BusinessError } 13900032 - Directory not empty 3433 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 3434 * @throws { BusinessError } 13900041 - Quota exceeded 3435 * @throws { BusinessError } 13900042 - Unknown error 3436 * @syscap SystemCapability.FileManagement.File.FileIO 3437 * @crossplatform 3438 * @since 10 3439 */ 3440declare function moveFile(src: string, dest: string, mode: number, callback: AsyncCallback<void>): void; 3441 3442/** 3443 * Move file with sync interface. 3444 * 3445 * @param { string } src - source file path. 3446 * @param { string } dest - destination file path. 3447 * @param { number } [mode = 0] - move mode when duplicate file name exists. 3448 * @throws { BusinessError } 13900001 - Operation not permitted 3449 * @throws { BusinessError } 13900002 - No such file or directory 3450 * @throws { BusinessError } 13900008 - Bad file descriptor 3451 * @throws { BusinessError } 13900011 - Out of memory 3452 * @throws { BusinessError } 13900012 - Permission denied 3453 * @throws { BusinessError } 13900013 - Bad address 3454 * @throws { BusinessError } 13900014 - Device or resource busy 3455 * @throws { BusinessError } 13900015 - File exists 3456 * @throws { BusinessError } 13900016 - Cross-device link 3457 * @throws { BusinessError } 13900018 - Not a directory 3458 * @throws { BusinessError } 13900019 - Is a directory 3459 * @throws { BusinessError } 13900020 - Invalid argument 3460 * @throws { BusinessError } 13900025 - No space left on device 3461 * @throws { BusinessError } 13900027 - Read-only file system 3462 * @throws { BusinessError } 13900028 - Too many links 3463 * @throws { BusinessError } 13900032 - Directory not empty 3464 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 3465 * @throws { BusinessError } 13900041 - Quota exceeded 3466 * @throws { BusinessError } 13900042 - Unknown error 3467 * @syscap SystemCapability.FileManagement.File.FileIO 3468 * @since 9 3469 */ 3470/** 3471 * Move file with sync interface. 3472 * 3473 * @param { string } src - source file path. 3474 * @param { string } dest - destination file path. 3475 * @param { number } [mode = 0] - move mode when duplicate file name exists. 3476 * @throws { BusinessError } 13900001 - Operation not permitted 3477 * @throws { BusinessError } 13900002 - No such file or directory 3478 * @throws { BusinessError } 13900008 - Bad file descriptor 3479 * @throws { BusinessError } 13900011 - Out of memory 3480 * @throws { BusinessError } 13900012 - Permission denied 3481 * @throws { BusinessError } 13900013 - Bad address 3482 * @throws { BusinessError } 13900014 - Device or resource busy 3483 * @throws { BusinessError } 13900015 - File exists 3484 * @throws { BusinessError } 13900016 - Cross-device link 3485 * @throws { BusinessError } 13900018 - Not a directory 3486 * @throws { BusinessError } 13900019 - Is a directory 3487 * @throws { BusinessError } 13900020 - Invalid argument 3488 * @throws { BusinessError } 13900025 - No space left on device 3489 * @throws { BusinessError } 13900027 - Read-only file system 3490 * @throws { BusinessError } 13900028 - Too many links 3491 * @throws { BusinessError } 13900032 - Directory not empty 3492 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 3493 * @throws { BusinessError } 13900041 - Quota exceeded 3494 * @throws { BusinessError } 13900042 - Unknown error 3495 * @syscap SystemCapability.FileManagement.File.FileIO 3496 * @crossplatform 3497 * @since 10 3498 */ 3499declare function moveFileSync(src: string, dest: string, mode?: number): void; 3500 3501/** 3502 * Open file. 3503 * 3504 * @param { string } path - path. 3505 * @param { number } [mode = OpenMode.READ_ONLY] - mode. 3506 * @returns { Promise<File> } Returns the File object in Promise mode to record the file descriptor. 3507 * @throws { BusinessError } 13900001 - Operation not permitted 3508 * @throws { BusinessError } 13900002 - No such file or directory 3509 * @throws { BusinessError } 13900004 - Interrupted system call 3510 * @throws { BusinessError } 13900006 - No such device or address 3511 * @throws { BusinessError } 13900008 - Bad file descriptor 3512 * @throws { BusinessError } 13900011 - Out of memory 3513 * @throws { BusinessError } 13900012 - Permission denied 3514 * @throws { BusinessError } 13900013 - Bad address 3515 * @throws { BusinessError } 13900014 - Device or resource busy 3516 * @throws { BusinessError } 13900015 - File exists 3517 * @throws { BusinessError } 13900017 - No such device 3518 * @throws { BusinessError } 13900018 - Not a directory 3519 * @throws { BusinessError } 13900019 - Is a directory 3520 * @throws { BusinessError } 13900020 - Invalid argument 3521 * @throws { BusinessError } 13900022 - Too many open files 3522 * @throws { BusinessError } 13900023 - Text file busy 3523 * @throws { BusinessError } 13900024 - File too large 3524 * @throws { BusinessError } 13900025 - No space left on device 3525 * @throws { BusinessError } 13900027 - Read-only file system 3526 * @throws { BusinessError } 13900029 - Resource deadlock would occur 3527 * @throws { BusinessError } 13900030 - File name too long 3528 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 3529 * @throws { BusinessError } 13900034 - Operation would block 3530 * @throws { BusinessError } 13900038 - Value too large for defined data type 3531 * @throws { BusinessError } 13900041 - Quota exceeded 3532 * @throws { BusinessError } 13900042 - Unknown error 3533 * @syscap SystemCapability.FileManagement.File.FileIO 3534 * @since 9 3535 */ 3536/** 3537 * Open file. 3538 * 3539 * @param { string } path - path. 3540 * @param { number } [mode = OpenMode.READ_ONLY] - mode. 3541 * @returns { Promise<File> } Returns the File object in Promise mode to record the file descriptor. 3542 * @throws { BusinessError } 13900001 - Operation not permitted 3543 * @throws { BusinessError } 13900002 - No such file or directory 3544 * @throws { BusinessError } 13900004 - Interrupted system call 3545 * @throws { BusinessError } 13900006 - No such device or address 3546 * @throws { BusinessError } 13900008 - Bad file descriptor 3547 * @throws { BusinessError } 13900011 - Out of memory 3548 * @throws { BusinessError } 13900012 - Permission denied 3549 * @throws { BusinessError } 13900013 - Bad address 3550 * @throws { BusinessError } 13900014 - Device or resource busy 3551 * @throws { BusinessError } 13900015 - File exists 3552 * @throws { BusinessError } 13900017 - No such device 3553 * @throws { BusinessError } 13900018 - Not a directory 3554 * @throws { BusinessError } 13900019 - Is a directory 3555 * @throws { BusinessError } 13900020 - Invalid argument 3556 * @throws { BusinessError } 13900022 - Too many open files 3557 * @throws { BusinessError } 13900023 - Text file busy 3558 * @throws { BusinessError } 13900024 - File too large 3559 * @throws { BusinessError } 13900025 - No space left on device 3560 * @throws { BusinessError } 13900027 - Read-only file system 3561 * @throws { BusinessError } 13900029 - Resource deadlock would occur 3562 * @throws { BusinessError } 13900030 - File name too long 3563 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 3564 * @throws { BusinessError } 13900034 - Operation would block 3565 * @throws { BusinessError } 13900038 - Value too large for defined data type 3566 * @throws { BusinessError } 13900041 - Quota exceeded 3567 * @throws { BusinessError } 13900042 - Unknown error 3568 * @syscap SystemCapability.FileManagement.File.FileIO 3569 * @crossplatform 3570 * @since 10 3571 */ 3572/** 3573 * Open file. 3574 * 3575 * @param { string } path - path. 3576 * @param { number } [mode = OpenMode.READ_ONLY] - mode. 3577 * @returns { Promise<File> } Returns the File object in Promise mode to record the file descriptor. 3578 * @throws { BusinessError } 13900001 - Operation not permitted 3579 * @throws { BusinessError } 13900002 - No such file or directory 3580 * @throws { BusinessError } 13900004 - Interrupted system call 3581 * @throws { BusinessError } 13900006 - No such device or address 3582 * @throws { BusinessError } 13900008 - Bad file descriptor 3583 * @throws { BusinessError } 13900011 - Out of memory 3584 * @throws { BusinessError } 13900012 - Permission denied 3585 * @throws { BusinessError } 13900013 - Bad address 3586 * @throws { BusinessError } 13900014 - Device or resource busy 3587 * @throws { BusinessError } 13900015 - File exists 3588 * @throws { BusinessError } 13900017 - No such device 3589 * @throws { BusinessError } 13900018 - Not a directory 3590 * @throws { BusinessError } 13900019 - Is a directory 3591 * @throws { BusinessError } 13900020 - Invalid argument 3592 * @throws { BusinessError } 13900022 - Too many open files 3593 * @throws { BusinessError } 13900023 - Text file busy 3594 * @throws { BusinessError } 13900024 - File too large 3595 * @throws { BusinessError } 13900025 - No space left on device 3596 * @throws { BusinessError } 13900027 - Read-only file system 3597 * @throws { BusinessError } 13900029 - Resource deadlock would occur 3598 * @throws { BusinessError } 13900030 - File name too long 3599 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 3600 * @throws { BusinessError } 13900034 - Operation would block 3601 * @throws { BusinessError } 13900038 - Value too large for defined data type 3602 * @throws { BusinessError } 13900041 - Quota exceeded 3603 * @throws { BusinessError } 13900042 - Unknown error 3604 * @syscap SystemCapability.FileManagement.File.FileIO 3605 * @crossplatform 3606 * @atomicservice 3607 * @since 11 3608 */ 3609/** 3610 * Open file. 3611 * 3612 * @param { string } path - path. 3613 * @param { number } [mode = OpenMode.READ_ONLY] - mode. 3614 * @returns { Promise<File> } Returns the File object in Promise mode to record the file descriptor. 3615 * @throws { BusinessError } 13900001 - Operation not permitted 3616 * @throws { BusinessError } 13900002 - No such file or directory 3617 * @throws { BusinessError } 13900004 - Interrupted system call 3618 * @throws { BusinessError } 13900006 - No such device or address 3619 * @throws { BusinessError } 13900008 - Bad file descriptor 3620 * @throws { BusinessError } 13900011 - Out of memory 3621 * @throws { BusinessError } 13900012 - Permission denied 3622 * @throws { BusinessError } 13900013 - Bad address 3623 * @throws { BusinessError } 13900014 - Device or resource busy 3624 * @throws { BusinessError } 13900015 - File exists 3625 * @throws { BusinessError } 13900017 - No such device 3626 * @throws { BusinessError } 13900018 - Not a directory 3627 * @throws { BusinessError } 13900019 - Is a directory 3628 * @throws { BusinessError } 13900020 - Invalid argument 3629 * @throws { BusinessError } 13900022 - Too many open files 3630 * @throws { BusinessError } 13900023 - Text file busy 3631 * @throws { BusinessError } 13900024 - File too large 3632 * @throws { BusinessError } 13900025 - No space left on device 3633 * @throws { BusinessError } 13900027 - Read-only file system 3634 * @throws { BusinessError } 13900029 - Resource deadlock would occur 3635 * @throws { BusinessError } 13900030 - File name too long 3636 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 3637 * @throws { BusinessError } 13900034 - Operation would block 3638 * @throws { BusinessError } 13900038 - Value too large for defined data type 3639 * @throws { BusinessError } 13900041 - Quota exceeded 3640 * @throws { BusinessError } 13900042 - Unknown error 3641 * @throws { BusinessError } 13900044 - Network is unreachable 3642 * @syscap SystemCapability.FileManagement.File.FileIO 3643 * @crossplatform 3644 * @atomicservice 3645 * @since 12 3646 */ 3647declare function open(path: string, mode?: number): Promise<File>; 3648 3649/** 3650 * Open file. 3651 * 3652 * @param { string } path - path. 3653 * @param { AsyncCallback<File> } callback - The callback is used to return the File object to record the file descriptor. 3654 * @throws { BusinessError } 13900001 - Operation not permitted 3655 * @throws { BusinessError } 13900002 - No such file or directory 3656 * @throws { BusinessError } 13900004 - Interrupted system call 3657 * @throws { BusinessError } 13900006 - No such device or address 3658 * @throws { BusinessError } 13900008 - Bad file descriptor 3659 * @throws { BusinessError } 13900011 - Out of memory 3660 * @throws { BusinessError } 13900012 - Permission denied 3661 * @throws { BusinessError } 13900013 - Bad address 3662 * @throws { BusinessError } 13900014 - Device or resource busy 3663 * @throws { BusinessError } 13900015 - File exists 3664 * @throws { BusinessError } 13900017 - No such device 3665 * @throws { BusinessError } 13900018 - Not a directory 3666 * @throws { BusinessError } 13900019 - Is a directory 3667 * @throws { BusinessError } 13900020 - Invalid argument 3668 * @throws { BusinessError } 13900022 - Too many open files 3669 * @throws { BusinessError } 13900023 - Text file busy 3670 * @throws { BusinessError } 13900024 - File too large 3671 * @throws { BusinessError } 13900025 - No space left on device 3672 * @throws { BusinessError } 13900027 - Read-only file system 3673 * @throws { BusinessError } 13900029 - Resource deadlock would occur 3674 * @throws { BusinessError } 13900030 - File name too long 3675 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 3676 * @throws { BusinessError } 13900034 - Operation would block 3677 * @throws { BusinessError } 13900038 - Value too large for defined data type 3678 * @throws { BusinessError } 13900041 - Quota exceeded 3679 * @throws { BusinessError } 13900042 - Unknown error 3680 * @syscap SystemCapability.FileManagement.File.FileIO 3681 * @since 9 3682 */ 3683/** 3684 * Open file. 3685 * 3686 * @param { string } path - path. 3687 * @param { AsyncCallback<File> } callback - The callback is used to return the File object to record the file descriptor. 3688 * @throws { BusinessError } 13900001 - Operation not permitted 3689 * @throws { BusinessError } 13900002 - No such file or directory 3690 * @throws { BusinessError } 13900004 - Interrupted system call 3691 * @throws { BusinessError } 13900006 - No such device or address 3692 * @throws { BusinessError } 13900008 - Bad file descriptor 3693 * @throws { BusinessError } 13900011 - Out of memory 3694 * @throws { BusinessError } 13900012 - Permission denied 3695 * @throws { BusinessError } 13900013 - Bad address 3696 * @throws { BusinessError } 13900014 - Device or resource busy 3697 * @throws { BusinessError } 13900015 - File exists 3698 * @throws { BusinessError } 13900017 - No such device 3699 * @throws { BusinessError } 13900018 - Not a directory 3700 * @throws { BusinessError } 13900019 - Is a directory 3701 * @throws { BusinessError } 13900020 - Invalid argument 3702 * @throws { BusinessError } 13900022 - Too many open files 3703 * @throws { BusinessError } 13900023 - Text file busy 3704 * @throws { BusinessError } 13900024 - File too large 3705 * @throws { BusinessError } 13900025 - No space left on device 3706 * @throws { BusinessError } 13900027 - Read-only file system 3707 * @throws { BusinessError } 13900029 - Resource deadlock would occur 3708 * @throws { BusinessError } 13900030 - File name too long 3709 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 3710 * @throws { BusinessError } 13900034 - Operation would block 3711 * @throws { BusinessError } 13900038 - Value too large for defined data type 3712 * @throws { BusinessError } 13900041 - Quota exceeded 3713 * @throws { BusinessError } 13900042 - Unknown error 3714 * @syscap SystemCapability.FileManagement.File.FileIO 3715 * @crossplatform 3716 * @since 10 3717 */ 3718/** 3719 * Open file. 3720 * 3721 * @param { string } path - path. 3722 * @param { AsyncCallback<File> } callback - The callback is used to return the File object to record the file descriptor. 3723 * @throws { BusinessError } 13900001 - Operation not permitted 3724 * @throws { BusinessError } 13900002 - No such file or directory 3725 * @throws { BusinessError } 13900004 - Interrupted system call 3726 * @throws { BusinessError } 13900006 - No such device or address 3727 * @throws { BusinessError } 13900008 - Bad file descriptor 3728 * @throws { BusinessError } 13900011 - Out of memory 3729 * @throws { BusinessError } 13900012 - Permission denied 3730 * @throws { BusinessError } 13900013 - Bad address 3731 * @throws { BusinessError } 13900014 - Device or resource busy 3732 * @throws { BusinessError } 13900015 - File exists 3733 * @throws { BusinessError } 13900017 - No such device 3734 * @throws { BusinessError } 13900018 - Not a directory 3735 * @throws { BusinessError } 13900019 - Is a directory 3736 * @throws { BusinessError } 13900020 - Invalid argument 3737 * @throws { BusinessError } 13900022 - Too many open files 3738 * @throws { BusinessError } 13900023 - Text file busy 3739 * @throws { BusinessError } 13900024 - File too large 3740 * @throws { BusinessError } 13900025 - No space left on device 3741 * @throws { BusinessError } 13900027 - Read-only file system 3742 * @throws { BusinessError } 13900029 - Resource deadlock would occur 3743 * @throws { BusinessError } 13900030 - File name too long 3744 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 3745 * @throws { BusinessError } 13900034 - Operation would block 3746 * @throws { BusinessError } 13900038 - Value too large for defined data type 3747 * @throws { BusinessError } 13900041 - Quota exceeded 3748 * @throws { BusinessError } 13900042 - Unknown error 3749 * @syscap SystemCapability.FileManagement.File.FileIO 3750 * @crossplatform 3751 * @atomicservice 3752 * @since 11 3753 */ 3754declare function open(path: string, callback: AsyncCallback<File>): void; 3755 3756/** 3757 * Open file. 3758 * 3759 * @param { string } path - path. 3760 * @param { number } [mode = OpenMode.READ_ONLY] - mode. 3761 * @param { AsyncCallback<File> } callback - The callback is used to return the File object to record the file descriptor. 3762 * @throws { BusinessError } 13900001 - Operation not permitted 3763 * @throws { BusinessError } 13900002 - No such file or directory 3764 * @throws { BusinessError } 13900004 - Interrupted system call 3765 * @throws { BusinessError } 13900006 - No such device or address 3766 * @throws { BusinessError } 13900008 - Bad file descriptor 3767 * @throws { BusinessError } 13900011 - Out of memory 3768 * @throws { BusinessError } 13900012 - Permission denied 3769 * @throws { BusinessError } 13900013 - Bad address 3770 * @throws { BusinessError } 13900014 - Device or resource busy 3771 * @throws { BusinessError } 13900015 - File exists 3772 * @throws { BusinessError } 13900017 - No such device 3773 * @throws { BusinessError } 13900018 - Not a directory 3774 * @throws { BusinessError } 13900019 - Is a directory 3775 * @throws { BusinessError } 13900020 - Invalid argument 3776 * @throws { BusinessError } 13900022 - Too many open files 3777 * @throws { BusinessError } 13900023 - Text file busy 3778 * @throws { BusinessError } 13900024 - File too large 3779 * @throws { BusinessError } 13900025 - No space left on device 3780 * @throws { BusinessError } 13900027 - Read-only file system 3781 * @throws { BusinessError } 13900029 - Resource deadlock would occur 3782 * @throws { BusinessError } 13900030 - File name too long 3783 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 3784 * @throws { BusinessError } 13900034 - Operation would block 3785 * @throws { BusinessError } 13900038 - Value too large for defined data type 3786 * @throws { BusinessError } 13900041 - Quota exceeded 3787 * @throws { BusinessError } 13900042 - Unknown error 3788 * @syscap SystemCapability.FileManagement.File.FileIO 3789 * @since 9 3790 */ 3791/** 3792 * Open file. 3793 * 3794 * @param { string } path - path. 3795 * @param { number } [mode = OpenMode.READ_ONLY] - mode. 3796 * @param { AsyncCallback<File> } callback - The callback is used to return the File object to record the file descriptor. 3797 * @throws { BusinessError } 13900001 - Operation not permitted 3798 * @throws { BusinessError } 13900002 - No such file or directory 3799 * @throws { BusinessError } 13900004 - Interrupted system call 3800 * @throws { BusinessError } 13900006 - No such device or address 3801 * @throws { BusinessError } 13900008 - Bad file descriptor 3802 * @throws { BusinessError } 13900011 - Out of memory 3803 * @throws { BusinessError } 13900012 - Permission denied 3804 * @throws { BusinessError } 13900013 - Bad address 3805 * @throws { BusinessError } 13900014 - Device or resource busy 3806 * @throws { BusinessError } 13900015 - File exists 3807 * @throws { BusinessError } 13900017 - No such device 3808 * @throws { BusinessError } 13900018 - Not a directory 3809 * @throws { BusinessError } 13900019 - Is a directory 3810 * @throws { BusinessError } 13900020 - Invalid argument 3811 * @throws { BusinessError } 13900022 - Too many open files 3812 * @throws { BusinessError } 13900023 - Text file busy 3813 * @throws { BusinessError } 13900024 - File too large 3814 * @throws { BusinessError } 13900025 - No space left on device 3815 * @throws { BusinessError } 13900027 - Read-only file system 3816 * @throws { BusinessError } 13900029 - Resource deadlock would occur 3817 * @throws { BusinessError } 13900030 - File name too long 3818 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 3819 * @throws { BusinessError } 13900034 - Operation would block 3820 * @throws { BusinessError } 13900038 - Value too large for defined data type 3821 * @throws { BusinessError } 13900041 - Quota exceeded 3822 * @throws { BusinessError } 13900042 - Unknown error 3823 * @syscap SystemCapability.FileManagement.File.FileIO 3824 * @crossplatform 3825 * @since 10 3826 */ 3827/** 3828 * Open file. 3829 * 3830 * @param { string } path - path. 3831 * @param { number } [mode = OpenMode.READ_ONLY] - mode. 3832 * @param { AsyncCallback<File> } callback - The callback is used to return the File object to record the file descriptor. 3833 * @throws { BusinessError } 13900001 - Operation not permitted 3834 * @throws { BusinessError } 13900002 - No such file or directory 3835 * @throws { BusinessError } 13900004 - Interrupted system call 3836 * @throws { BusinessError } 13900006 - No such device or address 3837 * @throws { BusinessError } 13900008 - Bad file descriptor 3838 * @throws { BusinessError } 13900011 - Out of memory 3839 * @throws { BusinessError } 13900012 - Permission denied 3840 * @throws { BusinessError } 13900013 - Bad address 3841 * @throws { BusinessError } 13900014 - Device or resource busy 3842 * @throws { BusinessError } 13900015 - File exists 3843 * @throws { BusinessError } 13900017 - No such device 3844 * @throws { BusinessError } 13900018 - Not a directory 3845 * @throws { BusinessError } 13900019 - Is a directory 3846 * @throws { BusinessError } 13900020 - Invalid argument 3847 * @throws { BusinessError } 13900022 - Too many open files 3848 * @throws { BusinessError } 13900023 - Text file busy 3849 * @throws { BusinessError } 13900024 - File too large 3850 * @throws { BusinessError } 13900025 - No space left on device 3851 * @throws { BusinessError } 13900027 - Read-only file system 3852 * @throws { BusinessError } 13900029 - Resource deadlock would occur 3853 * @throws { BusinessError } 13900030 - File name too long 3854 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 3855 * @throws { BusinessError } 13900034 - Operation would block 3856 * @throws { BusinessError } 13900038 - Value too large for defined data type 3857 * @throws { BusinessError } 13900041 - Quota exceeded 3858 * @throws { BusinessError } 13900042 - Unknown error 3859 * @syscap SystemCapability.FileManagement.File.FileIO 3860 * @crossplatform 3861 * @atomicservice 3862 * @since 11 3863 */ 3864declare function open(path: string, mode: number, callback: AsyncCallback<File>): void; 3865 3866/** 3867 * Open file with sync interface. 3868 * 3869 * @param { string } path - path. 3870 * @param { number } [mode = OpenMode.READ_ONLY] - mode. 3871 * @returns { File } Returns the File object to record the file descriptor. 3872 * @throws { BusinessError } 13900001 - Operation not permitted 3873 * @throws { BusinessError } 13900002 - No such file or directory 3874 * @throws { BusinessError } 13900004 - Interrupted system call 3875 * @throws { BusinessError } 13900006 - No such device or address 3876 * @throws { BusinessError } 13900008 - Bad file descriptor 3877 * @throws { BusinessError } 13900011 - Out of memory 3878 * @throws { BusinessError } 13900012 - Permission denied 3879 * @throws { BusinessError } 13900013 - Bad address 3880 * @throws { BusinessError } 13900014 - Device or resource busy 3881 * @throws { BusinessError } 13900015 - File exists 3882 * @throws { BusinessError } 13900017 - No such device 3883 * @throws { BusinessError } 13900018 - Not a directory 3884 * @throws { BusinessError } 13900019 - Is a directory 3885 * @throws { BusinessError } 13900020 - Invalid argument 3886 * @throws { BusinessError } 13900022 - Too many open files 3887 * @throws { BusinessError } 13900023 - Text file busy 3888 * @throws { BusinessError } 13900024 - File too large 3889 * @throws { BusinessError } 13900025 - No space left on device 3890 * @throws { BusinessError } 13900027 - Read-only file system 3891 * @throws { BusinessError } 13900029 - Resource deadlock would occur 3892 * @throws { BusinessError } 13900030 - File name too long 3893 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 3894 * @throws { BusinessError } 13900034 - Operation would block 3895 * @throws { BusinessError } 13900038 - Value too large for defined data type 3896 * @throws { BusinessError } 13900041 - Quota exceeded 3897 * @throws { BusinessError } 13900042 - Unknown error 3898 * @syscap SystemCapability.FileManagement.File.FileIO 3899 * @since 9 3900 */ 3901/** 3902 * Open file with sync interface. 3903 * 3904 * @param { string } path - path. 3905 * @param { number } [mode = OpenMode.READ_ONLY] - mode. 3906 * @returns { File } Returns the File object to record the file descriptor. 3907 * @throws { BusinessError } 13900001 - Operation not permitted 3908 * @throws { BusinessError } 13900002 - No such file or directory 3909 * @throws { BusinessError } 13900004 - Interrupted system call 3910 * @throws { BusinessError } 13900006 - No such device or address 3911 * @throws { BusinessError } 13900008 - Bad file descriptor 3912 * @throws { BusinessError } 13900011 - Out of memory 3913 * @throws { BusinessError } 13900012 - Permission denied 3914 * @throws { BusinessError } 13900013 - Bad address 3915 * @throws { BusinessError } 13900014 - Device or resource busy 3916 * @throws { BusinessError } 13900015 - File exists 3917 * @throws { BusinessError } 13900017 - No such device 3918 * @throws { BusinessError } 13900018 - Not a directory 3919 * @throws { BusinessError } 13900019 - Is a directory 3920 * @throws { BusinessError } 13900020 - Invalid argument 3921 * @throws { BusinessError } 13900022 - Too many open files 3922 * @throws { BusinessError } 13900023 - Text file busy 3923 * @throws { BusinessError } 13900024 - File too large 3924 * @throws { BusinessError } 13900025 - No space left on device 3925 * @throws { BusinessError } 13900027 - Read-only file system 3926 * @throws { BusinessError } 13900029 - Resource deadlock would occur 3927 * @throws { BusinessError } 13900030 - File name too long 3928 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 3929 * @throws { BusinessError } 13900034 - Operation would block 3930 * @throws { BusinessError } 13900038 - Value too large for defined data type 3931 * @throws { BusinessError } 13900041 - Quota exceeded 3932 * @throws { BusinessError } 13900042 - Unknown error 3933 * @syscap SystemCapability.FileManagement.File.FileIO 3934 * @crossplatform 3935 * @since 10 3936 */ 3937/** 3938 * Open file with sync interface. 3939 * 3940 * @param { string } path - path. 3941 * @param { number } [mode = OpenMode.READ_ONLY] - mode. 3942 * @returns { File } Returns the File object to record the file descriptor. 3943 * @throws { BusinessError } 13900001 - Operation not permitted 3944 * @throws { BusinessError } 13900002 - No such file or directory 3945 * @throws { BusinessError } 13900004 - Interrupted system call 3946 * @throws { BusinessError } 13900006 - No such device or address 3947 * @throws { BusinessError } 13900008 - Bad file descriptor 3948 * @throws { BusinessError } 13900011 - Out of memory 3949 * @throws { BusinessError } 13900012 - Permission denied 3950 * @throws { BusinessError } 13900013 - Bad address 3951 * @throws { BusinessError } 13900014 - Device or resource busy 3952 * @throws { BusinessError } 13900015 - File exists 3953 * @throws { BusinessError } 13900017 - No such device 3954 * @throws { BusinessError } 13900018 - Not a directory 3955 * @throws { BusinessError } 13900019 - Is a directory 3956 * @throws { BusinessError } 13900020 - Invalid argument 3957 * @throws { BusinessError } 13900022 - Too many open files 3958 * @throws { BusinessError } 13900023 - Text file busy 3959 * @throws { BusinessError } 13900024 - File too large 3960 * @throws { BusinessError } 13900025 - No space left on device 3961 * @throws { BusinessError } 13900027 - Read-only file system 3962 * @throws { BusinessError } 13900029 - Resource deadlock would occur 3963 * @throws { BusinessError } 13900030 - File name too long 3964 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 3965 * @throws { BusinessError } 13900034 - Operation would block 3966 * @throws { BusinessError } 13900038 - Value too large for defined data type 3967 * @throws { BusinessError } 13900041 - Quota exceeded 3968 * @throws { BusinessError } 13900042 - Unknown error 3969 * @syscap SystemCapability.FileManagement.File.FileIO 3970 * @crossplatform 3971 * @atomicservice 3972 * @since 11 3973 */ 3974/** 3975 * Open file with sync interface. 3976 * 3977 * @param { string } path - path. 3978 * @param { number } [mode = OpenMode.READ_ONLY] - mode. 3979 * @returns { File } Returns the File object to record the file descriptor. 3980 * @throws { BusinessError } 13900001 - Operation not permitted 3981 * @throws { BusinessError } 13900002 - No such file or directory 3982 * @throws { BusinessError } 13900004 - Interrupted system call 3983 * @throws { BusinessError } 13900006 - No such device or address 3984 * @throws { BusinessError } 13900008 - Bad file descriptor 3985 * @throws { BusinessError } 13900011 - Out of memory 3986 * @throws { BusinessError } 13900012 - Permission denied 3987 * @throws { BusinessError } 13900013 - Bad address 3988 * @throws { BusinessError } 13900014 - Device or resource busy 3989 * @throws { BusinessError } 13900015 - File exists 3990 * @throws { BusinessError } 13900017 - No such device 3991 * @throws { BusinessError } 13900018 - Not a directory 3992 * @throws { BusinessError } 13900019 - Is a directory 3993 * @throws { BusinessError } 13900020 - Invalid argument 3994 * @throws { BusinessError } 13900022 - Too many open files 3995 * @throws { BusinessError } 13900023 - Text file busy 3996 * @throws { BusinessError } 13900024 - File too large 3997 * @throws { BusinessError } 13900025 - No space left on device 3998 * @throws { BusinessError } 13900027 - Read-only file system 3999 * @throws { BusinessError } 13900029 - Resource deadlock would occur 4000 * @throws { BusinessError } 13900030 - File name too long 4001 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 4002 * @throws { BusinessError } 13900034 - Operation would block 4003 * @throws { BusinessError } 13900038 - Value too large for defined data type 4004 * @throws { BusinessError } 13900041 - Quota exceeded 4005 * @throws { BusinessError } 13900042 - Unknown error 4006 * @throws { BusinessError } 13900044 - Network is unreachable 4007 * @syscap SystemCapability.FileManagement.File.FileIO 4008 * @crossplatform 4009 * @atomicservice 4010 * @since 12 4011 */ 4012declare function openSync(path: string, mode?: number): File; 4013 4014/** 4015 * Read file. 4016 * 4017 * @param { number } fd - file descriptor. 4018 * @param { ArrayBuffer } buffer - buffer. 4019 * @param { object } [options] - options. 4020 * @returns { Promise<number> } Returns the number of file bytes read to buffer in promise mode. 4021 * @throws { BusinessError } 13900004 - Interrupted system call 4022 * @throws { BusinessError } 13900005 - I/O error 4023 * @throws { BusinessError } 13900008 - Bad file descriptor 4024 * @throws { BusinessError } 13900010 - Try again 4025 * @throws { BusinessError } 13900013 - Bad address 4026 * @throws { BusinessError } 13900019 - Is a directory 4027 * @throws { BusinessError } 13900020 - Invalid argument 4028 * @throws { BusinessError } 13900034 - Operation would block 4029 * @throws { BusinessError } 13900042 - Unknown error 4030 * @syscap SystemCapability.FileManagement.File.FileIO 4031 * @since 9 4032 */ 4033/** 4034 * Read file. 4035 * 4036 * @param { number } fd - file descriptor. 4037 * @param { ArrayBuffer } buffer - buffer. 4038 * @param { object } [options] - options. 4039 * @returns { Promise<number> } Returns the number of file bytes read to buffer in promise mode. 4040 * @throws { BusinessError } 13900004 - Interrupted system call 4041 * @throws { BusinessError } 13900005 - I/O error 4042 * @throws { BusinessError } 13900008 - Bad file descriptor 4043 * @throws { BusinessError } 13900010 - Try again 4044 * @throws { BusinessError } 13900013 - Bad address 4045 * @throws { BusinessError } 13900019 - Is a directory 4046 * @throws { BusinessError } 13900020 - Invalid argument 4047 * @throws { BusinessError } 13900034 - Operation would block 4048 * @throws { BusinessError } 13900042 - Unknown error 4049 * @syscap SystemCapability.FileManagement.File.FileIO 4050 * @crossplatform 4051 * @since 10 4052 */ 4053/** 4054 * Read file. 4055 * 4056 * @param { number } fd - file descriptor. 4057 * @param { ArrayBuffer } buffer - buffer. 4058 * @param { ReadOptions } [options] - options. 4059 * @returns { Promise<number> } Returns the number of file bytes read to buffer in promise mode. 4060 * @throws { BusinessError } 13900004 - Interrupted system call 4061 * @throws { BusinessError } 13900005 - I/O error 4062 * @throws { BusinessError } 13900008 - Bad file descriptor 4063 * @throws { BusinessError } 13900010 - Try again 4064 * @throws { BusinessError } 13900013 - Bad address 4065 * @throws { BusinessError } 13900019 - Is a directory 4066 * @throws { BusinessError } 13900020 - Invalid argument 4067 * @throws { BusinessError } 13900034 - Operation would block 4068 * @throws { BusinessError } 13900042 - Unknown error 4069 * @syscap SystemCapability.FileManagement.File.FileIO 4070 * @crossplatform 4071 * @atomicservice 4072 * @since 11 4073 */ 4074/** 4075 * Read file. 4076 * 4077 * @param { number } fd - file descriptor. 4078 * @param { ArrayBuffer } buffer - buffer. 4079 * @param { ReadOptions } [options] - options. 4080 * @returns { Promise<number> } Returns the number of file bytes read to buffer in promise mode. 4081 * @throws { BusinessError } 13900004 - Interrupted system call 4082 * @throws { BusinessError } 13900005 - I/O error 4083 * @throws { BusinessError } 13900008 - Bad file descriptor 4084 * @throws { BusinessError } 13900010 - Try again 4085 * @throws { BusinessError } 13900013 - Bad address 4086 * @throws { BusinessError } 13900019 - Is a directory 4087 * @throws { BusinessError } 13900020 - Invalid argument 4088 * @throws { BusinessError } 13900034 - Operation would block 4089 * @throws { BusinessError } 13900042 - Unknown error 4090 * @throws { BusinessError } 13900044 - Network is unreachable 4091 * @syscap SystemCapability.FileManagement.File.FileIO 4092 * @crossplatform 4093 * @atomicservice 4094 * @since 12 4095 */ 4096declare function read( 4097 fd: number, 4098 buffer: ArrayBuffer, 4099 options?: ReadOptions 4100): Promise<number>; 4101 4102/** 4103 * Read file. 4104 * 4105 * @param { number } fd - file descriptor. 4106 * @param { ArrayBuffer } buffer - buffer. 4107 * @param { AsyncCallback<number> } callback - The callback is used to return the number of file bytes read to buffer. 4108 * @throws { BusinessError } 13900004 - Interrupted system call 4109 * @throws { BusinessError } 13900005 - I/O error 4110 * @throws { BusinessError } 13900008 - Bad file descriptor 4111 * @throws { BusinessError } 13900010 - Try again 4112 * @throws { BusinessError } 13900013 - Bad address 4113 * @throws { BusinessError } 13900019 - Is a directory 4114 * @throws { BusinessError } 13900020 - Invalid argument 4115 * @throws { BusinessError } 13900034 - Operation would block 4116 * @throws { BusinessError } 13900042 - Unknown error 4117 * @syscap SystemCapability.FileManagement.File.FileIO 4118 * @since 9 4119 */ 4120/** 4121 * Read file. 4122 * 4123 * @param { number } fd - file descriptor. 4124 * @param { ArrayBuffer } buffer - buffer. 4125 * @param { AsyncCallback<number> } callback - The callback is used to return the number of file bytes read to buffer. 4126 * @throws { BusinessError } 13900004 - Interrupted system call 4127 * @throws { BusinessError } 13900005 - I/O error 4128 * @throws { BusinessError } 13900008 - Bad file descriptor 4129 * @throws { BusinessError } 13900010 - Try again 4130 * @throws { BusinessError } 13900013 - Bad address 4131 * @throws { BusinessError } 13900019 - Is a directory 4132 * @throws { BusinessError } 13900020 - Invalid argument 4133 * @throws { BusinessError } 13900034 - Operation would block 4134 * @throws { BusinessError } 13900042 - Unknown error 4135 * @syscap SystemCapability.FileManagement.File.FileIO 4136 * @crossplatform 4137 * @since 10 4138 */ 4139/** 4140 * Read file. 4141 * 4142 * @param { number } fd - file descriptor. 4143 * @param { ArrayBuffer } buffer - buffer. 4144 * @param { AsyncCallback<number> } callback - The callback is used to return the number of file bytes read to buffer. 4145 * @throws { BusinessError } 13900004 - Interrupted system call 4146 * @throws { BusinessError } 13900005 - I/O error 4147 * @throws { BusinessError } 13900008 - Bad file descriptor 4148 * @throws { BusinessError } 13900010 - Try again 4149 * @throws { BusinessError } 13900013 - Bad address 4150 * @throws { BusinessError } 13900019 - Is a directory 4151 * @throws { BusinessError } 13900020 - Invalid argument 4152 * @throws { BusinessError } 13900034 - Operation would block 4153 * @throws { BusinessError } 13900042 - Unknown error 4154 * @syscap SystemCapability.FileManagement.File.FileIO 4155 * @crossplatform 4156 * @atomicservice 4157 * @since 11 4158 */ 4159declare function read(fd: number, buffer: ArrayBuffer, callback: AsyncCallback<number>): void; 4160 4161/** 4162 * Read file. 4163 * 4164 * @param { number } fd - file descriptor. 4165 * @param { ArrayBuffer } buffer - buffer. 4166 * @param { object } [options] - options. 4167 * @param { AsyncCallback<number> } callback - The callback is used to return the number of file bytes read to buffer. 4168 * @throws { BusinessError } 13900004 - Interrupted system call 4169 * @throws { BusinessError } 13900005 - I/O error 4170 * @throws { BusinessError } 13900008 - Bad file descriptor 4171 * @throws { BusinessError } 13900010 - Try again 4172 * @throws { BusinessError } 13900013 - Bad address 4173 * @throws { BusinessError } 13900019 - Is a directory 4174 * @throws { BusinessError } 13900020 - Invalid argument 4175 * @throws { BusinessError } 13900034 - Operation would block 4176 * @throws { BusinessError } 13900042 - Unknown error 4177 * @syscap SystemCapability.FileManagement.File.FileIO 4178 * @since 9 4179 */ 4180/** 4181 * Read file. 4182 * 4183 * @param { number } fd - file descriptor. 4184 * @param { ArrayBuffer } buffer - buffer. 4185 * @param { object } [options] - options. 4186 * @param { AsyncCallback<number> } callback - The callback is used to return the number of file bytes read to buffer. 4187 * @throws { BusinessError } 13900004 - Interrupted system call 4188 * @throws { BusinessError } 13900005 - I/O error 4189 * @throws { BusinessError } 13900008 - Bad file descriptor 4190 * @throws { BusinessError } 13900010 - Try again 4191 * @throws { BusinessError } 13900013 - Bad address 4192 * @throws { BusinessError } 13900019 - Is a directory 4193 * @throws { BusinessError } 13900020 - Invalid argument 4194 * @throws { BusinessError } 13900034 - Operation would block 4195 * @throws { BusinessError } 13900042 - Unknown error 4196 * @syscap SystemCapability.FileManagement.File.FileIO 4197 * @crossplatform 4198 * @since 10 4199 */ 4200/** 4201 * Read file. 4202 * 4203 * @param { number } fd - file descriptor. 4204 * @param { ArrayBuffer } buffer - buffer. 4205 * @param { ReadOptions } [options] - options. 4206 * @param { AsyncCallback<number> } callback - The callback is used to return the number of file bytes read to buffer. 4207 * @throws { BusinessError } 13900004 - Interrupted system call 4208 * @throws { BusinessError } 13900005 - I/O error 4209 * @throws { BusinessError } 13900008 - Bad file descriptor 4210 * @throws { BusinessError } 13900010 - Try again 4211 * @throws { BusinessError } 13900013 - Bad address 4212 * @throws { BusinessError } 13900019 - Is a directory 4213 * @throws { BusinessError } 13900020 - Invalid argument 4214 * @throws { BusinessError } 13900034 - Operation would block 4215 * @throws { BusinessError } 13900042 - Unknown error 4216 * @syscap SystemCapability.FileManagement.File.FileIO 4217 * @crossplatform 4218 * @atomicservice 4219 * @since 11 4220 */ 4221declare function read( 4222 fd: number, 4223 buffer: ArrayBuffer, 4224 options: ReadOptions, 4225 callback: AsyncCallback<number> 4226): void; 4227 4228/** 4229 * Read file with sync interface. 4230 * 4231 * @param { number } fd - file descriptor. 4232 * @param { ArrayBuffer } buffer - buffer. 4233 * @param { object } [options] - options. 4234 * @returns { number } Returns the number of file bytes read to buffer. 4235 * @throws { BusinessError } 13900004 - Interrupted system call 4236 * @throws { BusinessError } 13900005 - I/O error 4237 * @throws { BusinessError } 13900008 - Bad file descriptor 4238 * @throws { BusinessError } 13900010 - Try again 4239 * @throws { BusinessError } 13900013 - Bad address 4240 * @throws { BusinessError } 13900019 - Is a directory 4241 * @throws { BusinessError } 13900020 - Invalid argument 4242 * @throws { BusinessError } 13900034 - Operation would block 4243 * @throws { BusinessError } 13900042 - Unknown error 4244 * @syscap SystemCapability.FileManagement.File.FileIO 4245 * @since 9 4246 */ 4247/** 4248 * Read file with sync interface. 4249 * 4250 * @param { number } fd - file descriptor. 4251 * @param { ArrayBuffer } buffer - buffer. 4252 * @param { object } [options] - options. 4253 * @returns { number } Returns the number of file bytes read to buffer. 4254 * @throws { BusinessError } 13900004 - Interrupted system call 4255 * @throws { BusinessError } 13900005 - I/O error 4256 * @throws { BusinessError } 13900008 - Bad file descriptor 4257 * @throws { BusinessError } 13900010 - Try again 4258 * @throws { BusinessError } 13900013 - Bad address 4259 * @throws { BusinessError } 13900019 - Is a directory 4260 * @throws { BusinessError } 13900020 - Invalid argument 4261 * @throws { BusinessError } 13900034 - Operation would block 4262 * @throws { BusinessError } 13900042 - Unknown error 4263 * @syscap SystemCapability.FileManagement.File.FileIO 4264 * @crossplatform 4265 * @since 10 4266 */ 4267/** 4268 * Read file with sync interface. 4269 * 4270 * @param { number } fd - file descriptor. 4271 * @param { ArrayBuffer } buffer - buffer. 4272 * @param { ReadOptions } [options] - options. 4273 * @returns { number } Returns the number of file bytes read to buffer. 4274 * @throws { BusinessError } 13900004 - Interrupted system call 4275 * @throws { BusinessError } 13900005 - I/O error 4276 * @throws { BusinessError } 13900008 - Bad file descriptor 4277 * @throws { BusinessError } 13900010 - Try again 4278 * @throws { BusinessError } 13900013 - Bad address 4279 * @throws { BusinessError } 13900019 - Is a directory 4280 * @throws { BusinessError } 13900020 - Invalid argument 4281 * @throws { BusinessError } 13900034 - Operation would block 4282 * @throws { BusinessError } 13900042 - Unknown error 4283 * @syscap SystemCapability.FileManagement.File.FileIO 4284 * @crossplatform 4285 * @atomicservice 4286 * @since 11 4287 */ 4288/** 4289 * Read file with sync interface. 4290 * 4291 * @param { number } fd - file descriptor. 4292 * @param { ArrayBuffer } buffer - buffer. 4293 * @param { ReadOptions } [options] - options. 4294 * @returns { number } Returns the number of file bytes read to buffer. 4295 * @throws { BusinessError } 13900004 - Interrupted system call 4296 * @throws { BusinessError } 13900005 - I/O error 4297 * @throws { BusinessError } 13900008 - Bad file descriptor 4298 * @throws { BusinessError } 13900010 - Try again 4299 * @throws { BusinessError } 13900013 - Bad address 4300 * @throws { BusinessError } 13900019 - Is a directory 4301 * @throws { BusinessError } 13900020 - Invalid argument 4302 * @throws { BusinessError } 13900034 - Operation would block 4303 * @throws { BusinessError } 13900042 - Unknown error 4304 * @throws { BusinessError } 13900044 - Network is unreachable 4305 * @syscap SystemCapability.FileManagement.File.FileIO 4306 * @crossplatform 4307 * @atomicservice 4308 * @since 12 4309 */ 4310declare function readSync( 4311 fd: number, 4312 buffer: ArrayBuffer, 4313 options?: ReadOptions 4314): number; 4315 4316/** 4317 * Read content line by line. 4318 * 4319 * @param { string } filePath - file path. 4320 * @param { Options } [options] - optional parameters 4321 * @returns { Promise<ReaderIterator> } Returns the iterator object in promise mode. 4322 * @throws { BusinessError } 13900002 - No such file or directory 4323 * @throws { BusinessError } 13900012 - Permission denied 4324 * @throws { BusinessError } 13900015 - File exists 4325 * @throws { BusinessError } 13900019 - Is a directory 4326 * @throws { BusinessError } 13900020 - Invalid argument 4327 * @throws { BusinessError } 13900022 - Too many open files 4328 * @throws { BusinessError } 13900025 - No space left on device 4329 * @throws { BusinessError } 13900027 - Read-only file system 4330 * @throws { BusinessError } 13900030 - File name too long 4331 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 4332 * @throws { BusinessError } 13900041 - Quota exceeded 4333 * @throws { BusinessError } 13900042 - Unknown error 4334 * @syscap SystemCapability.FileManagement.File.FileIO 4335 * @since 11 4336 */ 4337/** 4338 * Read content line by line. 4339 * 4340 * @param { string } filePath - file path. 4341 * @param { Options } [options] - optional parameters 4342 * @returns { Promise<ReaderIterator> } Returns the iterator object in promise mode. 4343 * @throws { BusinessError } 13900002 - No such file or directory 4344 * @throws { BusinessError } 13900012 - Permission denied 4345 * @throws { BusinessError } 13900015 - File exists 4346 * @throws { BusinessError } 13900019 - Is a directory 4347 * @throws { BusinessError } 13900020 - Invalid argument 4348 * @throws { BusinessError } 13900022 - Too many open files 4349 * @throws { BusinessError } 13900025 - No space left on device 4350 * @throws { BusinessError } 13900027 - Read-only file system 4351 * @throws { BusinessError } 13900030 - File name too long 4352 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 4353 * @throws { BusinessError } 13900041 - Quota exceeded 4354 * @throws { BusinessError } 13900042 - Unknown error 4355 * @throws { BusinessError } 13900044 - Network is unreachable 4356 * @syscap SystemCapability.FileManagement.File.FileIO 4357 * @since 12 4358 */ 4359declare function readLines(filePath: string, options?: Options): Promise<ReaderIterator>; 4360 4361/** 4362 * Read content line by line. 4363 * 4364 * @param { string } filePath - file path. 4365 * @param { AsyncCallback<ReaderIterator> } callback - The callback is used to return the iterator object. 4366 * @throws { BusinessError } 13900002 - No such file or directory 4367 * @throws { BusinessError } 13900012 - Permission denied 4368 * @throws { BusinessError } 13900015 - File exists 4369 * @throws { BusinessError } 13900019 - Is a directory 4370 * @throws { BusinessError } 13900020 - Invalid argument 4371 * @throws { BusinessError } 13900022 - Too many open files 4372 * @throws { BusinessError } 13900025 - No space left on device 4373 * @throws { BusinessError } 13900027 - Read-only file system 4374 * @throws { BusinessError } 13900030 - File name too long 4375 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 4376 * @throws { BusinessError } 13900041 - Quota exceeded 4377 * @throws { BusinessError } 13900042 - Unknown error 4378 * @syscap SystemCapability.FileManagement.File.FileIO 4379 * @since 11 4380 */ 4381declare function readLines(filePath: string, callback: AsyncCallback<ReaderIterator>): void; 4382 4383/** 4384 * Read content line by line. 4385 * 4386 * @param { string } filePath - file path. 4387 * @param { Options } options - optional parameters 4388 * @param { AsyncCallback<ReaderIterator> } callback - The callback is used to return the iterator object. 4389 * @throws { BusinessError } 13900002 - No such file or directory 4390 * @throws { BusinessError } 13900012 - Permission denied 4391 * @throws { BusinessError } 13900015 - File exists 4392 * @throws { BusinessError } 13900019 - Is a directory 4393 * @throws { BusinessError } 13900020 - Invalid argument 4394 * @throws { BusinessError } 13900022 - Too many open files 4395 * @throws { BusinessError } 13900025 - No space left on device 4396 * @throws { BusinessError } 13900027 - Read-only file system 4397 * @throws { BusinessError } 13900030 - File name too long 4398 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 4399 * @throws { BusinessError } 13900041 - Quota exceeded 4400 * @throws { BusinessError } 13900042 - Unknown error 4401 * @syscap SystemCapability.FileManagement.File.FileIO 4402 * @since 11 4403 */ 4404declare function readLines(filePath: string, options: Options, callback: AsyncCallback<ReaderIterator>): void; 4405 4406/** 4407 * Read content line by line with sync interface. 4408 * 4409 * @param { string } filePath - file path. 4410 * @param { Options } [options] - optional parameters 4411 * @returns { ReaderIterator } Returns the iterator object. 4412 * @throws { BusinessError } 13900002 - No such file or directory 4413 * @throws { BusinessError } 13900012 - Permission denied 4414 * @throws { BusinessError } 13900015 - File exists 4415 * @throws { BusinessError } 13900019 - Is a directory 4416 * @throws { BusinessError } 13900020 - Invalid argument 4417 * @throws { BusinessError } 13900022 - Too many open files 4418 * @throws { BusinessError } 13900025 - No space left on device 4419 * @throws { BusinessError } 13900027 - Read-only file system 4420 * @throws { BusinessError } 13900030 - File name too long 4421 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 4422 * @throws { BusinessError } 13900041 - Quota exceeded 4423 * @throws { BusinessError } 13900042 - Unknown error 4424 * @syscap SystemCapability.FileManagement.File.FileIO 4425 * @since 11 4426 */ 4427/** 4428 * Read content line by line with sync interface. 4429 * 4430 * @param { string } filePath - file path. 4431 * @param { Options } [options] - optional parameters 4432 * @returns { ReaderIterator } Returns the iterator object. 4433 * @throws { BusinessError } 13900002 - No such file or directory 4434 * @throws { BusinessError } 13900012 - Permission denied 4435 * @throws { BusinessError } 13900015 - File exists 4436 * @throws { BusinessError } 13900019 - Is a directory 4437 * @throws { BusinessError } 13900020 - Invalid argument 4438 * @throws { BusinessError } 13900022 - Too many open files 4439 * @throws { BusinessError } 13900025 - No space left on device 4440 * @throws { BusinessError } 13900027 - Read-only file system 4441 * @throws { BusinessError } 13900030 - File name too long 4442 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 4443 * @throws { BusinessError } 13900041 - Quota exceeded 4444 * @throws { BusinessError } 13900042 - Unknown error 4445 * @throws { BusinessError } 13900044 - Network is unreachable 4446 * @syscap SystemCapability.FileManagement.File.FileIO 4447 * @since 12 4448 */ 4449declare function readLinesSync(filePath: string, options?: Options): ReaderIterator; 4450 4451/** 4452 * Read text. 4453 * 4454 * @param { string } filePath - file path. 4455 * @param { object } [options] - options. 4456 * @returns { Promise<string> } Returns the contents of the read file in promise mode. 4457 * @throws { BusinessError } 13900001 - Operation not permitted 4458 * @throws { BusinessError } 13900004 - Interrupted system call 4459 * @throws { BusinessError } 13900005 - I/O error 4460 * @throws { BusinessError } 13900008 - Bad file descriptor 4461 * @throws { BusinessError } 13900010 - Try again 4462 * @throws { BusinessError } 13900013 - Bad address 4463 * @throws { BusinessError } 13900019 - Is a directory 4464 * @throws { BusinessError } 13900020 - Invalid argument 4465 * @throws { BusinessError } 13900024 - File too large 4466 * @throws { BusinessError } 13900025 - No space left on device 4467 * @throws { BusinessError } 13900034 - Operation would block 4468 * @throws { BusinessError } 13900041 - Quota exceeded 4469 * @throws { BusinessError } 13900042 - Unknown error 4470 * @syscap SystemCapability.FileManagement.File.FileIO 4471 * @since 9 4472 */ 4473/** 4474 * Read text. 4475 * 4476 * @param { string } filePath - file path. 4477 * @param { object } [options] - options. 4478 * @returns { Promise<string> } Returns the contents of the read file in promise mode. 4479 * @throws { BusinessError } 13900001 - Operation not permitted 4480 * @throws { BusinessError } 13900004 - Interrupted system call 4481 * @throws { BusinessError } 13900005 - I/O error 4482 * @throws { BusinessError } 13900008 - Bad file descriptor 4483 * @throws { BusinessError } 13900010 - Try again 4484 * @throws { BusinessError } 13900013 - Bad address 4485 * @throws { BusinessError } 13900019 - Is a directory 4486 * @throws { BusinessError } 13900020 - Invalid argument 4487 * @throws { BusinessError } 13900024 - File too large 4488 * @throws { BusinessError } 13900025 - No space left on device 4489 * @throws { BusinessError } 13900034 - Operation would block 4490 * @throws { BusinessError } 13900041 - Quota exceeded 4491 * @throws { BusinessError } 13900042 - Unknown error 4492 * @syscap SystemCapability.FileManagement.File.FileIO 4493 * @crossplatform 4494 * @since 10 4495 */ 4496/** 4497 * Read text. 4498 * 4499 * @param { string } filePath - file path. 4500 * @param { ReadTextOptions } [options] - options. 4501 * @returns { Promise<string> } Returns the contents of the read file in promise mode. 4502 * @throws { BusinessError } 13900001 - Operation not permitted 4503 * @throws { BusinessError } 13900004 - Interrupted system call 4504 * @throws { BusinessError } 13900005 - I/O error 4505 * @throws { BusinessError } 13900008 - Bad file descriptor 4506 * @throws { BusinessError } 13900010 - Try again 4507 * @throws { BusinessError } 13900013 - Bad address 4508 * @throws { BusinessError } 13900019 - Is a directory 4509 * @throws { BusinessError } 13900020 - Invalid argument 4510 * @throws { BusinessError } 13900024 - File too large 4511 * @throws { BusinessError } 13900025 - No space left on device 4512 * @throws { BusinessError } 13900034 - Operation would block 4513 * @throws { BusinessError } 13900041 - Quota exceeded 4514 * @throws { BusinessError } 13900042 - Unknown error 4515 * @syscap SystemCapability.FileManagement.File.FileIO 4516 * @crossplatform 4517 * @atomicservice 4518 * @since 11 4519 */ 4520/** 4521 * Read text. 4522 * 4523 * @param { string } filePath - file path. 4524 * @param { ReadTextOptions } [options] - options. 4525 * @returns { Promise<string> } Returns the contents of the read file in promise mode. 4526 * @throws { BusinessError } 13900001 - Operation not permitted 4527 * @throws { BusinessError } 13900004 - Interrupted system call 4528 * @throws { BusinessError } 13900005 - I/O error 4529 * @throws { BusinessError } 13900008 - Bad file descriptor 4530 * @throws { BusinessError } 13900010 - Try again 4531 * @throws { BusinessError } 13900013 - Bad address 4532 * @throws { BusinessError } 13900019 - Is a directory 4533 * @throws { BusinessError } 13900020 - Invalid argument 4534 * @throws { BusinessError } 13900024 - File too large 4535 * @throws { BusinessError } 13900025 - No space left on device 4536 * @throws { BusinessError } 13900034 - Operation would block 4537 * @throws { BusinessError } 13900041 - Quota exceeded 4538 * @throws { BusinessError } 13900042 - Unknown error 4539 * @throws { BusinessError } 13900044 - Network is unreachable 4540 * @syscap SystemCapability.FileManagement.File.FileIO 4541 * @crossplatform 4542 * @atomicservice 4543 * @since 12 4544 */ 4545declare function readText( 4546 filePath: string, 4547 options?: ReadTextOptions 4548): Promise<string>; 4549 4550/** 4551 * Read text. 4552 * 4553 * @param { string } filePath - file path. 4554 * @param { AsyncCallback<string> } callback - The callback is used to return the contents of the read file. 4555 * @throws { BusinessError } 13900001 - Operation not permitted 4556 * @throws { BusinessError } 13900004 - Interrupted system call 4557 * @throws { BusinessError } 13900005 - I/O error 4558 * @throws { BusinessError } 13900008 - Bad file descriptor 4559 * @throws { BusinessError } 13900010 - Try again 4560 * @throws { BusinessError } 13900013 - Bad address 4561 * @throws { BusinessError } 13900019 - Is a directory 4562 * @throws { BusinessError } 13900020 - Invalid argument 4563 * @throws { BusinessError } 13900024 - File too large 4564 * @throws { BusinessError } 13900025 - No space left on device 4565 * @throws { BusinessError } 13900034 - Operation would block 4566 * @throws { BusinessError } 13900041 - Quota exceeded 4567 * @throws { BusinessError } 13900042 - Unknown error 4568 * @syscap SystemCapability.FileManagement.File.FileIO 4569 * @since 9 4570 */ 4571/** 4572 * Read text. 4573 * 4574 * @param { string } filePath - file path. 4575 * @param { AsyncCallback<string> } callback - The callback is used to return the contents of the read file. 4576 * @throws { BusinessError } 13900001 - Operation not permitted 4577 * @throws { BusinessError } 13900004 - Interrupted system call 4578 * @throws { BusinessError } 13900005 - I/O error 4579 * @throws { BusinessError } 13900008 - Bad file descriptor 4580 * @throws { BusinessError } 13900010 - Try again 4581 * @throws { BusinessError } 13900013 - Bad address 4582 * @throws { BusinessError } 13900019 - Is a directory 4583 * @throws { BusinessError } 13900020 - Invalid argument 4584 * @throws { BusinessError } 13900024 - File too large 4585 * @throws { BusinessError } 13900025 - No space left on device 4586 * @throws { BusinessError } 13900034 - Operation would block 4587 * @throws { BusinessError } 13900041 - Quota exceeded 4588 * @throws { BusinessError } 13900042 - Unknown error 4589 * @syscap SystemCapability.FileManagement.File.FileIO 4590 * @crossplatform 4591 * @since 10 4592 */ 4593/** 4594 * Read text. 4595 * 4596 * @param { string } filePath - file path. 4597 * @param { AsyncCallback<string> } callback - The callback is used to return the contents of the read file. 4598 * @throws { BusinessError } 13900001 - Operation not permitted 4599 * @throws { BusinessError } 13900004 - Interrupted system call 4600 * @throws { BusinessError } 13900005 - I/O error 4601 * @throws { BusinessError } 13900008 - Bad file descriptor 4602 * @throws { BusinessError } 13900010 - Try again 4603 * @throws { BusinessError } 13900013 - Bad address 4604 * @throws { BusinessError } 13900019 - Is a directory 4605 * @throws { BusinessError } 13900020 - Invalid argument 4606 * @throws { BusinessError } 13900024 - File too large 4607 * @throws { BusinessError } 13900025 - No space left on device 4608 * @throws { BusinessError } 13900034 - Operation would block 4609 * @throws { BusinessError } 13900041 - Quota exceeded 4610 * @throws { BusinessError } 13900042 - Unknown error 4611 * @syscap SystemCapability.FileManagement.File.FileIO 4612 * @crossplatform 4613 * @atomicservice 4614 * @since 11 4615 */ 4616declare function readText(filePath: string, callback: AsyncCallback<string>): void; 4617 4618/** 4619 * Read text. 4620 * 4621 * @param { string } filePath - file path. 4622 * @param { object } [options] - options. 4623 * @param { AsyncCallback<string> } callback - The callback is used to return the contents of the read file. 4624 * @throws { BusinessError } 13900001 - Operation not permitted 4625 * @throws { BusinessError } 13900004 - Interrupted system call 4626 * @throws { BusinessError } 13900005 - I/O error 4627 * @throws { BusinessError } 13900008 - Bad file descriptor 4628 * @throws { BusinessError } 13900010 - Try again 4629 * @throws { BusinessError } 13900013 - Bad address 4630 * @throws { BusinessError } 13900019 - Is a directory 4631 * @throws { BusinessError } 13900020 - Invalid argument 4632 * @throws { BusinessError } 13900024 - File too large 4633 * @throws { BusinessError } 13900025 - No space left on device 4634 * @throws { BusinessError } 13900034 - Operation would block 4635 * @throws { BusinessError } 13900041 - Quota exceeded 4636 * @throws { BusinessError } 13900042 - Unknown error 4637 * @syscap SystemCapability.FileManagement.File.FileIO 4638 * @since 9 4639 */ 4640/** 4641 * Read text. 4642 * 4643 * @param { string } filePath - file path. 4644 * @param { object } [options] - options. 4645 * @param { AsyncCallback<string> } callback - The callback is used to return the contents of the read file. 4646 * @throws { BusinessError } 13900001 - Operation not permitted 4647 * @throws { BusinessError } 13900004 - Interrupted system call 4648 * @throws { BusinessError } 13900005 - I/O error 4649 * @throws { BusinessError } 13900008 - Bad file descriptor 4650 * @throws { BusinessError } 13900010 - Try again 4651 * @throws { BusinessError } 13900013 - Bad address 4652 * @throws { BusinessError } 13900019 - Is a directory 4653 * @throws { BusinessError } 13900020 - Invalid argument 4654 * @throws { BusinessError } 13900024 - File too large 4655 * @throws { BusinessError } 13900025 - No space left on device 4656 * @throws { BusinessError } 13900034 - Operation would block 4657 * @throws { BusinessError } 13900041 - Quota exceeded 4658 * @throws { BusinessError } 13900042 - Unknown error 4659 * @syscap SystemCapability.FileManagement.File.FileIO 4660 * @crossplatform 4661 * @since 10 4662 */ 4663/** 4664 * Read text. 4665 * 4666 * @param { string } filePath - file path. 4667 * @param { ReadTextOptions } [options] - options. 4668 * @param { AsyncCallback<string> } callback - The callback is used to return the contents of the read file. 4669 * @throws { BusinessError } 13900001 - Operation not permitted 4670 * @throws { BusinessError } 13900004 - Interrupted system call 4671 * @throws { BusinessError } 13900005 - I/O error 4672 * @throws { BusinessError } 13900008 - Bad file descriptor 4673 * @throws { BusinessError } 13900010 - Try again 4674 * @throws { BusinessError } 13900013 - Bad address 4675 * @throws { BusinessError } 13900019 - Is a directory 4676 * @throws { BusinessError } 13900020 - Invalid argument 4677 * @throws { BusinessError } 13900024 - File too large 4678 * @throws { BusinessError } 13900025 - No space left on device 4679 * @throws { BusinessError } 13900034 - Operation would block 4680 * @throws { BusinessError } 13900041 - Quota exceeded 4681 * @throws { BusinessError } 13900042 - Unknown error 4682 * @syscap SystemCapability.FileManagement.File.FileIO 4683 * @crossplatform 4684 * @atomicservice 4685 * @since 11 4686 */ 4687declare function readText( 4688 filePath: string, 4689 options: ReadTextOptions, 4690 callback: AsyncCallback<string> 4691): void; 4692 4693/** 4694 * Read text with sync interface. 4695 * 4696 * @param { string } filePath - file path. 4697 * @param { object } [options] - options. 4698 * @returns { string } Returns the contents of the read file. 4699 * @throws { BusinessError } 13900001 - Operation not permitted 4700 * @throws { BusinessError } 13900004 - Interrupted system call 4701 * @throws { BusinessError } 13900005 - I/O error 4702 * @throws { BusinessError } 13900008 - Bad file descriptor 4703 * @throws { BusinessError } 13900010 - Try again 4704 * @throws { BusinessError } 13900013 - Bad address 4705 * @throws { BusinessError } 13900019 - Is a directory 4706 * @throws { BusinessError } 13900020 - Invalid argument 4707 * @throws { BusinessError } 13900024 - File too large 4708 * @throws { BusinessError } 13900025 - No space left on device 4709 * @throws { BusinessError } 13900034 - Operation would block 4710 * @throws { BusinessError } 13900041 - Quota exceeded 4711 * @throws { BusinessError } 13900042 - Unknown error 4712 * @syscap SystemCapability.FileManagement.File.FileIO 4713 * @since 9 4714 */ 4715/** 4716 * Read text with sync interface. 4717 * 4718 * @param { string } filePath - file path. 4719 * @param { object } [options] - options. 4720 * @returns { string } Returns the contents of the read file. 4721 * @throws { BusinessError } 13900001 - Operation not permitted 4722 * @throws { BusinessError } 13900004 - Interrupted system call 4723 * @throws { BusinessError } 13900005 - I/O error 4724 * @throws { BusinessError } 13900008 - Bad file descriptor 4725 * @throws { BusinessError } 13900010 - Try again 4726 * @throws { BusinessError } 13900013 - Bad address 4727 * @throws { BusinessError } 13900019 - Is a directory 4728 * @throws { BusinessError } 13900020 - Invalid argument 4729 * @throws { BusinessError } 13900024 - File too large 4730 * @throws { BusinessError } 13900025 - No space left on device 4731 * @throws { BusinessError } 13900034 - Operation would block 4732 * @throws { BusinessError } 13900041 - Quota exceeded 4733 * @throws { BusinessError } 13900042 - Unknown error 4734 * @syscap SystemCapability.FileManagement.File.FileIO 4735 * @crossplatform 4736 * @since 10 4737 */ 4738/** 4739 * Read text with sync interface. 4740 * 4741 * @param { string } filePath - file path. 4742 * @param { ReadTextOptions } [options] - options. 4743 * @returns { string } Returns the contents of the read file. 4744 * @throws { BusinessError } 13900001 - Operation not permitted 4745 * @throws { BusinessError } 13900004 - Interrupted system call 4746 * @throws { BusinessError } 13900005 - I/O error 4747 * @throws { BusinessError } 13900008 - Bad file descriptor 4748 * @throws { BusinessError } 13900010 - Try again 4749 * @throws { BusinessError } 13900013 - Bad address 4750 * @throws { BusinessError } 13900019 - Is a directory 4751 * @throws { BusinessError } 13900020 - Invalid argument 4752 * @throws { BusinessError } 13900024 - File too large 4753 * @throws { BusinessError } 13900025 - No space left on device 4754 * @throws { BusinessError } 13900034 - Operation would block 4755 * @throws { BusinessError } 13900041 - Quota exceeded 4756 * @throws { BusinessError } 13900042 - Unknown error 4757 * @syscap SystemCapability.FileManagement.File.FileIO 4758 * @crossplatform 4759 * @atomicservice 4760 * @since 11 4761 */ 4762/** 4763 * Read text with sync interface. 4764 * 4765 * @param { string } filePath - file path. 4766 * @param { ReadTextOptions } [options] - options. 4767 * @returns { string } Returns the contents of the read file. 4768 * @throws { BusinessError } 13900001 - Operation not permitted 4769 * @throws { BusinessError } 13900004 - Interrupted system call 4770 * @throws { BusinessError } 13900005 - I/O error 4771 * @throws { BusinessError } 13900008 - Bad file descriptor 4772 * @throws { BusinessError } 13900010 - Try again 4773 * @throws { BusinessError } 13900013 - Bad address 4774 * @throws { BusinessError } 13900019 - Is a directory 4775 * @throws { BusinessError } 13900020 - Invalid argument 4776 * @throws { BusinessError } 13900024 - File too large 4777 * @throws { BusinessError } 13900025 - No space left on device 4778 * @throws { BusinessError } 13900034 - Operation would block 4779 * @throws { BusinessError } 13900041 - Quota exceeded 4780 * @throws { BusinessError } 13900042 - Unknown error 4781 * @throws { BusinessError } 13900044 - Network is unreachable 4782 * @syscap SystemCapability.FileManagement.File.FileIO 4783 * @crossplatform 4784 * @atomicservice 4785 * @since 12 4786 */ 4787declare function readTextSync( 4788 filePath: string, 4789 options?: ReadTextOptions 4790): string; 4791 4792/** 4793 * Rename file. 4794 * 4795 * @param { string } oldPath - oldPath. 4796 * @param { string } newPath - newPath. 4797 * @returns { Promise<void> } The promise returned by the function. 4798 * @throws { BusinessError } 13900001 - Operation not permitted 4799 * @throws { BusinessError } 13900002 - No such file or directory 4800 * @throws { BusinessError } 13900008 - Bad file descriptor 4801 * @throws { BusinessError } 13900011 - Out of memory 4802 * @throws { BusinessError } 13900012 - Permission denied 4803 * @throws { BusinessError } 13900013 - Bad address 4804 * @throws { BusinessError } 13900014 - Device or resource busy 4805 * @throws { BusinessError } 13900015 - File exists 4806 * @throws { BusinessError } 13900016 - Cross-device link 4807 * @throws { BusinessError } 13900018 - Not a directory 4808 * @throws { BusinessError } 13900019 - Is a directory 4809 * @throws { BusinessError } 13900020 - Invalid argument 4810 * @throws { BusinessError } 13900025 - No space left on device 4811 * @throws { BusinessError } 13900027 - Read-only file system 4812 * @throws { BusinessError } 13900028 - Too many links 4813 * @throws { BusinessError } 13900032 - Directory not empty 4814 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 4815 * @throws { BusinessError } 13900041 - Quota exceeded 4816 * @throws { BusinessError } 13900042 - Unknown error 4817 * @syscap SystemCapability.FileManagement.File.FileIO 4818 * @since 9 4819 */ 4820/** 4821 * Rename file. 4822 * 4823 * @param { string } oldPath - oldPath. 4824 * @param { string } newPath - newPath. 4825 * @returns { Promise<void> } The promise returned by the function. 4826 * @throws { BusinessError } 13900001 - Operation not permitted 4827 * @throws { BusinessError } 13900002 - No such file or directory 4828 * @throws { BusinessError } 13900008 - Bad file descriptor 4829 * @throws { BusinessError } 13900011 - Out of memory 4830 * @throws { BusinessError } 13900012 - Permission denied 4831 * @throws { BusinessError } 13900013 - Bad address 4832 * @throws { BusinessError } 13900014 - Device or resource busy 4833 * @throws { BusinessError } 13900015 - File exists 4834 * @throws { BusinessError } 13900016 - Cross-device link 4835 * @throws { BusinessError } 13900018 - Not a directory 4836 * @throws { BusinessError } 13900019 - Is a directory 4837 * @throws { BusinessError } 13900020 - Invalid argument 4838 * @throws { BusinessError } 13900025 - No space left on device 4839 * @throws { BusinessError } 13900027 - Read-only file system 4840 * @throws { BusinessError } 13900028 - Too many links 4841 * @throws { BusinessError } 13900032 - Directory not empty 4842 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 4843 * @throws { BusinessError } 13900041 - Quota exceeded 4844 * @throws { BusinessError } 13900042 - Unknown error 4845 * @syscap SystemCapability.FileManagement.File.FileIO 4846 * @crossplatform 4847 * @since 10 4848 */ 4849/** 4850 * Rename file. 4851 * 4852 * @param { string } oldPath - oldPath. 4853 * @param { string } newPath - newPath. 4854 * @returns { Promise<void> } The promise returned by the function. 4855 * @throws { BusinessError } 13900001 - Operation not permitted 4856 * @throws { BusinessError } 13900002 - No such file or directory 4857 * @throws { BusinessError } 13900008 - Bad file descriptor 4858 * @throws { BusinessError } 13900011 - Out of memory 4859 * @throws { BusinessError } 13900012 - Permission denied 4860 * @throws { BusinessError } 13900013 - Bad address 4861 * @throws { BusinessError } 13900014 - Device or resource busy 4862 * @throws { BusinessError } 13900015 - File exists 4863 * @throws { BusinessError } 13900016 - Cross-device link 4864 * @throws { BusinessError } 13900018 - Not a directory 4865 * @throws { BusinessError } 13900019 - Is a directory 4866 * @throws { BusinessError } 13900020 - Invalid argument 4867 * @throws { BusinessError } 13900025 - No space left on device 4868 * @throws { BusinessError } 13900027 - Read-only file system 4869 * @throws { BusinessError } 13900028 - Too many links 4870 * @throws { BusinessError } 13900032 - Directory not empty 4871 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 4872 * @throws { BusinessError } 13900041 - Quota exceeded 4873 * @throws { BusinessError } 13900042 - Unknown error 4874 * @syscap SystemCapability.FileManagement.File.FileIO 4875 * @crossplatform 4876 * @atomicservice 4877 * @since 11 4878 */ 4879declare function rename(oldPath: string, newPath: string): Promise<void>; 4880 4881/** 4882 * Rename file. 4883 * 4884 * @param { string } oldPath - oldPath. 4885 * @param { string } newPath - newPath. 4886 * @param { AsyncCallback<void> } callback - Returns the callback function. 4887 * @throws { BusinessError } 13900001 - Operation not permitted 4888 * @throws { BusinessError } 13900002 - No such file or directory 4889 * @throws { BusinessError } 13900008 - Bad file descriptor 4890 * @throws { BusinessError } 13900011 - Out of memory 4891 * @throws { BusinessError } 13900012 - Permission denied 4892 * @throws { BusinessError } 13900013 - Bad address 4893 * @throws { BusinessError } 13900014 - Device or resource busy 4894 * @throws { BusinessError } 13900015 - File exists 4895 * @throws { BusinessError } 13900016 - Cross-device link 4896 * @throws { BusinessError } 13900018 - Not a directory 4897 * @throws { BusinessError } 13900019 - Is a directory 4898 * @throws { BusinessError } 13900020 - Invalid argument 4899 * @throws { BusinessError } 13900025 - No space left on device 4900 * @throws { BusinessError } 13900027 - Read-only file system 4901 * @throws { BusinessError } 13900028 - Too many links 4902 * @throws { BusinessError } 13900032 - Directory not empty 4903 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 4904 * @throws { BusinessError } 13900041 - Quota exceeded 4905 * @throws { BusinessError } 13900042 - Unknown error 4906 * @syscap SystemCapability.FileManagement.File.FileIO 4907 * @since 9 4908 */ 4909/** 4910 * Rename file. 4911 * 4912 * @param { string } oldPath - oldPath. 4913 * @param { string } newPath - newPath. 4914 * @param { AsyncCallback<void> } callback - Returns the callback function. 4915 * @throws { BusinessError } 13900001 - Operation not permitted 4916 * @throws { BusinessError } 13900002 - No such file or directory 4917 * @throws { BusinessError } 13900008 - Bad file descriptor 4918 * @throws { BusinessError } 13900011 - Out of memory 4919 * @throws { BusinessError } 13900012 - Permission denied 4920 * @throws { BusinessError } 13900013 - Bad address 4921 * @throws { BusinessError } 13900014 - Device or resource busy 4922 * @throws { BusinessError } 13900015 - File exists 4923 * @throws { BusinessError } 13900016 - Cross-device link 4924 * @throws { BusinessError } 13900018 - Not a directory 4925 * @throws { BusinessError } 13900019 - Is a directory 4926 * @throws { BusinessError } 13900020 - Invalid argument 4927 * @throws { BusinessError } 13900025 - No space left on device 4928 * @throws { BusinessError } 13900027 - Read-only file system 4929 * @throws { BusinessError } 13900028 - Too many links 4930 * @throws { BusinessError } 13900032 - Directory not empty 4931 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 4932 * @throws { BusinessError } 13900041 - Quota exceeded 4933 * @throws { BusinessError } 13900042 - Unknown error 4934 * @syscap SystemCapability.FileManagement.File.FileIO 4935 * @crossplatform 4936 * @since 10 4937 */ 4938/** 4939 * Rename file. 4940 * 4941 * @param { string } oldPath - oldPath. 4942 * @param { string } newPath - newPath. 4943 * @param { AsyncCallback<void> } callback - Returns the callback function. 4944 * @throws { BusinessError } 13900001 - Operation not permitted 4945 * @throws { BusinessError } 13900002 - No such file or directory 4946 * @throws { BusinessError } 13900008 - Bad file descriptor 4947 * @throws { BusinessError } 13900011 - Out of memory 4948 * @throws { BusinessError } 13900012 - Permission denied 4949 * @throws { BusinessError } 13900013 - Bad address 4950 * @throws { BusinessError } 13900014 - Device or resource busy 4951 * @throws { BusinessError } 13900015 - File exists 4952 * @throws { BusinessError } 13900016 - Cross-device link 4953 * @throws { BusinessError } 13900018 - Not a directory 4954 * @throws { BusinessError } 13900019 - Is a directory 4955 * @throws { BusinessError } 13900020 - Invalid argument 4956 * @throws { BusinessError } 13900025 - No space left on device 4957 * @throws { BusinessError } 13900027 - Read-only file system 4958 * @throws { BusinessError } 13900028 - Too many links 4959 * @throws { BusinessError } 13900032 - Directory not empty 4960 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 4961 * @throws { BusinessError } 13900041 - Quota exceeded 4962 * @throws { BusinessError } 13900042 - Unknown error 4963 * @syscap SystemCapability.FileManagement.File.FileIO 4964 * @crossplatform 4965 * @atomicservice 4966 * @since 11 4967 */ 4968declare function rename(oldPath: string, newPath: string, callback: AsyncCallback<void>): void; 4969 4970/** 4971 * Rename file with sync interface. 4972 * 4973 * @param { string } oldPath - oldPath. 4974 * @param { string } newPath - newPath. 4975 * @throws { BusinessError } 13900001 - Operation not permitted 4976 * @throws { BusinessError } 13900002 - No such file or directory 4977 * @throws { BusinessError } 13900008 - Bad file descriptor 4978 * @throws { BusinessError } 13900011 - Out of memory 4979 * @throws { BusinessError } 13900012 - Permission denied 4980 * @throws { BusinessError } 13900013 - Bad address 4981 * @throws { BusinessError } 13900014 - Device or resource busy 4982 * @throws { BusinessError } 13900015 - File exists 4983 * @throws { BusinessError } 13900016 - Cross-device link 4984 * @throws { BusinessError } 13900018 - Not a directory 4985 * @throws { BusinessError } 13900019 - Is a directory 4986 * @throws { BusinessError } 13900020 - Invalid argument 4987 * @throws { BusinessError } 13900025 - No space left on device 4988 * @throws { BusinessError } 13900027 - Read-only file system 4989 * @throws { BusinessError } 13900028 - Too many links 4990 * @throws { BusinessError } 13900032 - Directory not empty 4991 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 4992 * @throws { BusinessError } 13900041 - Quota exceeded 4993 * @throws { BusinessError } 13900042 - Unknown error 4994 * @syscap SystemCapability.FileManagement.File.FileIO 4995 * @since 9 4996 */ 4997/** 4998 * Rename file with sync interface. 4999 * 5000 * @param { string } oldPath - oldPath. 5001 * @param { string } newPath - newPath. 5002 * @throws { BusinessError } 13900001 - Operation not permitted 5003 * @throws { BusinessError } 13900002 - No such file or directory 5004 * @throws { BusinessError } 13900008 - Bad file descriptor 5005 * @throws { BusinessError } 13900011 - Out of memory 5006 * @throws { BusinessError } 13900012 - Permission denied 5007 * @throws { BusinessError } 13900013 - Bad address 5008 * @throws { BusinessError } 13900014 - Device or resource busy 5009 * @throws { BusinessError } 13900015 - File exists 5010 * @throws { BusinessError } 13900016 - Cross-device link 5011 * @throws { BusinessError } 13900018 - Not a directory 5012 * @throws { BusinessError } 13900019 - Is a directory 5013 * @throws { BusinessError } 13900020 - Invalid argument 5014 * @throws { BusinessError } 13900025 - No space left on device 5015 * @throws { BusinessError } 13900027 - Read-only file system 5016 * @throws { BusinessError } 13900028 - Too many links 5017 * @throws { BusinessError } 13900032 - Directory not empty 5018 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 5019 * @throws { BusinessError } 13900041 - Quota exceeded 5020 * @throws { BusinessError } 13900042 - Unknown error 5021 * @syscap SystemCapability.FileManagement.File.FileIO 5022 * @crossplatform 5023 * @since 10 5024 */ 5025/** 5026 * Rename file with sync interface. 5027 * 5028 * @param { string } oldPath - oldPath. 5029 * @param { string } newPath - newPath. 5030 * @throws { BusinessError } 13900001 - Operation not permitted 5031 * @throws { BusinessError } 13900002 - No such file or directory 5032 * @throws { BusinessError } 13900008 - Bad file descriptor 5033 * @throws { BusinessError } 13900011 - Out of memory 5034 * @throws { BusinessError } 13900012 - Permission denied 5035 * @throws { BusinessError } 13900013 - Bad address 5036 * @throws { BusinessError } 13900014 - Device or resource busy 5037 * @throws { BusinessError } 13900015 - File exists 5038 * @throws { BusinessError } 13900016 - Cross-device link 5039 * @throws { BusinessError } 13900018 - Not a directory 5040 * @throws { BusinessError } 13900019 - Is a directory 5041 * @throws { BusinessError } 13900020 - Invalid argument 5042 * @throws { BusinessError } 13900025 - No space left on device 5043 * @throws { BusinessError } 13900027 - Read-only file system 5044 * @throws { BusinessError } 13900028 - Too many links 5045 * @throws { BusinessError } 13900032 - Directory not empty 5046 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 5047 * @throws { BusinessError } 13900041 - Quota exceeded 5048 * @throws { BusinessError } 13900042 - Unknown error 5049 * @syscap SystemCapability.FileManagement.File.FileIO 5050 * @crossplatform 5051 * @atomicservice 5052 * @since 11 5053 */ 5054declare function renameSync(oldPath: string, newPath: string): void; 5055 5056/** 5057 * Delete dir. 5058 * 5059 * @param { string } path - path. 5060 * @returns { Promise<void> } The promise returned by the function. 5061 * @throws { BusinessError } 13900001 - Operation not permitted 5062 * @throws { BusinessError } 13900002 - No such file or directory 5063 * @throws { BusinessError } 13900011 - Out of memory 5064 * @throws { BusinessError } 13900012 - Permission denied 5065 * @throws { BusinessError } 13900013 - Bad address 5066 * @throws { BusinessError } 13900014 - Device or resource busy 5067 * @throws { BusinessError } 13900018 - Not a directory 5068 * @throws { BusinessError } 13900020 - Invalid argument 5069 * @throws { BusinessError } 13900027 - Read-only file system1 5070 * @throws { BusinessError } 13900030 - File name too long 5071 * @throws { BusinessError } 13900032 - Directory not empty 5072 * @throws { BusinessError } 13900042 - Unknown error 5073 * @syscap SystemCapability.FileManagement.File.FileIO 5074 * @since 9 5075 */ 5076/** 5077 * Delete dir. 5078 * 5079 * @param { string } path - path. 5080 * @returns { Promise<void> } The promise returned by the function. 5081 * @throws { BusinessError } 13900001 - Operation not permitted 5082 * @throws { BusinessError } 13900002 - No such file or directory 5083 * @throws { BusinessError } 13900011 - Out of memory 5084 * @throws { BusinessError } 13900012 - Permission denied 5085 * @throws { BusinessError } 13900013 - Bad address 5086 * @throws { BusinessError } 13900014 - Device or resource busy 5087 * @throws { BusinessError } 13900018 - Not a directory 5088 * @throws { BusinessError } 13900020 - Invalid argument 5089 * @throws { BusinessError } 13900027 - Read-only file system1 5090 * @throws { BusinessError } 13900030 - File name too long 5091 * @throws { BusinessError } 13900032 - Directory not empty 5092 * @throws { BusinessError } 13900042 - Unknown error 5093 * @syscap SystemCapability.FileManagement.File.FileIO 5094 * @crossplatform 5095 * @since 10 5096 */ 5097/** 5098 * Delete dir. 5099 * 5100 * @param { string } path - path. 5101 * @returns { Promise<void> } The promise returned by the function. 5102 * @throws { BusinessError } 13900001 - Operation not permitted 5103 * @throws { BusinessError } 13900002 - No such file or directory 5104 * @throws { BusinessError } 13900011 - Out of memory 5105 * @throws { BusinessError } 13900012 - Permission denied 5106 * @throws { BusinessError } 13900013 - Bad address 5107 * @throws { BusinessError } 13900014 - Device or resource busy 5108 * @throws { BusinessError } 13900018 - Not a directory 5109 * @throws { BusinessError } 13900020 - Invalid argument 5110 * @throws { BusinessError } 13900027 - Read-only file system1 5111 * @throws { BusinessError } 13900030 - File name too long 5112 * @throws { BusinessError } 13900032 - Directory not empty 5113 * @throws { BusinessError } 13900042 - Unknown error 5114 * @syscap SystemCapability.FileManagement.File.FileIO 5115 * @crossplatform 5116 * @atomicservice 5117 * @since 11 5118 */ 5119declare function rmdir(path: string): Promise<void>; 5120 5121/** 5122 * Delete dir. 5123 * 5124 * @param { string } path - path. 5125 * @param { AsyncCallback<void> } callback - Return the callback function. 5126 * @throws { BusinessError } 13900001 - Operation not permitted 5127 * @throws { BusinessError } 13900002 - No such file or directory 5128 * @throws { BusinessError } 13900011 - Out of memory 5129 * @throws { BusinessError } 13900012 - Permission denied 5130 * @throws { BusinessError } 13900013 - Bad address 5131 * @throws { BusinessError } 13900014 - Device or resource busy 5132 * @throws { BusinessError } 13900018 - Not a directory 5133 * @throws { BusinessError } 13900020 - Invalid argument 5134 * @throws { BusinessError } 13900027 - Read-only file system1 5135 * @throws { BusinessError } 13900030 - File name too long 5136 * @throws { BusinessError } 13900032 - Directory not empty 5137 * @throws { BusinessError } 13900042 - Unknown error 5138 * @syscap SystemCapability.FileManagement.File.FileIO 5139 * @since 9 5140 */ 5141/** 5142 * Delete dir. 5143 * 5144 * @param { string } path - path. 5145 * @param { AsyncCallback<void> } callback - Return the callback function. 5146 * @throws { BusinessError } 13900001 - Operation not permitted 5147 * @throws { BusinessError } 13900002 - No such file or directory 5148 * @throws { BusinessError } 13900011 - Out of memory 5149 * @throws { BusinessError } 13900012 - Permission denied 5150 * @throws { BusinessError } 13900013 - Bad address 5151 * @throws { BusinessError } 13900014 - Device or resource busy 5152 * @throws { BusinessError } 13900018 - Not a directory 5153 * @throws { BusinessError } 13900020 - Invalid argument 5154 * @throws { BusinessError } 13900027 - Read-only file system1 5155 * @throws { BusinessError } 13900030 - File name too long 5156 * @throws { BusinessError } 13900032 - Directory not empty 5157 * @throws { BusinessError } 13900042 - Unknown error 5158 * @syscap SystemCapability.FileManagement.File.FileIO 5159 * @crossplatform 5160 * @since 10 5161 */ 5162/** 5163 * Delete dir. 5164 * 5165 * @param { string } path - path. 5166 * @param { AsyncCallback<void> } callback - Return the callback function. 5167 * @throws { BusinessError } 13900001 - Operation not permitted 5168 * @throws { BusinessError } 13900002 - No such file or directory 5169 * @throws { BusinessError } 13900011 - Out of memory 5170 * @throws { BusinessError } 13900012 - Permission denied 5171 * @throws { BusinessError } 13900013 - Bad address 5172 * @throws { BusinessError } 13900014 - Device or resource busy 5173 * @throws { BusinessError } 13900018 - Not a directory 5174 * @throws { BusinessError } 13900020 - Invalid argument 5175 * @throws { BusinessError } 13900027 - Read-only file system1 5176 * @throws { BusinessError } 13900030 - File name too long 5177 * @throws { BusinessError } 13900032 - Directory not empty 5178 * @throws { BusinessError } 13900042 - Unknown error 5179 * @syscap SystemCapability.FileManagement.File.FileIO 5180 * @crossplatform 5181 * @atomicservice 5182 * @since 11 5183 */ 5184declare function rmdir(path: string, callback: AsyncCallback<void>): void; 5185 5186/** 5187 * Delete dir with sync interface. 5188 * 5189 * @param { string } path - path. 5190 * @throws { BusinessError } 13900001 - Operation not permitted 5191 * @throws { BusinessError } 13900002 - No such file or directory 5192 * @throws { BusinessError } 13900011 - Out of memory 5193 * @throws { BusinessError } 13900012 - Permission denied 5194 * @throws { BusinessError } 13900013 - Bad address 5195 * @throws { BusinessError } 13900014 - Device or resource busy 5196 * @throws { BusinessError } 13900018 - Not a directory 5197 * @throws { BusinessError } 13900020 - Invalid argument 5198 * @throws { BusinessError } 13900027 - Read-only file system1 5199 * @throws { BusinessError } 13900030 - File name too long 5200 * @throws { BusinessError } 13900032 - Directory not empty 5201 * @throws { BusinessError } 13900042 - Unknown error 5202 * @syscap SystemCapability.FileManagement.File.FileIO 5203 * @since 9 5204 */ 5205/** 5206 * Delete dir with sync interface. 5207 * 5208 * @param { string } path - path. 5209 * @throws { BusinessError } 13900001 - Operation not permitted 5210 * @throws { BusinessError } 13900002 - No such file or directory 5211 * @throws { BusinessError } 13900011 - Out of memory 5212 * @throws { BusinessError } 13900012 - Permission denied 5213 * @throws { BusinessError } 13900013 - Bad address 5214 * @throws { BusinessError } 13900014 - Device or resource busy 5215 * @throws { BusinessError } 13900018 - Not a directory 5216 * @throws { BusinessError } 13900020 - Invalid argument 5217 * @throws { BusinessError } 13900027 - Read-only file system1 5218 * @throws { BusinessError } 13900030 - File name too long 5219 * @throws { BusinessError } 13900032 - Directory not empty 5220 * @throws { BusinessError } 13900042 - Unknown error 5221 * @syscap SystemCapability.FileManagement.File.FileIO 5222 * @crossplatform 5223 * @since 10 5224 */ 5225/** 5226 * Delete dir with sync interface. 5227 * 5228 * @param { string } path - path. 5229 * @throws { BusinessError } 13900001 - Operation not permitted 5230 * @throws { BusinessError } 13900002 - No such file or directory 5231 * @throws { BusinessError } 13900011 - Out of memory 5232 * @throws { BusinessError } 13900012 - Permission denied 5233 * @throws { BusinessError } 13900013 - Bad address 5234 * @throws { BusinessError } 13900014 - Device or resource busy 5235 * @throws { BusinessError } 13900018 - Not a directory 5236 * @throws { BusinessError } 13900020 - Invalid argument 5237 * @throws { BusinessError } 13900027 - Read-only file system1 5238 * @throws { BusinessError } 13900030 - File name too long 5239 * @throws { BusinessError } 13900032 - Directory not empty 5240 * @throws { BusinessError } 13900042 - Unknown error 5241 * @syscap SystemCapability.FileManagement.File.FileIO 5242 * @crossplatform 5243 * @atomicservice 5244 * @since 11 5245 */ 5246declare function rmdirSync(path: string): void; 5247 5248/** 5249 * Get file information. 5250 * 5251 * @param { string | number } file - path or file descriptor. 5252 * @returns { Promise<Stat> } Returns the Stat object in promise mode. 5253 * @throws { BusinessError } 13900002 - No such file or directory 5254 * @throws { BusinessError } 13900004 - Interrupted system call 5255 * @throws { BusinessError } 13900005 - I/O error 5256 * @throws { BusinessError } 13900008 - Bad file descriptor 5257 * @throws { BusinessError } 13900011 - Out of memory 5258 * @throws { BusinessError } 13900012 - Permission denied 5259 * @throws { BusinessError } 13900013 - Bad address 5260 * @throws { BusinessError } 13900018 - Not a directory 5261 * @throws { BusinessError } 13900030 - File name too long 5262 * @throws { BusinessError } 13900031 - Function not implemented 5263 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 5264 * @throws { BusinessError } 13900038 - Value too large for defined data type 5265 * @throws { BusinessError } 13900042 - Unknown error 5266 * @syscap SystemCapability.FileManagement.File.FileIO 5267 * @since 9 5268 */ 5269/** 5270 * Get file information. 5271 * 5272 * @param { string | number } file - path or file descriptor. 5273 * @returns { Promise<Stat> } Returns the Stat object in promise mode. 5274 * @throws { BusinessError } 13900002 - No such file or directory 5275 * @throws { BusinessError } 13900004 - Interrupted system call 5276 * @throws { BusinessError } 13900005 - I/O error 5277 * @throws { BusinessError } 13900008 - Bad file descriptor 5278 * @throws { BusinessError } 13900011 - Out of memory 5279 * @throws { BusinessError } 13900012 - Permission denied 5280 * @throws { BusinessError } 13900013 - Bad address 5281 * @throws { BusinessError } 13900018 - Not a directory 5282 * @throws { BusinessError } 13900030 - File name too long 5283 * @throws { BusinessError } 13900031 - Function not implemented 5284 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 5285 * @throws { BusinessError } 13900038 - Value too large for defined data type 5286 * @throws { BusinessError } 13900042 - Unknown error 5287 * @syscap SystemCapability.FileManagement.File.FileIO 5288 * @crossplatform 5289 * @since 10 5290 */ 5291/** 5292 * Get file information. 5293 * 5294 * @param { string | number } file - path or file descriptor. 5295 * @returns { Promise<Stat> } Returns the Stat object in promise mode. 5296 * @throws { BusinessError } 13900002 - No such file or directory 5297 * @throws { BusinessError } 13900004 - Interrupted system call 5298 * @throws { BusinessError } 13900005 - I/O error 5299 * @throws { BusinessError } 13900008 - Bad file descriptor 5300 * @throws { BusinessError } 13900011 - Out of memory 5301 * @throws { BusinessError } 13900012 - Permission denied 5302 * @throws { BusinessError } 13900013 - Bad address 5303 * @throws { BusinessError } 13900018 - Not a directory 5304 * @throws { BusinessError } 13900030 - File name too long 5305 * @throws { BusinessError } 13900031 - Function not implemented 5306 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 5307 * @throws { BusinessError } 13900038 - Value too large for defined data type 5308 * @throws { BusinessError } 13900042 - Unknown error 5309 * @syscap SystemCapability.FileManagement.File.FileIO 5310 * @crossplatform 5311 * @atomicservice 5312 * @since 11 5313 */ 5314declare function stat(file: string | number): Promise<Stat>; 5315 5316/** 5317 * Get file information. 5318 * 5319 * @param { string | number } file - path or file descriptor. 5320 * @param { AsyncCallback<Stat> } callback - The callback is used to return the Stat object. 5321 * @throws { BusinessError } 13900002 - No such file or directory 5322 * @throws { BusinessError } 13900004 - Interrupted system call 5323 * @throws { BusinessError } 13900005 - I/O error 5324 * @throws { BusinessError } 13900008 - Bad file descriptor 5325 * @throws { BusinessError } 13900011 - Out of memory 5326 * @throws { BusinessError } 13900012 - Permission denied 5327 * @throws { BusinessError } 13900013 - Bad address 5328 * @throws { BusinessError } 13900018 - Not a directory 5329 * @throws { BusinessError } 13900030 - File name too long 5330 * @throws { BusinessError } 13900031 - Function not implemented 5331 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 5332 * @throws { BusinessError } 13900038 - Value too large for defined data type 5333 * @throws { BusinessError } 13900042 - Unknown error 5334 * @syscap SystemCapability.FileManagement.File.FileIO 5335 * @since 9 5336 */ 5337/** 5338 * Get file information. 5339 * 5340 * @param { string | number } file - path or file descriptor. 5341 * @param { AsyncCallback<Stat> } callback - The callback is used to return the Stat object. 5342 * @throws { BusinessError } 13900002 - No such file or directory 5343 * @throws { BusinessError } 13900004 - Interrupted system call 5344 * @throws { BusinessError } 13900005 - I/O error 5345 * @throws { BusinessError } 13900008 - Bad file descriptor 5346 * @throws { BusinessError } 13900011 - Out of memory 5347 * @throws { BusinessError } 13900012 - Permission denied 5348 * @throws { BusinessError } 13900013 - Bad address 5349 * @throws { BusinessError } 13900018 - Not a directory 5350 * @throws { BusinessError } 13900030 - File name too long 5351 * @throws { BusinessError } 13900031 - Function not implemented 5352 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 5353 * @throws { BusinessError } 13900038 - Value too large for defined data type 5354 * @throws { BusinessError } 13900042 - Unknown error 5355 * @syscap SystemCapability.FileManagement.File.FileIO 5356 * @crossplatform 5357 * @since 10 5358 */ 5359/** 5360 * Get file information. 5361 * 5362 * @param { string | number } file - path or file descriptor. 5363 * @param { AsyncCallback<Stat> } callback - The callback is used to return the Stat object. 5364 * @throws { BusinessError } 13900002 - No such file or directory 5365 * @throws { BusinessError } 13900004 - Interrupted system call 5366 * @throws { BusinessError } 13900005 - I/O error 5367 * @throws { BusinessError } 13900008 - Bad file descriptor 5368 * @throws { BusinessError } 13900011 - Out of memory 5369 * @throws { BusinessError } 13900012 - Permission denied 5370 * @throws { BusinessError } 13900013 - Bad address 5371 * @throws { BusinessError } 13900018 - Not a directory 5372 * @throws { BusinessError } 13900030 - File name too long 5373 * @throws { BusinessError } 13900031 - Function not implemented 5374 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 5375 * @throws { BusinessError } 13900038 - Value too large for defined data type 5376 * @throws { BusinessError } 13900042 - Unknown error 5377 * @syscap SystemCapability.FileManagement.File.FileIO 5378 * @crossplatform 5379 * @atomicservice 5380 * @since 11 5381 */ 5382declare function stat(file: string | number, callback: AsyncCallback<Stat>): void; 5383 5384/** 5385 * Get file information with sync interface. 5386 * 5387 * @param { string | number } file - path or file descriptor. 5388 * @returns { Stat } Returns the Stat object. 5389 * @throws { BusinessError } 13900002 - No such file or directory 5390 * @throws { BusinessError } 13900004 - Interrupted system call 5391 * @throws { BusinessError } 13900005 - I/O error 5392 * @throws { BusinessError } 13900008 - Bad file descriptor 5393 * @throws { BusinessError } 13900011 - Out of memory 5394 * @throws { BusinessError } 13900012 - Permission denied 5395 * @throws { BusinessError } 13900013 - Bad address 5396 * @throws { BusinessError } 13900018 - Not a directory 5397 * @throws { BusinessError } 13900030 - File name too long 5398 * @throws { BusinessError } 13900031 - Function not implemented 5399 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 5400 * @throws { BusinessError } 13900038 - Value too large for defined data type 5401 * @throws { BusinessError } 13900042 - Unknown error 5402 * @syscap SystemCapability.FileManagement.File.FileIO 5403 * @since 9 5404 */ 5405/** 5406 * Get file information with sync interface. 5407 * 5408 * @param { string | number } file - path or file descriptor. 5409 * @returns { Stat } Returns the Stat object. 5410 * @throws { BusinessError } 13900002 - No such file or directory 5411 * @throws { BusinessError } 13900004 - Interrupted system call 5412 * @throws { BusinessError } 13900005 - I/O error 5413 * @throws { BusinessError } 13900008 - Bad file descriptor 5414 * @throws { BusinessError } 13900011 - Out of memory 5415 * @throws { BusinessError } 13900012 - Permission denied 5416 * @throws { BusinessError } 13900013 - Bad address 5417 * @throws { BusinessError } 13900018 - Not a directory 5418 * @throws { BusinessError } 13900030 - File name too long 5419 * @throws { BusinessError } 13900031 - Function not implemented 5420 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 5421 * @throws { BusinessError } 13900038 - Value too large for defined data type 5422 * @throws { BusinessError } 13900042 - Unknown error 5423 * @syscap SystemCapability.FileManagement.File.FileIO 5424 * @crossplatform 5425 * @since 10 5426 */ 5427/** 5428 * Get file information with sync interface. 5429 * 5430 * @param { string | number } file - path or file descriptor. 5431 * @returns { Stat } Returns the Stat object. 5432 * @throws { BusinessError } 13900002 - No such file or directory 5433 * @throws { BusinessError } 13900004 - Interrupted system call 5434 * @throws { BusinessError } 13900005 - I/O error 5435 * @throws { BusinessError } 13900008 - Bad file descriptor 5436 * @throws { BusinessError } 13900011 - Out of memory 5437 * @throws { BusinessError } 13900012 - Permission denied 5438 * @throws { BusinessError } 13900013 - Bad address 5439 * @throws { BusinessError } 13900018 - Not a directory 5440 * @throws { BusinessError } 13900030 - File name too long 5441 * @throws { BusinessError } 13900031 - Function not implemented 5442 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 5443 * @throws { BusinessError } 13900038 - Value too large for defined data type 5444 * @throws { BusinessError } 13900042 - Unknown error 5445 * @syscap SystemCapability.FileManagement.File.FileIO 5446 * @crossplatform 5447 * @atomicservice 5448 * @since 11 5449 */ 5450declare function statSync(file: string | number): Stat; 5451 5452/** 5453 * Link file. 5454 * 5455 * @param { string } target - target. 5456 * @param { string } srcPath - srcPath. 5457 * @returns { Promise<void> } The promise returned by the function. 5458 * @throws { BusinessError } 13900001 - Operation not permitted 5459 * @throws { BusinessError } 13900002 - No such file or directory 5460 * @throws { BusinessError } 13900005 - I/O error 5461 * @throws { BusinessError } 13900008 - Bad file descriptor 5462 * @throws { BusinessError } 13900011 - Out of memory 5463 * @throws { BusinessError } 13900012 - Permission denied 5464 * @throws { BusinessError } 13900013 - Bad address 5465 * @throws { BusinessError } 13900015 - File exists 5466 * @throws { BusinessError } 13900018 - Not a directory 5467 * @throws { BusinessError } 13900025 - No space left on device 5468 * @throws { BusinessError } 13900027 - Read-only file system 5469 * @throws { BusinessError } 13900030 - File name too long 5470 * @throws { BusinessError } 13900041 - Quota exceeded 5471 * @throws { BusinessError } 13900042 - Unknown error 5472 * @syscap SystemCapability.FileManagement.File.FileIO 5473 * @since 9 5474 */ 5475declare function symlink(target: string, srcPath: string): Promise<void>; 5476 5477/** 5478 * Link file. 5479 * 5480 * @param { string } target - target. 5481 * @param { string } srcPath - srcPath. 5482 * @param { AsyncCallback<void> } callback - Return the callback function. 5483 * @throws { BusinessError } 13900001 - Operation not permitted 5484 * @throws { BusinessError } 13900002 - No such file or directory 5485 * @throws { BusinessError } 13900005 - I/O error 5486 * @throws { BusinessError } 13900008 - Bad file descriptor 5487 * @throws { BusinessError } 13900011 - Out of memory 5488 * @throws { BusinessError } 13900012 - Permission denied 5489 * @throws { BusinessError } 13900013 - Bad address 5490 * @throws { BusinessError } 13900015 - File exists 5491 * @throws { BusinessError } 13900018 - Not a directory 5492 * @throws { BusinessError } 13900025 - No space left on device 5493 * @throws { BusinessError } 13900027 - Read-only file system 5494 * @throws { BusinessError } 13900030 - File name too long 5495 * @throws { BusinessError } 13900041 - Quota exceeded 5496 * @throws { BusinessError } 13900042 - Unknown error 5497 * @syscap SystemCapability.FileManagement.File.FileIO 5498 * @since 9 5499 */ 5500declare function symlink(target: string, srcPath: string, callback: AsyncCallback<void>): void; 5501 5502/** 5503 * Link file with sync interface. 5504 * 5505 * @param { string } target - target. 5506 * @param { string } srcPath - srcPath. 5507 * @throws { BusinessError } 13900001 - Operation not permitted 5508 * @throws { BusinessError } 13900002 - No such file or directory 5509 * @throws { BusinessError } 13900005 - I/O error 5510 * @throws { BusinessError } 13900008 - Bad file descriptor 5511 * @throws { BusinessError } 13900011 - Out of memory 5512 * @throws { BusinessError } 13900012 - Permission denied 5513 * @throws { BusinessError } 13900013 - Bad address 5514 * @throws { BusinessError } 13900015 - File exists 5515 * @throws { BusinessError } 13900018 - Not a directory 5516 * @throws { BusinessError } 13900025 - No space left on device 5517 * @throws { BusinessError } 13900027 - Read-only file system 5518 * @throws { BusinessError } 13900030 - File name too long 5519 * @throws { BusinessError } 13900041 - Quota exceeded 5520 * @throws { BusinessError } 13900042 - Unknown error 5521 * @syscap SystemCapability.FileManagement.File.FileIO 5522 * @since 9 5523 */ 5524declare function symlinkSync(target: string, srcPath: string): void; 5525 5526/** 5527 * Truncate file. 5528 * 5529 * @param { string | number } file - path or file descriptor. 5530 * @param { number } [len = 0] - len. 5531 * @returns { Promise<void> } The promise returned by the function. 5532 * @throws { BusinessError } 13900001 - Operation not permitted 5533 * @throws { BusinessError } 13900002 - No such file or directory 5534 * @throws { BusinessError } 13900004 - Interrupted system call 5535 * @throws { BusinessError } 13900005 - I/O error 5536 * @throws { BusinessError } 13900008 - Bad file descriptor 5537 * @throws { BusinessError } 13900012 - Permission denied 5538 * @throws { BusinessError } 13900013 - Bad address 5539 * @throws { BusinessError } 13900018 - Not a directory 5540 * @throws { BusinessError } 13900019 - Is a directory 5541 * @throws { BusinessError } 13900020 - Invalid argument 5542 * @throws { BusinessError } 13900023 - Text file busy 5543 * @throws { BusinessError } 13900024 - File too large 5544 * @throws { BusinessError } 13900027 - Read-only file system 5545 * @throws { BusinessError } 13900030 - File name too long 5546 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 5547 * @throws { BusinessError } 13900042 - Unknown error 5548 * @syscap SystemCapability.FileManagement.File.FileIO 5549 * @since 9 5550 */ 5551/** 5552 * Truncate file. 5553 * 5554 * @param { string | number } file - path or file descriptor. 5555 * @param { number } [len = 0] - len. 5556 * @returns { Promise<void> } The promise returned by the function. 5557 * @throws { BusinessError } 13900001 - Operation not permitted 5558 * @throws { BusinessError } 13900002 - No such file or directory 5559 * @throws { BusinessError } 13900004 - Interrupted system call 5560 * @throws { BusinessError } 13900005 - I/O error 5561 * @throws { BusinessError } 13900008 - Bad file descriptor 5562 * @throws { BusinessError } 13900012 - Permission denied 5563 * @throws { BusinessError } 13900013 - Bad address 5564 * @throws { BusinessError } 13900018 - Not a directory 5565 * @throws { BusinessError } 13900019 - Is a directory 5566 * @throws { BusinessError } 13900020 - Invalid argument 5567 * @throws { BusinessError } 13900023 - Text file busy 5568 * @throws { BusinessError } 13900024 - File too large 5569 * @throws { BusinessError } 13900027 - Read-only file system 5570 * @throws { BusinessError } 13900030 - File name too long 5571 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 5572 * @throws { BusinessError } 13900042 - Unknown error 5573 * @syscap SystemCapability.FileManagement.File.FileIO 5574 * @crossplatform 5575 * @since 10 5576 */ 5577/** 5578 * Truncate file. 5579 * 5580 * @param { string | number } file - path or file descriptor. 5581 * @param { number } [len = 0] - len. 5582 * @returns { Promise<void> } The promise returned by the function. 5583 * @throws { BusinessError } 13900001 - Operation not permitted 5584 * @throws { BusinessError } 13900002 - No such file or directory 5585 * @throws { BusinessError } 13900004 - Interrupted system call 5586 * @throws { BusinessError } 13900005 - I/O error 5587 * @throws { BusinessError } 13900008 - Bad file descriptor 5588 * @throws { BusinessError } 13900012 - Permission denied 5589 * @throws { BusinessError } 13900013 - Bad address 5590 * @throws { BusinessError } 13900018 - Not a directory 5591 * @throws { BusinessError } 13900019 - Is a directory 5592 * @throws { BusinessError } 13900020 - Invalid argument 5593 * @throws { BusinessError } 13900023 - Text file busy 5594 * @throws { BusinessError } 13900024 - File too large 5595 * @throws { BusinessError } 13900027 - Read-only file system 5596 * @throws { BusinessError } 13900030 - File name too long 5597 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 5598 * @throws { BusinessError } 13900042 - Unknown error 5599 * @syscap SystemCapability.FileManagement.File.FileIO 5600 * @crossplatform 5601 * @atomicservice 5602 * @since 11 5603 */ 5604declare function truncate(file: string | number, len?: number): Promise<void>; 5605 5606/** 5607 * Truncate file. 5608 * 5609 * @param { string | number } file - path or file descriptor. 5610 * @param { AsyncCallback<void> } callback - Return the callback function. 5611 * @throws { BusinessError } 13900001 - Operation not permitted 5612 * @throws { BusinessError } 13900002 - No such file or directory 5613 * @throws { BusinessError } 13900004 - Interrupted system call 5614 * @throws { BusinessError } 13900005 - I/O error 5615 * @throws { BusinessError } 13900008 - Bad file descriptor 5616 * @throws { BusinessError } 13900012 - Permission denied 5617 * @throws { BusinessError } 13900013 - Bad address 5618 * @throws { BusinessError } 13900018 - Not a directory 5619 * @throws { BusinessError } 13900019 - Is a directory 5620 * @throws { BusinessError } 13900020 - Invalid argument 5621 * @throws { BusinessError } 13900023 - Text file busy 5622 * @throws { BusinessError } 13900024 - File too large 5623 * @throws { BusinessError } 13900027 - Read-only file system 5624 * @throws { BusinessError } 13900030 - File name too long 5625 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 5626 * @throws { BusinessError } 13900042 - Unknown error 5627 * @syscap SystemCapability.FileManagement.File.FileIO 5628 * @since 9 5629 */ 5630/** 5631 * Truncate file. 5632 * 5633 * @param { string | number } file - path or file descriptor. 5634 * @param { AsyncCallback<void> } callback - Return the callback function. 5635 * @throws { BusinessError } 13900001 - Operation not permitted 5636 * @throws { BusinessError } 13900002 - No such file or directory 5637 * @throws { BusinessError } 13900004 - Interrupted system call 5638 * @throws { BusinessError } 13900005 - I/O error 5639 * @throws { BusinessError } 13900008 - Bad file descriptor 5640 * @throws { BusinessError } 13900012 - Permission denied 5641 * @throws { BusinessError } 13900013 - Bad address 5642 * @throws { BusinessError } 13900018 - Not a directory 5643 * @throws { BusinessError } 13900019 - Is a directory 5644 * @throws { BusinessError } 13900020 - Invalid argument 5645 * @throws { BusinessError } 13900023 - Text file busy 5646 * @throws { BusinessError } 13900024 - File too large 5647 * @throws { BusinessError } 13900027 - Read-only file system 5648 * @throws { BusinessError } 13900030 - File name too long 5649 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 5650 * @throws { BusinessError } 13900042 - Unknown error 5651 * @syscap SystemCapability.FileManagement.File.FileIO 5652 * @crossplatform 5653 * @since 10 5654 */ 5655/** 5656 * Truncate file. 5657 * 5658 * @param { string | number } file - path or file descriptor. 5659 * @param { AsyncCallback<void> } callback - Return the callback function. 5660 * @throws { BusinessError } 13900001 - Operation not permitted 5661 * @throws { BusinessError } 13900002 - No such file or directory 5662 * @throws { BusinessError } 13900004 - Interrupted system call 5663 * @throws { BusinessError } 13900005 - I/O error 5664 * @throws { BusinessError } 13900008 - Bad file descriptor 5665 * @throws { BusinessError } 13900012 - Permission denied 5666 * @throws { BusinessError } 13900013 - Bad address 5667 * @throws { BusinessError } 13900018 - Not a directory 5668 * @throws { BusinessError } 13900019 - Is a directory 5669 * @throws { BusinessError } 13900020 - Invalid argument 5670 * @throws { BusinessError } 13900023 - Text file busy 5671 * @throws { BusinessError } 13900024 - File too large 5672 * @throws { BusinessError } 13900027 - Read-only file system 5673 * @throws { BusinessError } 13900030 - File name too long 5674 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 5675 * @throws { BusinessError } 13900042 - Unknown error 5676 * @syscap SystemCapability.FileManagement.File.FileIO 5677 * @crossplatform 5678 * @atomicservice 5679 * @since 11 5680 */ 5681declare function truncate(file: string | number, callback: AsyncCallback<void>): void; 5682 5683/** 5684 * Truncate file. 5685 * 5686 * @param { string | number } file - path or file descriptor. 5687 * @param { number } [len = 0] - len. 5688 * @param { AsyncCallback<void> } callback - Return the callback function. 5689 * @throws { BusinessError } 13900001 - Operation not permitted 5690 * @throws { BusinessError } 13900002 - No such file or directory 5691 * @throws { BusinessError } 13900004 - Interrupted system call 5692 * @throws { BusinessError } 13900005 - I/O error 5693 * @throws { BusinessError } 13900008 - Bad file descriptor 5694 * @throws { BusinessError } 13900012 - Permission denied 5695 * @throws { BusinessError } 13900013 - Bad address 5696 * @throws { BusinessError } 13900018 - Not a directory 5697 * @throws { BusinessError } 13900019 - Is a directory 5698 * @throws { BusinessError } 13900020 - Invalid argument 5699 * @throws { BusinessError } 13900023 - Text file busy 5700 * @throws { BusinessError } 13900024 - File too large 5701 * @throws { BusinessError } 13900027 - Read-only file system 5702 * @throws { BusinessError } 13900030 - File name too long 5703 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 5704 * @throws { BusinessError } 13900042 - Unknown error 5705 * @syscap SystemCapability.FileManagement.File.FileIO 5706 * @since 9 5707 */ 5708/** 5709 * Truncate file. 5710 * 5711 * @param { string | number } file - path or file descriptor. 5712 * @param { number } [len = 0] - len. 5713 * @param { AsyncCallback<void> } callback - Return the callback function. 5714 * @throws { BusinessError } 13900001 - Operation not permitted 5715 * @throws { BusinessError } 13900002 - No such file or directory 5716 * @throws { BusinessError } 13900004 - Interrupted system call 5717 * @throws { BusinessError } 13900005 - I/O error 5718 * @throws { BusinessError } 13900008 - Bad file descriptor 5719 * @throws { BusinessError } 13900012 - Permission denied 5720 * @throws { BusinessError } 13900013 - Bad address 5721 * @throws { BusinessError } 13900018 - Not a directory 5722 * @throws { BusinessError } 13900019 - Is a directory 5723 * @throws { BusinessError } 13900020 - Invalid argument 5724 * @throws { BusinessError } 13900023 - Text file busy 5725 * @throws { BusinessError } 13900024 - File too large 5726 * @throws { BusinessError } 13900027 - Read-only file system 5727 * @throws { BusinessError } 13900030 - File name too long 5728 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 5729 * @throws { BusinessError } 13900042 - Unknown error 5730 * @syscap SystemCapability.FileManagement.File.FileIO 5731 * @crossplatform 5732 * @since 10 5733 */ 5734/** 5735 * Truncate file. 5736 * 5737 * @param { string | number } file - path or file descriptor. 5738 * @param { number } [len = 0] - len. 5739 * @param { AsyncCallback<void> } callback - Return the callback function. 5740 * @throws { BusinessError } 13900001 - Operation not permitted 5741 * @throws { BusinessError } 13900002 - No such file or directory 5742 * @throws { BusinessError } 13900004 - Interrupted system call 5743 * @throws { BusinessError } 13900005 - I/O error 5744 * @throws { BusinessError } 13900008 - Bad file descriptor 5745 * @throws { BusinessError } 13900012 - Permission denied 5746 * @throws { BusinessError } 13900013 - Bad address 5747 * @throws { BusinessError } 13900018 - Not a directory 5748 * @throws { BusinessError } 13900019 - Is a directory 5749 * @throws { BusinessError } 13900020 - Invalid argument 5750 * @throws { BusinessError } 13900023 - Text file busy 5751 * @throws { BusinessError } 13900024 - File too large 5752 * @throws { BusinessError } 13900027 - Read-only file system 5753 * @throws { BusinessError } 13900030 - File name too long 5754 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 5755 * @throws { BusinessError } 13900042 - Unknown error 5756 * @syscap SystemCapability.FileManagement.File.FileIO 5757 * @crossplatform 5758 * @atomicservice 5759 * @since 11 5760 */ 5761declare function truncate(file: string | number, len: number, callback: AsyncCallback<void>): void; 5762 5763/** 5764 * Truncate file with sync interface. 5765 * 5766 * @param { string | number } file - path or file descriptor. 5767 * @param { number } [len = 0] - len. 5768 * @throws { BusinessError } 13900001 - Operation not permitted 5769 * @throws { BusinessError } 13900002 - No such file or directory 5770 * @throws { BusinessError } 13900004 - Interrupted system call 5771 * @throws { BusinessError } 13900005 - I/O error 5772 * @throws { BusinessError } 13900008 - Bad file descriptor 5773 * @throws { BusinessError } 13900012 - Permission denied 5774 * @throws { BusinessError } 13900013 - Bad address 5775 * @throws { BusinessError } 13900018 - Not a directory 5776 * @throws { BusinessError } 13900019 - Is a directory 5777 * @throws { BusinessError } 13900020 - Invalid argument 5778 * @throws { BusinessError } 13900023 - Text file busy 5779 * @throws { BusinessError } 13900024 - File too large 5780 * @throws { BusinessError } 13900027 - Read-only file system 5781 * @throws { BusinessError } 13900030 - File name too long 5782 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 5783 * @throws { BusinessError } 13900042 - Unknown error 5784 * @syscap SystemCapability.FileManagement.File.FileIO 5785 * @since 9 5786 */ 5787/** 5788 * Truncate file with sync interface. 5789 * 5790 * @param { string | number } file - path or file descriptor. 5791 * @param { number } [len = 0] - len. 5792 * @throws { BusinessError } 13900001 - Operation not permitted 5793 * @throws { BusinessError } 13900002 - No such file or directory 5794 * @throws { BusinessError } 13900004 - Interrupted system call 5795 * @throws { BusinessError } 13900005 - I/O error 5796 * @throws { BusinessError } 13900008 - Bad file descriptor 5797 * @throws { BusinessError } 13900012 - Permission denied 5798 * @throws { BusinessError } 13900013 - Bad address 5799 * @throws { BusinessError } 13900018 - Not a directory 5800 * @throws { BusinessError } 13900019 - Is a directory 5801 * @throws { BusinessError } 13900020 - Invalid argument 5802 * @throws { BusinessError } 13900023 - Text file busy 5803 * @throws { BusinessError } 13900024 - File too large 5804 * @throws { BusinessError } 13900027 - Read-only file system 5805 * @throws { BusinessError } 13900030 - File name too long 5806 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 5807 * @throws { BusinessError } 13900042 - Unknown error 5808 * @syscap SystemCapability.FileManagement.File.FileIO 5809 * @crossplatform 5810 * @since 10 5811 */ 5812/** 5813 * Truncate file with sync interface. 5814 * 5815 * @param { string | number } file - path or file descriptor. 5816 * @param { number } [len = 0] - len. 5817 * @throws { BusinessError } 13900001 - Operation not permitted 5818 * @throws { BusinessError } 13900002 - No such file or directory 5819 * @throws { BusinessError } 13900004 - Interrupted system call 5820 * @throws { BusinessError } 13900005 - I/O error 5821 * @throws { BusinessError } 13900008 - Bad file descriptor 5822 * @throws { BusinessError } 13900012 - Permission denied 5823 * @throws { BusinessError } 13900013 - Bad address 5824 * @throws { BusinessError } 13900018 - Not a directory 5825 * @throws { BusinessError } 13900019 - Is a directory 5826 * @throws { BusinessError } 13900020 - Invalid argument 5827 * @throws { BusinessError } 13900023 - Text file busy 5828 * @throws { BusinessError } 13900024 - File too large 5829 * @throws { BusinessError } 13900027 - Read-only file system 5830 * @throws { BusinessError } 13900030 - File name too long 5831 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 5832 * @throws { BusinessError } 13900042 - Unknown error 5833 * @syscap SystemCapability.FileManagement.File.FileIO 5834 * @crossplatform 5835 * @atomicservice 5836 * @since 11 5837 */ 5838declare function truncateSync(file: string | number, len?: number): void; 5839 5840/** 5841 * Delete file. 5842 * 5843 * @param { string } path - path. 5844 * @returns { Promise<void> } The promise returned by the function. 5845 * @throws { BusinessError } 13900001 - Operation not permitted 5846 * @throws { BusinessError } 13900002 - No such file or directory 5847 * @throws { BusinessError } 13900005 - I/O error 5848 * @throws { BusinessError } 13900008 - Bad file descriptor 5849 * @throws { BusinessError } 13900011 - Out of memory 5850 * @throws { BusinessError } 13900012 - Permission denied 5851 * @throws { BusinessError } 13900013 - Bad address 5852 * @throws { BusinessError } 13900014 - Device or resource busy 5853 * @throws { BusinessError } 13900018 - Not a directory 5854 * @throws { BusinessError } 13900019 - Is a directory 5855 * @throws { BusinessError } 13900020 - Invalid argument 5856 * @throws { BusinessError } 13900027 - Read-only file system 5857 * @throws { BusinessError } 13900030 - File name too long 5858 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 5859 * @throws { BusinessError } 13900042 - Unknown error 5860 * @syscap SystemCapability.FileManagement.File.FileIO 5861 * @since 9 5862 */ 5863/** 5864 * Delete file. 5865 * 5866 * @param { string } path - path. 5867 * @returns { Promise<void> } The promise returned by the function. 5868 * @throws { BusinessError } 13900001 - Operation not permitted 5869 * @throws { BusinessError } 13900002 - No such file or directory 5870 * @throws { BusinessError } 13900005 - I/O error 5871 * @throws { BusinessError } 13900008 - Bad file descriptor 5872 * @throws { BusinessError } 13900011 - Out of memory 5873 * @throws { BusinessError } 13900012 - Permission denied 5874 * @throws { BusinessError } 13900013 - Bad address 5875 * @throws { BusinessError } 13900014 - Device or resource busy 5876 * @throws { BusinessError } 13900018 - Not a directory 5877 * @throws { BusinessError } 13900019 - Is a directory 5878 * @throws { BusinessError } 13900020 - Invalid argument 5879 * @throws { BusinessError } 13900027 - Read-only file system 5880 * @throws { BusinessError } 13900030 - File name too long 5881 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 5882 * @throws { BusinessError } 13900042 - Unknown error 5883 * @syscap SystemCapability.FileManagement.File.FileIO 5884 * @crossplatform 5885 * @since 10 5886 */ 5887/** 5888 * Delete file. 5889 * 5890 * @param { string } path - path. 5891 * @returns { Promise<void> } The promise returned by the function. 5892 * @throws { BusinessError } 13900001 - Operation not permitted 5893 * @throws { BusinessError } 13900002 - No such file or directory 5894 * @throws { BusinessError } 13900005 - I/O error 5895 * @throws { BusinessError } 13900008 - Bad file descriptor 5896 * @throws { BusinessError } 13900011 - Out of memory 5897 * @throws { BusinessError } 13900012 - Permission denied 5898 * @throws { BusinessError } 13900013 - Bad address 5899 * @throws { BusinessError } 13900014 - Device or resource busy 5900 * @throws { BusinessError } 13900018 - Not a directory 5901 * @throws { BusinessError } 13900019 - Is a directory 5902 * @throws { BusinessError } 13900020 - Invalid argument 5903 * @throws { BusinessError } 13900027 - Read-only file system 5904 * @throws { BusinessError } 13900030 - File name too long 5905 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 5906 * @throws { BusinessError } 13900042 - Unknown error 5907 * @syscap SystemCapability.FileManagement.File.FileIO 5908 * @crossplatform 5909 * @atomicservice 5910 * @since 11 5911 */ 5912declare function unlink(path: string): Promise<void>; 5913 5914/** 5915 * Delete file. 5916 * 5917 * @param { string } path - path. 5918 * @param { AsyncCallback<void> } callback - Return the callback function. 5919 * @throws { BusinessError } 13900001 - Operation not permitted 5920 * @throws { BusinessError } 13900002 - No such file or directory 5921 * @throws { BusinessError } 13900005 - I/O error 5922 * @throws { BusinessError } 13900008 - Bad file descriptor 5923 * @throws { BusinessError } 13900011 - Out of memory 5924 * @throws { BusinessError } 13900012 - Permission denied 5925 * @throws { BusinessError } 13900013 - Bad address 5926 * @throws { BusinessError } 13900014 - Device or resource busy 5927 * @throws { BusinessError } 13900018 - Not a directory 5928 * @throws { BusinessError } 13900019 - Is a directory 5929 * @throws { BusinessError } 13900020 - Invalid argument 5930 * @throws { BusinessError } 13900027 - Read-only file system 5931 * @throws { BusinessError } 13900030 - File name too long 5932 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 5933 * @throws { BusinessError } 13900042 - Unknown error 5934 * @syscap SystemCapability.FileManagement.File.FileIO 5935 * @since 9 5936 */ 5937/** 5938 * Delete file. 5939 * 5940 * @param { string } path - path. 5941 * @param { AsyncCallback<void> } callback - Return the callback function. 5942 * @throws { BusinessError } 13900001 - Operation not permitted 5943 * @throws { BusinessError } 13900002 - No such file or directory 5944 * @throws { BusinessError } 13900005 - I/O error 5945 * @throws { BusinessError } 13900008 - Bad file descriptor 5946 * @throws { BusinessError } 13900011 - Out of memory 5947 * @throws { BusinessError } 13900012 - Permission denied 5948 * @throws { BusinessError } 13900013 - Bad address 5949 * @throws { BusinessError } 13900014 - Device or resource busy 5950 * @throws { BusinessError } 13900018 - Not a directory 5951 * @throws { BusinessError } 13900019 - Is a directory 5952 * @throws { BusinessError } 13900020 - Invalid argument 5953 * @throws { BusinessError } 13900027 - Read-only file system 5954 * @throws { BusinessError } 13900030 - File name too long 5955 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 5956 * @throws { BusinessError } 13900042 - Unknown error 5957 * @syscap SystemCapability.FileManagement.File.FileIO 5958 * @crossplatform 5959 * @since 10 5960 */ 5961/** 5962 * Delete file. 5963 * 5964 * @param { string } path - path. 5965 * @param { AsyncCallback<void> } callback - Return the callback function. 5966 * @throws { BusinessError } 13900001 - Operation not permitted 5967 * @throws { BusinessError } 13900002 - No such file or directory 5968 * @throws { BusinessError } 13900005 - I/O error 5969 * @throws { BusinessError } 13900008 - Bad file descriptor 5970 * @throws { BusinessError } 13900011 - Out of memory 5971 * @throws { BusinessError } 13900012 - Permission denied 5972 * @throws { BusinessError } 13900013 - Bad address 5973 * @throws { BusinessError } 13900014 - Device or resource busy 5974 * @throws { BusinessError } 13900018 - Not a directory 5975 * @throws { BusinessError } 13900019 - Is a directory 5976 * @throws { BusinessError } 13900020 - Invalid argument 5977 * @throws { BusinessError } 13900027 - Read-only file system 5978 * @throws { BusinessError } 13900030 - File name too long 5979 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 5980 * @throws { BusinessError } 13900042 - Unknown error 5981 * @syscap SystemCapability.FileManagement.File.FileIO 5982 * @crossplatform 5983 * @atomicservice 5984 * @since 11 5985 */ 5986declare function unlink(path: string, callback: AsyncCallback<void>): void; 5987 5988/** 5989 * Delete file with sync interface. 5990 * 5991 * @param { string } path - path. 5992 * @throws { BusinessError } 13900001 - Operation not permitted 5993 * @throws { BusinessError } 13900002 - No such file or directory 5994 * @throws { BusinessError } 13900005 - I/O error 5995 * @throws { BusinessError } 13900008 - Bad file descriptor 5996 * @throws { BusinessError } 13900011 - Out of memory 5997 * @throws { BusinessError } 13900012 - Permission denied 5998 * @throws { BusinessError } 13900013 - Bad address 5999 * @throws { BusinessError } 13900014 - Device or resource busy 6000 * @throws { BusinessError } 13900018 - Not a directory 6001 * @throws { BusinessError } 13900019 - Is a directory 6002 * @throws { BusinessError } 13900020 - Invalid argument 6003 * @throws { BusinessError } 13900027 - Read-only file system 6004 * @throws { BusinessError } 13900030 - File name too long 6005 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 6006 * @throws { BusinessError } 13900042 - Unknown error 6007 * @syscap SystemCapability.FileManagement.File.FileIO 6008 * @since 9 6009 */ 6010/** 6011 * Delete file with sync interface. 6012 * 6013 * @param { string } path - path. 6014 * @throws { BusinessError } 13900001 - Operation not permitted 6015 * @throws { BusinessError } 13900002 - No such file or directory 6016 * @throws { BusinessError } 13900005 - I/O error 6017 * @throws { BusinessError } 13900008 - Bad file descriptor 6018 * @throws { BusinessError } 13900011 - Out of memory 6019 * @throws { BusinessError } 13900012 - Permission denied 6020 * @throws { BusinessError } 13900013 - Bad address 6021 * @throws { BusinessError } 13900014 - Device or resource busy 6022 * @throws { BusinessError } 13900018 - Not a directory 6023 * @throws { BusinessError } 13900019 - Is a directory 6024 * @throws { BusinessError } 13900020 - Invalid argument 6025 * @throws { BusinessError } 13900027 - Read-only file system 6026 * @throws { BusinessError } 13900030 - File name too long 6027 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 6028 * @throws { BusinessError } 13900042 - Unknown error 6029 * @syscap SystemCapability.FileManagement.File.FileIO 6030 * @crossplatform 6031 * @since 10 6032 */ 6033/** 6034 * Delete file with sync interface. 6035 * 6036 * @param { string } path - path. 6037 * @throws { BusinessError } 13900001 - Operation not permitted 6038 * @throws { BusinessError } 13900002 - No such file or directory 6039 * @throws { BusinessError } 13900005 - I/O error 6040 * @throws { BusinessError } 13900008 - Bad file descriptor 6041 * @throws { BusinessError } 13900011 - Out of memory 6042 * @throws { BusinessError } 13900012 - Permission denied 6043 * @throws { BusinessError } 13900013 - Bad address 6044 * @throws { BusinessError } 13900014 - Device or resource busy 6045 * @throws { BusinessError } 13900018 - Not a directory 6046 * @throws { BusinessError } 13900019 - Is a directory 6047 * @throws { BusinessError } 13900020 - Invalid argument 6048 * @throws { BusinessError } 13900027 - Read-only file system 6049 * @throws { BusinessError } 13900030 - File name too long 6050 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 6051 * @throws { BusinessError } 13900042 - Unknown error 6052 * @syscap SystemCapability.FileManagement.File.FileIO 6053 * @crossplatform 6054 * @atomicservice 6055 * @since 11 6056 */ 6057declare function unlinkSync(path: string): void; 6058 6059/** 6060 * Change file mtime. 6061 * 6062 * @param { string } path - path. 6063 * @param { number } mtime - last modification time 6064 * @throws { BusinessError } 13900001 - Operation not permitted 6065 * @throws { BusinessError } 13900002 - No such file or directory 6066 * @throws { BusinessError } 13900012 - Permission denied 6067 * @throws { BusinessError } 13900020 - Invalid argument 6068 * @throws { BusinessError } 13900027 - Read-only file system 6069 * @throws { BusinessError } 13900042 - Unknown error 6070 * @syscap SystemCapability.FileManagement.File.FileIO 6071 * @since 11 6072 */ 6073/** 6074 * Change file mtime. 6075 * 6076 * @param { string } path - path. 6077 * @param { number } mtime - last modification time 6078 * @throws { BusinessError } 13900001 - Operation not permitted 6079 * @throws { BusinessError } 13900002 - No such file or directory 6080 * @throws { BusinessError } 13900012 - Permission denied 6081 * @throws { BusinessError } 13900020 - Invalid argument 6082 * @throws { BusinessError } 13900027 - Read-only file system 6083 * @throws { BusinessError } 13900042 - Unknown error 6084 * @syscap SystemCapability.FileManagement.File.FileIO 6085 * @crossplatform 6086 * @since 12 6087 */ 6088declare function utimes(path: string, mtime: number): void; 6089 6090/** 6091 * Write file. 6092 * 6093 * @param { number } fd - file descriptor. 6094 * @param { ArrayBuffer | string } buffer - buffer. 6095 * @param { object } [options] - options. 6096 * @returns { Promise<number> } Returns the number of bytes written to the file in promise mode. 6097 * @throws { BusinessError } 13900001 - Operation not permitted 6098 * @throws { BusinessError } 13900004 - Interrupted system call 6099 * @throws { BusinessError } 13900005 - I/O error 6100 * @throws { BusinessError } 13900008 - Bad file descriptor 6101 * @throws { BusinessError } 13900010 - Try again 6102 * @throws { BusinessError } 13900013 - Bad address 6103 * @throws { BusinessError } 13900020 - Invalid argument 6104 * @throws { BusinessError } 13900024 - File too large 6105 * @throws { BusinessError } 13900025 - No space left on device 6106 * @throws { BusinessError } 13900034 - Operation would block 6107 * @throws { BusinessError } 13900041 - Quota exceeded 6108 * @throws { BusinessError } 13900042 - Unknown error 6109 * @syscap SystemCapability.FileManagement.File.FileIO 6110 * @since 9 6111 */ 6112/** 6113 * Write file. 6114 * 6115 * @param { number } fd - file descriptor. 6116 * @param { ArrayBuffer | string } buffer - buffer. 6117 * @param { object } [options] - options. 6118 * @returns { Promise<number> } Returns the number of bytes written to the file in promise mode. 6119 * @throws { BusinessError } 13900001 - Operation not permitted 6120 * @throws { BusinessError } 13900004 - Interrupted system call 6121 * @throws { BusinessError } 13900005 - I/O error 6122 * @throws { BusinessError } 13900008 - Bad file descriptor 6123 * @throws { BusinessError } 13900010 - Try again 6124 * @throws { BusinessError } 13900013 - Bad address 6125 * @throws { BusinessError } 13900020 - Invalid argument 6126 * @throws { BusinessError } 13900024 - File too large 6127 * @throws { BusinessError } 13900025 - No space left on device 6128 * @throws { BusinessError } 13900034 - Operation would block 6129 * @throws { BusinessError } 13900041 - Quota exceeded 6130 * @throws { BusinessError } 13900042 - Unknown error 6131 * @syscap SystemCapability.FileManagement.File.FileIO 6132 * @crossplatform 6133 * @since 10 6134 */ 6135/** 6136 * Write file. 6137 * 6138 * @param { number } fd - file descriptor. 6139 * @param { ArrayBuffer | string } buffer - buffer. 6140 * @param { WriteOptions } [options] - options. 6141 * @returns { Promise<number> } Returns the number of bytes written to the file in promise mode. 6142 * @throws { BusinessError } 13900001 - Operation not permitted 6143 * @throws { BusinessError } 13900004 - Interrupted system call 6144 * @throws { BusinessError } 13900005 - I/O error 6145 * @throws { BusinessError } 13900008 - Bad file descriptor 6146 * @throws { BusinessError } 13900010 - Try again 6147 * @throws { BusinessError } 13900013 - Bad address 6148 * @throws { BusinessError } 13900020 - Invalid argument 6149 * @throws { BusinessError } 13900024 - File too large 6150 * @throws { BusinessError } 13900025 - No space left on device 6151 * @throws { BusinessError } 13900034 - Operation would block 6152 * @throws { BusinessError } 13900041 - Quota exceeded 6153 * @throws { BusinessError } 13900042 - Unknown error 6154 * @syscap SystemCapability.FileManagement.File.FileIO 6155 * @crossplatform 6156 * @atomicservice 6157 * @since 11 6158 */ 6159declare function write( 6160 fd: number, 6161 buffer: ArrayBuffer | string, 6162 options?: WriteOptions 6163): Promise<number>; 6164 6165/** 6166 * Write file. 6167 * 6168 * @param { number } fd - file descriptor. 6169 * @param { ArrayBuffer | string } buffer - buffer. 6170 * @param { AsyncCallback<number> } callback - The callback is used to return the number of bytes written to the file. 6171 * @throws { BusinessError } 13900001 - Operation not permitted 6172 * @throws { BusinessError } 13900004 - Interrupted system call 6173 * @throws { BusinessError } 13900005 - I/O error 6174 * @throws { BusinessError } 13900008 - Bad file descriptor 6175 * @throws { BusinessError } 13900010 - Try again 6176 * @throws { BusinessError } 13900013 - Bad address 6177 * @throws { BusinessError } 13900020 - Invalid argument 6178 * @throws { BusinessError } 13900024 - File too large 6179 * @throws { BusinessError } 13900025 - No space left on device 6180 * @throws { BusinessError } 13900034 - Operation would block 6181 * @throws { BusinessError } 13900041 - Quota exceeded 6182 * @throws { BusinessError } 13900042 - Unknown error 6183 * @syscap SystemCapability.FileManagement.File.FileIO 6184 * @since 9 6185 */ 6186/** 6187 * Write file. 6188 * 6189 * @param { number } fd - file descriptor. 6190 * @param { ArrayBuffer | string } buffer - buffer. 6191 * @param { AsyncCallback<number> } callback - The callback is used to return the number of bytes written to the file. 6192 * @throws { BusinessError } 13900001 - Operation not permitted 6193 * @throws { BusinessError } 13900004 - Interrupted system call 6194 * @throws { BusinessError } 13900005 - I/O error 6195 * @throws { BusinessError } 13900008 - Bad file descriptor 6196 * @throws { BusinessError } 13900010 - Try again 6197 * @throws { BusinessError } 13900013 - Bad address 6198 * @throws { BusinessError } 13900020 - Invalid argument 6199 * @throws { BusinessError } 13900024 - File too large 6200 * @throws { BusinessError } 13900025 - No space left on device 6201 * @throws { BusinessError } 13900034 - Operation would block 6202 * @throws { BusinessError } 13900041 - Quota exceeded 6203 * @throws { BusinessError } 13900042 - Unknown error 6204 * @syscap SystemCapability.FileManagement.File.FileIO 6205 * @crossplatform 6206 * @since 10 6207 */ 6208/** 6209 * Write file. 6210 * 6211 * @param { number } fd - file descriptor. 6212 * @param { ArrayBuffer | string } buffer - buffer. 6213 * @param { AsyncCallback<number> } callback - The callback is used to return the number of bytes written to the file. 6214 * @throws { BusinessError } 13900001 - Operation not permitted 6215 * @throws { BusinessError } 13900004 - Interrupted system call 6216 * @throws { BusinessError } 13900005 - I/O error 6217 * @throws { BusinessError } 13900008 - Bad file descriptor 6218 * @throws { BusinessError } 13900010 - Try again 6219 * @throws { BusinessError } 13900013 - Bad address 6220 * @throws { BusinessError } 13900020 - Invalid argument 6221 * @throws { BusinessError } 13900024 - File too large 6222 * @throws { BusinessError } 13900025 - No space left on device 6223 * @throws { BusinessError } 13900034 - Operation would block 6224 * @throws { BusinessError } 13900041 - Quota exceeded 6225 * @throws { BusinessError } 13900042 - Unknown error 6226 * @syscap SystemCapability.FileManagement.File.FileIO 6227 * @crossplatform 6228 * @atomicservice 6229 * @since 11 6230 */ 6231declare function write(fd: number, buffer: ArrayBuffer | string, callback: AsyncCallback<number>): void; 6232 6233/** 6234 * Write file. 6235 * 6236 * @param { number } fd - file descriptor. 6237 * @param { ArrayBuffer | string } buffer - buffer. 6238 * @param { object } [options] - options. 6239 * @param { AsyncCallback<number> } callback - The callback is used to return the number of bytes written to the file. 6240 * @throws { BusinessError } 13900001 - Operation not permitted 6241 * @throws { BusinessError } 13900004 - Interrupted system call 6242 * @throws { BusinessError } 13900005 - I/O error 6243 * @throws { BusinessError } 13900008 - Bad file descriptor 6244 * @throws { BusinessError } 13900010 - Try again 6245 * @throws { BusinessError } 13900013 - Bad address 6246 * @throws { BusinessError } 13900020 - Invalid argument 6247 * @throws { BusinessError } 13900024 - File too large 6248 * @throws { BusinessError } 13900025 - No space left on device 6249 * @throws { BusinessError } 13900034 - Operation would block 6250 * @throws { BusinessError } 13900041 - Quota exceeded 6251 * @throws { BusinessError } 13900042 - Unknown error 6252 * @syscap SystemCapability.FileManagement.File.FileIO 6253 * @since 9 6254 */ 6255/** 6256 * Write file. 6257 * 6258 * @param { number } fd - file descriptor. 6259 * @param { ArrayBuffer | string } buffer - buffer. 6260 * @param { object } [options] - options. 6261 * @param { AsyncCallback<number> } callback - The callback is used to return the number of bytes written to the file. 6262 * @throws { BusinessError } 13900001 - Operation not permitted 6263 * @throws { BusinessError } 13900004 - Interrupted system call 6264 * @throws { BusinessError } 13900005 - I/O error 6265 * @throws { BusinessError } 13900008 - Bad file descriptor 6266 * @throws { BusinessError } 13900010 - Try again 6267 * @throws { BusinessError } 13900013 - Bad address 6268 * @throws { BusinessError } 13900020 - Invalid argument 6269 * @throws { BusinessError } 13900024 - File too large 6270 * @throws { BusinessError } 13900025 - No space left on device 6271 * @throws { BusinessError } 13900034 - Operation would block 6272 * @throws { BusinessError } 13900041 - Quota exceeded 6273 * @throws { BusinessError } 13900042 - Unknown error 6274 * @syscap SystemCapability.FileManagement.File.FileIO 6275 * @crossplatform 6276 * @since 10 6277 */ 6278/** 6279 * Write file. 6280 * 6281 * @param { number } fd - file descriptor. 6282 * @param { ArrayBuffer | string } buffer - buffer. 6283 * @param { WriteOptions } [options] - options. 6284 * @param { AsyncCallback<number> } callback - The callback is used to return the number of bytes written to the file. 6285 * @throws { BusinessError } 13900001 - Operation not permitted 6286 * @throws { BusinessError } 13900004 - Interrupted system call 6287 * @throws { BusinessError } 13900005 - I/O error 6288 * @throws { BusinessError } 13900008 - Bad file descriptor 6289 * @throws { BusinessError } 13900010 - Try again 6290 * @throws { BusinessError } 13900013 - Bad address 6291 * @throws { BusinessError } 13900020 - Invalid argument 6292 * @throws { BusinessError } 13900024 - File too large 6293 * @throws { BusinessError } 13900025 - No space left on device 6294 * @throws { BusinessError } 13900034 - Operation would block 6295 * @throws { BusinessError } 13900041 - Quota exceeded 6296 * @throws { BusinessError } 13900042 - Unknown error 6297 * @syscap SystemCapability.FileManagement.File.FileIO 6298 * @crossplatform 6299 * @atomicservice 6300 * @since 11 6301 */ 6302declare function write( 6303 fd: number, 6304 buffer: ArrayBuffer | string, 6305 options: WriteOptions, 6306 callback: AsyncCallback<number> 6307): void; 6308 6309/** 6310 * Write file with sync interface. 6311 * 6312 * @param { number } fd - file descriptor. 6313 * @param { ArrayBuffer | string } buffer - buffer. 6314 * @param { object } [options] - options. 6315 * @returns { number } Returns the number of bytes written to the file. 6316 * @throws { BusinessError } 13900001 - Operation not permitted 6317 * @throws { BusinessError } 13900004 - Interrupted system call 6318 * @throws { BusinessError } 13900005 - I/O error 6319 * @throws { BusinessError } 13900008 - Bad file descriptor 6320 * @throws { BusinessError } 13900010 - Try again 6321 * @throws { BusinessError } 13900013 - Bad address 6322 * @throws { BusinessError } 13900020 - Invalid argument 6323 * @throws { BusinessError } 13900024 - File too large 6324 * @throws { BusinessError } 13900025 - No space left on device 6325 * @throws { BusinessError } 13900034 - Operation would block 6326 * @throws { BusinessError } 13900041 - Quota exceeded 6327 * @throws { BusinessError } 13900042 - Unknown error 6328 * @syscap SystemCapability.FileManagement.File.FileIO 6329 * @since 9 6330 */ 6331/** 6332 * Write file with sync interface. 6333 * 6334 * @param { number } fd - file descriptor. 6335 * @param { ArrayBuffer | string } buffer - buffer. 6336 * @param { object } [options] - options. 6337 * @returns { number } Returns the number of bytes written to the file. 6338 * @throws { BusinessError } 13900001 - Operation not permitted 6339 * @throws { BusinessError } 13900004 - Interrupted system call 6340 * @throws { BusinessError } 13900005 - I/O error 6341 * @throws { BusinessError } 13900008 - Bad file descriptor 6342 * @throws { BusinessError } 13900010 - Try again 6343 * @throws { BusinessError } 13900013 - Bad address 6344 * @throws { BusinessError } 13900020 - Invalid argument 6345 * @throws { BusinessError } 13900024 - File too large 6346 * @throws { BusinessError } 13900025 - No space left on device 6347 * @throws { BusinessError } 13900034 - Operation would block 6348 * @throws { BusinessError } 13900041 - Quota exceeded 6349 * @throws { BusinessError } 13900042 - Unknown error 6350 * @syscap SystemCapability.FileManagement.File.FileIO 6351 * @crossplatform 6352 * @since 10 6353 */ 6354/** 6355 * Write file with sync interface. 6356 * 6357 * @param { number } fd - file descriptor. 6358 * @param { ArrayBuffer | string } buffer - buffer. 6359 * @param { WriteOptions } [options] - options. 6360 * @returns { number } Returns the number of bytes written to the file. 6361 * @throws { BusinessError } 13900001 - Operation not permitted 6362 * @throws { BusinessError } 13900004 - Interrupted system call 6363 * @throws { BusinessError } 13900005 - I/O error 6364 * @throws { BusinessError } 13900008 - Bad file descriptor 6365 * @throws { BusinessError } 13900010 - Try again 6366 * @throws { BusinessError } 13900013 - Bad address 6367 * @throws { BusinessError } 13900020 - Invalid argument 6368 * @throws { BusinessError } 13900024 - File too large 6369 * @throws { BusinessError } 13900025 - No space left on device 6370 * @throws { BusinessError } 13900034 - Operation would block 6371 * @throws { BusinessError } 13900041 - Quota exceeded 6372 * @throws { BusinessError } 13900042 - Unknown error 6373 * @syscap SystemCapability.FileManagement.File.FileIO 6374 * @crossplatform 6375 * @atomicservice 6376 * @since 11 6377 */ 6378declare function writeSync( 6379 fd: number, 6380 buffer: ArrayBuffer | string, 6381 options?: WriteOptions 6382): number; 6383 6384/** 6385 * Connect Distributed File System. 6386 * 6387 * @permission ohos.permission.DISTRIBUTED_DATASYNC 6388 * @param { string } networkId - The networkId of device. 6389 * @param { DfsListeners } listeners - The listeners of Distributed File System. 6390 * @returns { Promise<void> } The promise returned by the function. 6391 * @throws { BusinessError } 201 - Permission denied. 6392 * @throws { BusinessError } 401 - The parameter check failed.Possible causes:1.Mandatory parameters are left unspecified; 6393 * <br>2.Incorrect parameter types. 6394 * @throws { BusinessError } 13900045 - Connection failed. 6395 * @throws { BusinessError } 13900046 - Software caused connection abort. 6396 * @syscap SystemCapability.FileManagement.File.FileIO 6397 * @since 12 6398 */ 6399declare function connectDfs(networkId: string, listeners: DfsListeners): Promise<void>; 6400 6401/** 6402 * Disconnect Distributed File System. 6403 * 6404 * @permission ohos.permission.DISTRIBUTED_DATASYNC 6405 * @param { string } networkId - The networkId of device. 6406 * @returns { Promise<void> } The promise returned by the function. 6407 * @throws { BusinessError } 201 - Permission denied. 6408 * @throws { BusinessError } 401 - The parameter check failed.Possible causes:1.Mandatory parameters are left unspecified; 6409 * <br>2.Incorrect parameter types. 6410 * @throws { BusinessError } 13600004 - Unmount failed. 6411 * @syscap SystemCapability.FileManagement.File.FileIO 6412 * @since 12 6413 */ 6414declare function disconnectDfs(networkId: string): Promise<void>; 6415 6416/** 6417 * Set extended attributes information of the file. 6418 * 6419 * @param { string } path - path. 6420 * @param { string } key - the key of extended attribute. 6421 * @param { string } value - the value of extended attribute. 6422 * @returns { Promise<void> } The promise returned by the function. 6423 * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 6424 * <br>2.Incorrect parameter types. 6425 * @throws { BusinessError } 13900002 - No such file or directory 6426 * @throws { BusinessError } 13900011 - Out of memory 6427 * @throws { BusinessError } 13900012 - Permission denied 6428 * @throws { BusinessError } 13900020 - Invalid argument 6429 * @throws { BusinessError } 13900025 - No space left on device 6430 * @throws { BusinessError } 13900031 - Function not implemented 6431 * @throws { BusinessError } 13900038 - Value too large for defined data type 6432 * @throws { BusinessError } 13900041 - Quota exceeded 6433 * @throws { BusinessError } 13900042 - Unknown error 6434 * @syscap SystemCapability.FileManagement.File.FileIO 6435 * @since 12 6436 */ 6437declare function setxattr(path: string, key: string, value: string): Promise<void>; 6438 6439/** 6440 * Set extended attributes information of the file. 6441 * 6442 * @param { string } path - path. 6443 * @param { string } key - the key of extended attribute. 6444 * @param { string } value - the value of extended attribute. 6445 * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 6446 * <br>2.Incorrect parameter types. 6447 * @throws { BusinessError } 13900002 - No such file or directory 6448 * @throws { BusinessError } 13900011 - Out of memory 6449 * @throws { BusinessError } 13900012 - Permission denied 6450 * @throws { BusinessError } 13900020 - Invalid argument 6451 * @throws { BusinessError } 13900025 - No space left on device 6452 * @throws { BusinessError } 13900031 - Function not implemented 6453 * @throws { BusinessError } 13900038 - Value too large for defined data type 6454 * @throws { BusinessError } 13900041 - Quota exceeded 6455 * @throws { BusinessError } 13900042 - Unknown error 6456 * @syscap SystemCapability.FileManagement.File.FileIO 6457 * @since 12 6458 */ 6459 6460declare function setxattrSync(path: string, key: string, value: string): void; 6461 6462/** 6463 * Get extended attributes information of the file. 6464 * 6465 * @param { string } path - path. 6466 * @param { string } key - the key of extended attribute. 6467 * @returns { Promise<string> } The promise returned by the function. 6468 * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 6469 * <br>2.Incorrect parameter types. 6470 * @throws { BusinessError } 13900002 - No such file or directory 6471 * @throws { BusinessError } 13900007 - Arg list too long 6472 * @throws { BusinessError } 13900012 - Permission denied 6473 * @throws { BusinessError } 13900031 - Function not implemented 6474 * @throws { BusinessError } 13900037 - No data available 6475 * @throws { BusinessError } 13900038 - Value too large for defined data type 6476 * @throws { BusinessError } 13900042 - Unknown error 6477 * @syscap SystemCapability.FileManagement.File.FileIO 6478 * @since 12 6479 */ 6480declare function getxattr(path: string, key: string): Promise<string>; 6481 6482/** 6483 * Get extended attributes information of the file with sync interface. 6484 * 6485 * @param { string } path - path. 6486 * @param { string } key - the key of extended attribute. 6487 * @returns { string } Return the value of extended attribute. 6488 * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 6489 * <br>2.Incorrect parameter types. 6490 * @throws { BusinessError } 13900002 - No such file or directory 6491 * @throws { BusinessError } 13900007 - Arg list too long 6492 * @throws { BusinessError } 13900012 - Permission denied 6493 * @throws { BusinessError } 13900031 - Function not implemented 6494 * @throws { BusinessError } 13900037 - No data available 6495 * @throws { BusinessError } 13900038 - Value too large for defined data type 6496 * @throws { BusinessError } 13900042 - Unknown error 6497 * @syscap SystemCapability.FileManagement.File.FileIO 6498 * @since 12 6499 */ 6500declare function getxattrSync(path: string, key: string): string; 6501 6502/** 6503 * Progress data of copyFile 6504 * 6505 * @typedef Progress 6506 * @syscap SystemCapability.FileManagement.File.FileIO 6507 * @since 11 6508 */ 6509interface Progress { 6510 /** 6511 * @type { number } 6512 * @readonly 6513 * @syscap SystemCapability.FileManagement.File.FileIO 6514 * @since 11 6515 */ 6516 readonly processedSize: number; 6517 6518 /** 6519 * @type { number } 6520 * @readonly 6521 * @syscap SystemCapability.FileManagement.File.FileIO 6522 * @since 11 6523 */ 6524 readonly totalSize: number; 6525} 6526 6527/** 6528 * Task signal. 6529 * 6530 * @syscap SystemCapability.FileManagement.File.FileIO 6531 * @since 12 6532 */ 6533export class TaskSignal { 6534 /** 6535 * Cancel the copy task in progress. 6536 * 6537 * @throws { BusinessError } 13900010 - Try again 6538 * @throws { BusinessError } 13900012 - Permission denied by the file system 6539 * @throws { BusinessError } 13900043 - No task can be canceled. 6540 * @syscap SystemCapability.FileManagement.File.FileIO 6541 * @since 12 6542 */ 6543 cancel(): void; 6544 6545 /** 6546 * Subscribe the cancel event of current task. 6547 * 6548 * @returns { Promise<string> } Return the result of the cancel event. 6549 * @throws { BusinessError } 13900004 - Interrupted system call 6550 * @throws { BusinessError } 13900008 - Bad file descriptor 6551 * @throws { BusinessError } 13900042 - Unknown error 6552 * @syscap SystemCapability.FileManagement.File.FileIO 6553 * @since 12 6554 */ 6555 onCancel(): Promise<string>; 6556} 6557 6558/** 6559 * Get options of copy 6560 * 6561 * @typedef CopyOptions 6562 * @syscap SystemCapability.FileManagement.File.FileIO 6563 * @since 11 6564 */ 6565interface CopyOptions { 6566 /** 6567 * Listener of copy progress 6568 * 6569 * @type { ?ProgressListener } 6570 * @syscap SystemCapability.FileManagement.File.FileIO 6571 * @since 11 6572 */ 6573 progressListener?: ProgressListener; 6574 /** 6575 * Cancel signal of copy. 6576 * 6577 * @type { ?TaskSignal } 6578 * @syscap SystemCapability.FileManagement.File.FileIO 6579 * @since 12 6580 */ 6581 copySignal?: TaskSignal; 6582} 6583 6584/** 6585 * Listener of copy progress. 6586 * 6587 * @typedef { function } ProgressListener 6588 * @param { Progress } progress - indicates the progress data of copyFile 6589 * @syscap SystemCapability.FileManagement.File.FileIO 6590 * @since 11 6591 */ 6592type ProgressListener = (progress: Progress) => void; 6593 6594/** 6595 * File object. 6596 * 6597 * @interface File 6598 * @syscap SystemCapability.FileManagement.File.FileIO 6599 * @since 9 6600 */ 6601/** 6602 * File object. 6603 * 6604 * @interface File 6605 * @syscap SystemCapability.FileManagement.File.FileIO 6606 * @crossplatform 6607 * @since 10 6608 */ 6609/** 6610 * File object. 6611 * 6612 * @interface File 6613 * @syscap SystemCapability.FileManagement.File.FileIO 6614 * @crossplatform 6615 * @atomicservice 6616 * @since 11 6617 */ 6618declare interface File { 6619 /** 6620 * @type { number } 6621 * @readonly 6622 * @syscap SystemCapability.FileManagement.File.FileIO 6623 * @since 9 6624 */ 6625 /** 6626 * @type { number } 6627 * @readonly 6628 * @syscap SystemCapability.FileManagement.File.FileIO 6629 * @crossplatform 6630 * @since 10 6631 */ 6632 /** 6633 * @type { number } 6634 * @readonly 6635 * @syscap SystemCapability.FileManagement.File.FileIO 6636 * @crossplatform 6637 * @atomicservice 6638 * @since 11 6639 */ 6640 readonly fd: number; 6641 6642 /** 6643 * File path 6644 * 6645 * @type { string } 6646 * @readonly 6647 * @throws { BusinessError } 13900005 - I/O error 6648 * @throws { BusinessError } 13900042 - Unknown error 6649 * @throws { BusinessError } 14300002 - Invalid URI 6650 * @syscap SystemCapability.FileManagement.File.FileIO 6651 * @since 10 6652 */ 6653 readonly path: string; 6654 6655 /** 6656 * File name 6657 * 6658 * @type { string } 6659 * @readonly 6660 * @throws { BusinessError } 13900005 - I/O error 6661 * @throws { BusinessError } 13900042 - Unknown error 6662 * @syscap SystemCapability.FileManagement.File.FileIO 6663 * @since 10 6664 */ 6665 readonly name: string; 6666 6667 /** 6668 * Get parent path of file. 6669 * 6670 * @returns { string } Return the parent path of file. 6671 * @throws { BusinessError } 13900005 - I/O error 6672 * @throws { BusinessError } 13900042 - Unknown error 6673 * @throws { BusinessError } 14300002 - Invalid URI 6674 * @syscap SystemCapability.FileManagement.File.FileIO 6675 * @since 11 6676 */ 6677 getParent(): string; 6678 6679 /** 6680 * Lock file with blocking method. 6681 * 6682 * @param { boolean } exclusive - whether lock is exclusive. 6683 * @returns { Promise<void> } The promise returned by the function. 6684 * @throws { BusinessError } 13900004 - Interrupted system call 6685 * @throws { BusinessError } 13900008 - Bad file descriptor 6686 * @throws { BusinessError } 13900020 - Invalid argument 6687 * @throws { BusinessError } 13900034 - Operation would block 6688 * @throws { BusinessError } 13900042 - Unknown error 6689 * @throws { BusinessError } 13900043 - No record locks available 6690 * @syscap SystemCapability.FileManagement.File.FileIO 6691 * @since 9 6692 */ 6693 lock(exclusive?: boolean): Promise<void>; 6694 6695 /** 6696 * Lock file with blocking method. 6697 * 6698 * @param { AsyncCallback<void> } callback - Return the callback function. 6699 * @throws { BusinessError } 13900004 - Interrupted system call 6700 * @throws { BusinessError } 13900008 - Bad file descriptor 6701 * @throws { BusinessError } 13900020 - Invalid argument 6702 * @throws { BusinessError } 13900034 - Operation would block 6703 * @throws { BusinessError } 13900042 - Unknown error 6704 * @throws { BusinessError } 13900043 - No record locks available 6705 * @syscap SystemCapability.FileManagement.File.FileIO 6706 * @since 9 6707 */ 6708 lock(callback: AsyncCallback<void>): void; 6709 6710 /** 6711 * Lock file with blocking method. 6712 * 6713 * @param { boolean } exclusive - whether lock is exclusive. 6714 * @param { AsyncCallback<void> } callback - Return the callback function. 6715 * @throws { BusinessError } 13900004 - Interrupted system call 6716 * @throws { BusinessError } 13900008 - Bad file descriptor 6717 * @throws { BusinessError } 13900020 - Invalid argument 6718 * @throws { BusinessError } 13900034 - Operation would block 6719 * @throws { BusinessError } 13900042 - Unknown error 6720 * @throws { BusinessError } 13900043 - No record locks available 6721 * @syscap SystemCapability.FileManagement.File.FileIO 6722 * @since 9 6723 */ 6724 lock(exclusive: boolean, callback: AsyncCallback<void>): void; 6725 6726 /** 6727 * Try to lock file with returning results immediately. 6728 * 6729 * @param { boolean } exclusive - whether lock is exclusive. 6730 * @throws { BusinessError } 13900004 - Interrupted system call 6731 * @throws { BusinessError } 13900008 - Bad file descriptor 6732 * @throws { BusinessError } 13900020 - Invalid argument 6733 * @throws { BusinessError } 13900034 - Operation would block 6734 * @throws { BusinessError } 13900042 - Unknown error 6735 * @throws { BusinessError } 13900043 - No record locks available 6736 * @syscap SystemCapability.FileManagement.File.FileIO 6737 * @since 9 6738 */ 6739 tryLock(exclusive?: boolean): void; 6740 6741 /** 6742 * Unlock file. 6743 * 6744 * @throws { BusinessError } 13900004 - Interrupted system call 6745 * @throws { BusinessError } 13900008 - Bad file descriptor 6746 * @throws { BusinessError } 13900020 - Invalid argument 6747 * @throws { BusinessError } 13900034 - Operation would block 6748 * @throws { BusinessError } 13900042 - Unknown error 6749 * @throws { BusinessError } 13900043 - No record locks available 6750 * @syscap SystemCapability.FileManagement.File.FileIO 6751 * @since 9 6752 */ 6753 unlock(): void; 6754} 6755 6756/** 6757 * RandomAccessFile object. 6758 * 6759 * @interface RandomAccessFile 6760 * @syscap SystemCapability.FileManagement.File.FileIO 6761 * @since 10 6762 */ 6763declare interface RandomAccessFile { 6764 6765 /** 6766 * File descriptor 6767 * 6768 * @type { number } 6769 * @readonly 6770 * @syscap SystemCapability.FileManagement.File.FileIO 6771 * @since 10 6772 */ 6773 readonly fd: number; 6774 6775 /** 6776 * File pointer 6777 * 6778 * @type { number } 6779 * @readonly 6780 * @syscap SystemCapability.FileManagement.File.FileIO 6781 * @since 10 6782 */ 6783 readonly filePointer: number; 6784 6785 /** 6786 * Set file pointer. 6787 * 6788 * @param { number } filePointer - filePointer. 6789 * @throws { BusinessError } 13900004 - Interrupted system call 6790 * @throws { BusinessError } 13900005 - I/O error 6791 * @throws { BusinessError } 13900008 - Bad file descriptor 6792 * @throws { BusinessError } 13900020 - Invalid argument 6793 * @throws { BusinessError } 13900042 - Unknown error 6794 * @syscap SystemCapability.FileManagement.File.FileIO 6795 * @since 10 6796 */ 6797 setFilePointer(filePointer: number): void; 6798 6799 /** 6800 * Close randomAccessFile with sync interface. 6801 * 6802 * @throws { BusinessError } 13900004 - Interrupted system call 6803 * @throws { BusinessError } 13900005 - I/O error 6804 * @throws { BusinessError } 13900008 - Bad file descriptor 6805 * @throws { BusinessError } 13900025 - No space left on device 6806 * @throws { BusinessError } 13900041 - Quota exceeded 6807 * @throws { BusinessError } 13900042 - Unknown error 6808 * @syscap SystemCapability.FileManagement.File.FileIO 6809 * @since 10 6810 */ 6811 close(): void; 6812 6813 /** 6814 * Write randomAccessFile. 6815 * 6816 * @param { ArrayBuffer | string } buffer - buffer. 6817 * @param { object } [options] - options. 6818 * @returns { Promise<number> } Returns the number of bytes written to the file in promise mode. 6819 * @throws { BusinessError } 13900001 - Operation not permitted 6820 * @throws { BusinessError } 13900004 - Interrupted system call 6821 * @throws { BusinessError } 13900005 - I/O error 6822 * @throws { BusinessError } 13900008 - Bad file descriptor 6823 * @throws { BusinessError } 13900010 - Try again 6824 * @throws { BusinessError } 13900013 - Bad address 6825 * @throws { BusinessError } 13900020 - Invalid argument 6826 * @throws { BusinessError } 13900024 - File too large 6827 * @throws { BusinessError } 13900025 - No space left on device 6828 * @throws { BusinessError } 13900034 - Operation would block 6829 * @throws { BusinessError } 13900041 - Quota exceeded 6830 * @throws { BusinessError } 13900042 - Unknown error 6831 * @syscap SystemCapability.FileManagement.File.FileIO 6832 * @since 10 6833 */ 6834 /** 6835 * Write randomAccessFile. 6836 * 6837 * @param { ArrayBuffer | string } buffer - buffer. 6838 * @param { WriteOptions } [options] - options. 6839 * @returns { Promise<number> } Returns the number of bytes written to the file in promise mode. 6840 * @throws { BusinessError } 13900001 - Operation not permitted 6841 * @throws { BusinessError } 13900004 - Interrupted system call 6842 * @throws { BusinessError } 13900005 - I/O error 6843 * @throws { BusinessError } 13900008 - Bad file descriptor 6844 * @throws { BusinessError } 13900010 - Try again 6845 * @throws { BusinessError } 13900013 - Bad address 6846 * @throws { BusinessError } 13900020 - Invalid argument 6847 * @throws { BusinessError } 13900024 - File too large 6848 * @throws { BusinessError } 13900025 - No space left on device 6849 * @throws { BusinessError } 13900034 - Operation would block 6850 * @throws { BusinessError } 13900041 - Quota exceeded 6851 * @throws { BusinessError } 13900042 - Unknown error 6852 * @syscap SystemCapability.FileManagement.File.FileIO 6853 * @since 11 6854 */ 6855 write( 6856 buffer: ArrayBuffer | string, 6857 options?: WriteOptions 6858 ): Promise<number>; 6859 6860 /** 6861 * Write randomAccessFile. 6862 * 6863 * @param { ArrayBuffer | string } buffer - buffer. 6864 * @param { AsyncCallback<number> } callback - The callback is used to return the number of bytes written to the file. 6865 * @throws { BusinessError } 13900001 - Operation not permitted 6866 * @throws { BusinessError } 13900004 - Interrupted system call 6867 * @throws { BusinessError } 13900005 - I/O error 6868 * @throws { BusinessError } 13900008 - Bad file descriptor 6869 * @throws { BusinessError } 13900010 - Try again 6870 * @throws { BusinessError } 13900013 - Bad address 6871 * @throws { BusinessError } 13900020 - Invalid argument 6872 * @throws { BusinessError } 13900024 - File too large 6873 * @throws { BusinessError } 13900025 - No space left on device 6874 * @throws { BusinessError } 13900034 - Operation would block 6875 * @throws { BusinessError } 13900041 - Quota exceeded 6876 * @throws { BusinessError } 13900042 - Unknown error 6877 * @syscap SystemCapability.FileManagement.File.FileIO 6878 * @since 10 6879 */ 6880 write(buffer: ArrayBuffer | string, callback: AsyncCallback<number>): void; 6881 6882 /** 6883 * Write randomAccessFile. 6884 * 6885 * @param { ArrayBuffer | string } buffer - buffer. 6886 * @param { object } [options] - options. 6887 * @param { AsyncCallback<number> } callback - The callback is used to return the number of bytes written to the file. 6888 * @throws { BusinessError } 13900001 - Operation not permitted 6889 * @throws { BusinessError } 13900004 - Interrupted system call 6890 * @throws { BusinessError } 13900005 - I/O error 6891 * @throws { BusinessError } 13900008 - Bad file descriptor 6892 * @throws { BusinessError } 13900010 - Try again 6893 * @throws { BusinessError } 13900013 - Bad address 6894 * @throws { BusinessError } 13900020 - Invalid argument 6895 * @throws { BusinessError } 13900024 - File too large 6896 * @throws { BusinessError } 13900025 - No space left on device 6897 * @throws { BusinessError } 13900034 - Operation would block 6898 * @throws { BusinessError } 13900041 - Quota exceeded 6899 * @throws { BusinessError } 13900042 - Unknown error 6900 * @syscap SystemCapability.FileManagement.File.FileIO 6901 * @since 10 6902 */ 6903 /** 6904 * Write randomAccessFile. 6905 * 6906 * @param { ArrayBuffer | string } buffer - buffer. 6907 * @param { WriteOptions } [options] - options. 6908 * @param { AsyncCallback<number> } callback - The callback is used to return the number of bytes written to the file. 6909 * @throws { BusinessError } 13900001 - Operation not permitted 6910 * @throws { BusinessError } 13900004 - Interrupted system call 6911 * @throws { BusinessError } 13900005 - I/O error 6912 * @throws { BusinessError } 13900008 - Bad file descriptor 6913 * @throws { BusinessError } 13900010 - Try again 6914 * @throws { BusinessError } 13900013 - Bad address 6915 * @throws { BusinessError } 13900020 - Invalid argument 6916 * @throws { BusinessError } 13900024 - File too large 6917 * @throws { BusinessError } 13900025 - No space left on device 6918 * @throws { BusinessError } 13900034 - Operation would block 6919 * @throws { BusinessError } 13900041 - Quota exceeded 6920 * @throws { BusinessError } 13900042 - Unknown error 6921 * @syscap SystemCapability.FileManagement.File.FileIO 6922 * @since 11 6923 */ 6924 write( 6925 buffer: ArrayBuffer | string, 6926 options: WriteOptions, 6927 callback: AsyncCallback<number> 6928 ): void; 6929 6930 /** 6931 * Write randomAccessFile with sync interface. 6932 * 6933 * @param { ArrayBuffer | string } buffer - buffer. 6934 * @param { object } [options] - options. 6935 * @returns { number } Returns the number of bytes written to the file. 6936 * @throws { BusinessError } 13900001 - Operation not permitted 6937 * @throws { BusinessError } 13900004 - Interrupted system call 6938 * @throws { BusinessError } 13900005 - I/O error 6939 * @throws { BusinessError } 13900008 - Bad file descriptor 6940 * @throws { BusinessError } 13900010 - Try again 6941 * @throws { BusinessError } 13900013 - Bad address 6942 * @throws { BusinessError } 13900020 - Invalid argument 6943 * @throws { BusinessError } 13900024 - File too large 6944 * @throws { BusinessError } 13900025 - No space left on device 6945 * @throws { BusinessError } 13900034 - Operation would block 6946 * @throws { BusinessError } 13900041 - Quota exceeded 6947 * @throws { BusinessError } 13900042 - Unknown error 6948 * @syscap SystemCapability.FileManagement.File.FileIO 6949 * @since 10 6950 */ 6951 /** 6952 * Write randomAccessFile with sync interface. 6953 * 6954 * @param { ArrayBuffer | string } buffer - buffer. 6955 * @param { WriteOptions } [options] - options. 6956 * @returns { number } Returns the number of bytes written to the file. 6957 * @throws { BusinessError } 13900001 - Operation not permitted 6958 * @throws { BusinessError } 13900004 - Interrupted system call 6959 * @throws { BusinessError } 13900005 - I/O error 6960 * @throws { BusinessError } 13900008 - Bad file descriptor 6961 * @throws { BusinessError } 13900010 - Try again 6962 * @throws { BusinessError } 13900013 - Bad address 6963 * @throws { BusinessError } 13900020 - Invalid argument 6964 * @throws { BusinessError } 13900024 - File too large 6965 * @throws { BusinessError } 13900025 - No space left on device 6966 * @throws { BusinessError } 13900034 - Operation would block 6967 * @throws { BusinessError } 13900041 - Quota exceeded 6968 * @throws { BusinessError } 13900042 - Unknown error 6969 * @syscap SystemCapability.FileManagement.File.FileIO 6970 * @since 11 6971 */ 6972 writeSync( 6973 buffer: ArrayBuffer | string, 6974 options?: WriteOptions 6975 ): number; 6976 6977 /** 6978 * Read randomAccessFile. 6979 * 6980 * @param { ArrayBuffer } buffer - buffer. 6981 * @param { object } [options] - options. 6982 * @returns { Promise<number> } Returns the number of file bytes read to buffer in promise mode. 6983 * @throws { BusinessError } 13900004 - Interrupted system call 6984 * @throws { BusinessError } 13900005 - I/O error 6985 * @throws { BusinessError } 13900008 - Bad file descriptor 6986 * @throws { BusinessError } 13900010 - Try again 6987 * @throws { BusinessError } 13900013 - Bad address 6988 * @throws { BusinessError } 13900019 - Is a directory 6989 * @throws { BusinessError } 13900020 - Invalid argument 6990 * @throws { BusinessError } 13900034 - Operation would block 6991 * @throws { BusinessError } 13900042 - Unknown error 6992 * @syscap SystemCapability.FileManagement.File.FileIO 6993 * @since 10 6994 */ 6995 /** 6996 * Read randomAccessFile. 6997 * 6998 * @param { ArrayBuffer } buffer - buffer. 6999 * @param { ReadOptions } [options] - options. 7000 * @returns { Promise<number> } Returns the number of file bytes read to buffer in promise mode. 7001 * @throws { BusinessError } 13900004 - Interrupted system call 7002 * @throws { BusinessError } 13900005 - I/O error 7003 * @throws { BusinessError } 13900008 - Bad file descriptor 7004 * @throws { BusinessError } 13900010 - Try again 7005 * @throws { BusinessError } 13900013 - Bad address 7006 * @throws { BusinessError } 13900019 - Is a directory 7007 * @throws { BusinessError } 13900020 - Invalid argument 7008 * @throws { BusinessError } 13900034 - Operation would block 7009 * @throws { BusinessError } 13900042 - Unknown error 7010 * @syscap SystemCapability.FileManagement.File.FileIO 7011 * @since 11 7012 */ 7013 /** 7014 * Read randomAccessFile. 7015 * 7016 * @param { ArrayBuffer } buffer - buffer. 7017 * @param { ReadOptions } [options] - options. 7018 * @returns { Promise<number> } Returns the number of file bytes read to buffer in promise mode. 7019 * @throws { BusinessError } 13900004 - Interrupted system call 7020 * @throws { BusinessError } 13900005 - I/O error 7021 * @throws { BusinessError } 13900008 - Bad file descriptor 7022 * @throws { BusinessError } 13900010 - Try again 7023 * @throws { BusinessError } 13900013 - Bad address 7024 * @throws { BusinessError } 13900019 - Is a directory 7025 * @throws { BusinessError } 13900020 - Invalid argument 7026 * @throws { BusinessError } 13900034 - Operation would block 7027 * @throws { BusinessError } 13900042 - Unknown error 7028 * @throws { BusinessError } 13900044 - Network is unreachable 7029 * @syscap SystemCapability.FileManagement.File.FileIO 7030 * @since 12 7031 */ 7032 read( 7033 buffer: ArrayBuffer, 7034 options?: ReadOptions 7035 ): Promise<number>; 7036 7037 /** 7038 * Read randomAccessFile. 7039 * 7040 * @param { ArrayBuffer } buffer - buffer. 7041 * @param { AsyncCallback<number> } callback - The callback is used to return the number of file bytes read to buffer. 7042 * @throws { BusinessError } 13900004 - Interrupted system call 7043 * @throws { BusinessError } 13900005 - I/O error 7044 * @throws { BusinessError } 13900008 - Bad file descriptor 7045 * @throws { BusinessError } 13900010 - Try again 7046 * @throws { BusinessError } 13900013 - Bad address 7047 * @throws { BusinessError } 13900019 - Is a directory 7048 * @throws { BusinessError } 13900020 - Invalid argument 7049 * @throws { BusinessError } 13900034 - Operation would block 7050 * @throws { BusinessError } 13900042 - Unknown error 7051 * @syscap SystemCapability.FileManagement.File.FileIO 7052 * @since 10 7053 */ 7054 read(buffer: ArrayBuffer, callback: AsyncCallback<number>): void; 7055 7056 /** 7057 * Read randomAccessFile. 7058 * 7059 * @param { ArrayBuffer } buffer - buffer. 7060 * @param { object } [options] - options. 7061 * @param { AsyncCallback<number> } callback - The callback is used to return the number of file bytes read to buffer. 7062 * @throws { BusinessError } 13900004 - Interrupted system call 7063 * @throws { BusinessError } 13900005 - I/O error 7064 * @throws { BusinessError } 13900008 - Bad file descriptor 7065 * @throws { BusinessError } 13900010 - Try again 7066 * @throws { BusinessError } 13900013 - Bad address 7067 * @throws { BusinessError } 13900019 - Is a directory 7068 * @throws { BusinessError } 13900020 - Invalid argument 7069 * @throws { BusinessError } 13900034 - Operation would block 7070 * @throws { BusinessError } 13900042 - Unknown error 7071 * @syscap SystemCapability.FileManagement.File.FileIO 7072 * @since 10 7073 */ 7074 /** 7075 * Read randomAccessFile. 7076 * 7077 * @param { ArrayBuffer } buffer - buffer. 7078 * @param { ReadOptions } [options] - options. 7079 * @param { AsyncCallback<number> } callback - The callback is used to return the number of file bytes read to buffer. 7080 * @throws { BusinessError } 13900004 - Interrupted system call 7081 * @throws { BusinessError } 13900005 - I/O error 7082 * @throws { BusinessError } 13900008 - Bad file descriptor 7083 * @throws { BusinessError } 13900010 - Try again 7084 * @throws { BusinessError } 13900013 - Bad address 7085 * @throws { BusinessError } 13900019 - Is a directory 7086 * @throws { BusinessError } 13900020 - Invalid argument 7087 * @throws { BusinessError } 13900034 - Operation would block 7088 * @throws { BusinessError } 13900042 - Unknown error 7089 * @syscap SystemCapability.FileManagement.File.FileIO 7090 * @since 11 7091 */ 7092 read( 7093 buffer: ArrayBuffer, 7094 options: ReadOptions, 7095 callback: AsyncCallback<number> 7096 ): void; 7097 7098 /** 7099 * Read randomAccessFile with sync interface. 7100 * 7101 * @param { ArrayBuffer } buffer - buffer. 7102 * @param { object } [options] - options. 7103 * @returns { number } Returns the number of file bytes read to buffer. 7104 * @throws { BusinessError } 13900004 - Interrupted system call 7105 * @throws { BusinessError } 13900005 - I/O error 7106 * @throws { BusinessError } 13900008 - Bad file descriptor 7107 * @throws { BusinessError } 13900010 - Try again 7108 * @throws { BusinessError } 13900013 - Bad address 7109 * @throws { BusinessError } 13900019 - Is a directory 7110 * @throws { BusinessError } 13900020 - Invalid argument 7111 * @throws { BusinessError } 13900034 - Operation would block 7112 * @throws { BusinessError } 13900042 - Unknown error 7113 * @syscap SystemCapability.FileManagement.File.FileIO 7114 * @since 10 7115 */ 7116 /** 7117 * Read randomAccessFile with sync interface. 7118 * 7119 * @param { ArrayBuffer } buffer - buffer. 7120 * @param { ReadOptions } [options] - options. 7121 * @returns { number } Returns the number of file bytes read to buffer. 7122 * @throws { BusinessError } 13900004 - Interrupted system call 7123 * @throws { BusinessError } 13900005 - I/O error 7124 * @throws { BusinessError } 13900008 - Bad file descriptor 7125 * @throws { BusinessError } 13900010 - Try again 7126 * @throws { BusinessError } 13900013 - Bad address 7127 * @throws { BusinessError } 13900019 - Is a directory 7128 * @throws { BusinessError } 13900020 - Invalid argument 7129 * @throws { BusinessError } 13900034 - Operation would block 7130 * @throws { BusinessError } 13900042 - Unknown error 7131 * @syscap SystemCapability.FileManagement.File.FileIO 7132 * @since 11 7133 */ 7134 /** 7135 * Read randomAccessFile with sync interface. 7136 * 7137 * @param { ArrayBuffer } buffer - buffer. 7138 * @param { ReadOptions } [options] - options. 7139 * @returns { number } Returns the number of file bytes read to buffer. 7140 * @throws { BusinessError } 13900004 - Interrupted system call 7141 * @throws { BusinessError } 13900005 - I/O error 7142 * @throws { BusinessError } 13900008 - Bad file descriptor 7143 * @throws { BusinessError } 13900010 - Try again 7144 * @throws { BusinessError } 13900013 - Bad address 7145 * @throws { BusinessError } 13900019 - Is a directory 7146 * @throws { BusinessError } 13900020 - Invalid argument 7147 * @throws { BusinessError } 13900034 - Operation would block 7148 * @throws { BusinessError } 13900042 - Unknown error 7149 * @throws { BusinessError } 13900044 - Network is unreachable 7150 * @syscap SystemCapability.FileManagement.File.FileIO 7151 * @since 12 7152 */ 7153 readSync( 7154 buffer: ArrayBuffer, 7155 options?: ReadOptions 7156 ): number; 7157 7158 /** 7159 * Generate read stream from RandomAccessFile object. 7160 * 7161 * @returns { ReadStream } Return ReadStream object. 7162 * @throws { BusinessError } 401 - Parameter error 7163 * @throws { BusinessError } 13900008 - Bad file descriptor 7164 * @throws { BusinessError } 13900011 - Out of memory 7165 * @throws { BusinessError } 13900012 - Permission denied 7166 * @throws { BusinessError } 13900020 - Invalid argument 7167 * @throws { BusinessError } 13900042 - Unknown error 7168 * @syscap SystemCapability.FileManagement.File.FileIO 7169 * @since 12 7170 */ 7171 getReadStream(): ReadStream; 7172 7173 /** 7174 * Generate write stream from RandomAccessFile object. 7175 * 7176 * @returns { WriteStream } Return WriteStream object. 7177 * @throws { BusinessError } 401 - Parameter error 7178 * @throws { BusinessError } 13900008 - Bad file descriptor 7179 * @throws { BusinessError } 13900011 - Out of memory 7180 * @throws { BusinessError } 13900012 - Permission denied 7181 * @throws { BusinessError } 13900020 - Invalid argument 7182 * @throws { BusinessError } 13900042 - Unknown error 7183 * @syscap SystemCapability.FileManagement.File.FileIO 7184 * @since 12 7185 */ 7186 getWriteStream(): WriteStream; 7187} 7188 7189/** 7190 * File Read Stream. 7191 * 7192 * @extends stream.Readable 7193 * @syscap SystemCapability.FileManagement.File.FileIO 7194 * @since 12 7195 */ 7196declare class ReadStream extends stream.Readable { 7197 /** 7198 * The ReadStream constructor. 7199 * 7200 * @syscap SystemCapability.FileManagement.File.FileIO 7201 * @since 12 7202 */ 7203 constructor(); 7204 7205 /** 7206 * The Number of bytes read in the stream. 7207 * 7208 * @type { number } 7209 * @readonly 7210 * @throws { BusinessError } 13900042 - Unknown error 7211 * @syscap SystemCapability.FileManagement.File.FileIO 7212 * @since 12 7213 */ 7214 readonly bytesRead: number; 7215 7216 /** 7217 * The path of the file being read. 7218 * 7219 * @type { string } 7220 * @readonly 7221 * @throws { BusinessError } 13900042 - Unknown error 7222 * @syscap SystemCapability.FileManagement.File.FileIO 7223 * @since 12 7224 */ 7225 readonly path: string; 7226 7227 /** 7228 * Set the file position indicator for the read stream. 7229 * 7230 * @param { number } offset - file offset. 7231 * @param { WhenceType } [whence = WhenceType.SEEK_SET] - directive whence. 7232 * @returns { number } Returns the offset relative to starting position of stream. 7233 * @throws { BusinessError } 401 - Parameter error 7234 * @throws { BusinessError } 13900020 - Invalid argument 7235 * @throws { BusinessError } 13900026 - Illegal seek 7236 * @throws { BusinessError } 13900042 - Unknown error 7237 * @syscap SystemCapability.FileManagement.File.FileIO 7238 * @since 12 7239 */ 7240 seek(offset: number, whence?: WhenceType): number; 7241 7242 /** 7243 * Close ReadStream with sync interface. 7244 * 7245 * @throws { BusinessError } 13900004 - Interrupted system call 7246 * @throws { BusinessError } 13900005 - I/O error 7247 * @throws { BusinessError } 13900008 - Bad file descriptor 7248 * @throws { BusinessError } 13900025 - No space left on device 7249 * @throws { BusinessError } 13900041 - Quota exceeded 7250 * @throws { BusinessError } 13900042 - Unknown error 7251 * @syscap SystemCapability.FileManagement.File.FileIO 7252 * @since 12 7253 */ 7254 close(): void; 7255} 7256 7257/** 7258 * File Write Stream. 7259 * 7260 * @extends stream.Writable 7261 * @syscap SystemCapability.FileManagement.File.FileIO 7262 * @since 12 7263 */ 7264declare class WriteStream extends stream.Writable { 7265 /** 7266 * The WriteStream constructor. 7267 * 7268 * @syscap SystemCapability.FileManagement.File.FileIO 7269 * @since 12 7270 */ 7271 constructor(); 7272 7273 /** 7274 * The Number of bytes written in the stream. 7275 * 7276 * @type { number } 7277 * @readonly 7278 * @throws { BusinessError } 13900042 - Unknown error 7279 * @syscap SystemCapability.FileManagement.File.FileIO 7280 * @since 12 7281 */ 7282 readonly bytesWritten: number; 7283 7284 /** 7285 * The path of the file being written. 7286 * 7287 * @type { string } 7288 * @readonly 7289 * @throws { BusinessError } 13900042 - Unknown error 7290 * @syscap SystemCapability.FileManagement.File.FileIO 7291 * @since 12 7292 */ 7293 readonly path: string; 7294 7295 /** 7296 * Set the file position indicator for the write stream. 7297 * 7298 * @param { number } offset - file offset. 7299 * @param { WhenceType } [whence = WhenceType.SEEK_SET] - directive whence. 7300 * @returns { number } Returns the offset relative to starting position of stream. 7301 * @throws { BusinessError } 401 - Parameter error 7302 * @throws { BusinessError } 13900020 - Invalid argument 7303 * @throws { BusinessError } 13900026 - Illegal seek 7304 * @throws { BusinessError } 13900042 - Unknown error 7305 * @syscap SystemCapability.FileManagement.File.FileIO 7306 * @since 12 7307 */ 7308 seek(offset: number, whence?: WhenceType): number; 7309 7310 /** 7311 * Close WriteStream with sync interface. 7312 * 7313 * @throws { BusinessError } 13900004 - Interrupted system call 7314 * @throws { BusinessError } 13900005 - I/O error 7315 * @throws { BusinessError } 13900008 - Bad file descriptor 7316 * @throws { BusinessError } 13900025 - No space left on device 7317 * @throws { BusinessError } 13900041 - Quota exceeded 7318 * @throws { BusinessError } 13900042 - Unknown error 7319 * @syscap SystemCapability.FileManagement.File.FileIO 7320 * @since 12 7321 */ 7322 close(): void; 7323} 7324 7325/** 7326 * Stat object. 7327 * 7328 * @interface Stat 7329 * @syscap SystemCapability.FileManagement.File.FileIO 7330 * @since 9 7331 */ 7332/** 7333 * Stat object. 7334 * 7335 * @interface Stat 7336 * @syscap SystemCapability.FileManagement.File.FileIO 7337 * @crossplatform 7338 * @since 10 7339 */ 7340/** 7341 * Stat object. 7342 * 7343 * @interface Stat 7344 * @syscap SystemCapability.FileManagement.File.FileIO 7345 * @crossplatform 7346 * @atomicservice 7347 * @since 11 7348 */ 7349declare interface Stat { 7350 /** 7351 * @type { bigint } 7352 * @readonly 7353 * @throws { BusinessError } 13900005 - I/O error 7354 * @throws { BusinessError } 13900042 - Unknown error 7355 * @syscap SystemCapability.FileManagement.File.FileIO 7356 * @since 9 7357 */ 7358 /** 7359 * @type { bigint } 7360 * @readonly 7361 * @throws { BusinessError } 13900005 - I/O error 7362 * @throws { BusinessError } 13900042 - Unknown error 7363 * @syscap SystemCapability.FileManagement.File.FileIO 7364 * @crossplatform 7365 * @since 10 7366 */ 7367 readonly ino: bigint; 7368 /** 7369 * @type { number } 7370 * @readonly 7371 * @throws { BusinessError } 13900005 - I/O error 7372 * @throws { BusinessError } 13900042 - Unknown error 7373 * @syscap SystemCapability.FileManagement.File.FileIO 7374 * @since 9 7375 */ 7376 /** 7377 * @type { number } 7378 * @readonly 7379 * @throws { BusinessError } 13900005 - I/O error 7380 * @throws { BusinessError } 13900042 - Unknown error 7381 * @syscap SystemCapability.FileManagement.File.FileIO 7382 * @crossplatform 7383 * @since 10 7384 */ 7385 /** 7386 * @type { number } 7387 * @readonly 7388 * @throws { BusinessError } 13900005 - I/O error 7389 * @throws { BusinessError } 13900042 - Unknown error 7390 * @syscap SystemCapability.FileManagement.File.FileIO 7391 * @crossplatform 7392 * @atomicservice 7393 * @since 11 7394 */ 7395 readonly mode: number; 7396 /** 7397 * @type { number } 7398 * @readonly 7399 * @throws { BusinessError } 13900005 - I/O error 7400 * @throws { BusinessError } 13900042 - Unknown error 7401 * @throws { BusinessError } 13900005 - I/O error 7402 * @throws { BusinessError } 13900042 - Unknown error 7403 * @syscap SystemCapability.FileManagement.File.FileIO 7404 * @since 9 7405 */ 7406 /** 7407 * @type { number } 7408 * @readonly 7409 * @throws { BusinessError } 13900005 - I/O error 7410 * @throws { BusinessError } 13900042 - Unknown error 7411 * @throws { BusinessError } 13900005 - I/O error 7412 * @throws { BusinessError } 13900042 - Unknown error 7413 * @syscap SystemCapability.FileManagement.File.FileIO 7414 * @crossplatform 7415 * @since 10 7416 */ 7417 readonly uid: number; 7418 /** 7419 * @type { number } 7420 * @readonly 7421 * @throws { BusinessError } 13900005 - I/O error 7422 * @throws { BusinessError } 13900042 - Unknown error 7423 * @syscap SystemCapability.FileManagement.File.FileIO 7424 * @since 9 7425 */ 7426 /** 7427 * @type { number } 7428 * @readonly 7429 * @throws { BusinessError } 13900005 - I/O error 7430 * @throws { BusinessError } 13900042 - Unknown error 7431 * @syscap SystemCapability.FileManagement.File.FileIO 7432 * @crossplatform 7433 * @since 10 7434 */ 7435 readonly gid: number; 7436 /** 7437 * @type { number } 7438 * @readonly 7439 * @throws { BusinessError } 13900005 - I/O error 7440 * @throws { BusinessError } 13900042 - Unknown error 7441 * @syscap SystemCapability.FileManagement.File.FileIO 7442 * @since 9 7443 */ 7444 /** 7445 * @type { number } 7446 * @readonly 7447 * @throws { BusinessError } 13900005 - I/O error 7448 * @throws { BusinessError } 13900042 - Unknown error 7449 * @syscap SystemCapability.FileManagement.File.FileIO 7450 * @crossplatform 7451 * @since 10 7452 */ 7453 /** 7454 * @type { number } 7455 * @readonly 7456 * @throws { BusinessError } 13900005 - I/O error 7457 * @throws { BusinessError } 13900042 - Unknown error 7458 * @syscap SystemCapability.FileManagement.File.FileIO 7459 * @crossplatform 7460 * @atomicservice 7461 * @since 11 7462 */ 7463 readonly size: number; 7464 /** 7465 * @type { number } 7466 * @readonly 7467 * @throws { BusinessError } 13900005 - I/O error 7468 * @throws { BusinessError } 13900042 - Unknown error 7469 * @syscap SystemCapability.FileManagement.File.FileIO 7470 * @since 9 7471 */ 7472 /** 7473 * @type { number } 7474 * @readonly 7475 * @throws { BusinessError } 13900005 - I/O error 7476 * @throws { BusinessError } 13900042 - Unknown error 7477 * @syscap SystemCapability.FileManagement.File.FileIO 7478 * @crossplatform 7479 * @since 10 7480 */ 7481 /** 7482 * @type { number } 7483 * @readonly 7484 * @throws { BusinessError } 13900005 - I/O error 7485 * @throws { BusinessError } 13900042 - Unknown error 7486 * @syscap SystemCapability.FileManagement.File.FileIO 7487 * @crossplatform 7488 * @atomicservice 7489 * @since 11 7490 */ 7491 readonly atime: number; 7492 /** 7493 * @type { number } 7494 * @readonly 7495 * @throws { BusinessError } 13900005 - I/O error 7496 * @throws { BusinessError } 13900042 - Unknown error 7497 * @syscap SystemCapability.FileManagement.File.FileIO 7498 * @since 9 7499 */ 7500 /** 7501 * @type { number } 7502 * @readonly 7503 * @throws { BusinessError } 13900005 - I/O error 7504 * @throws { BusinessError } 13900042 - Unknown error 7505 * @syscap SystemCapability.FileManagement.File.FileIO 7506 * @crossplatform 7507 * @since 10 7508 */ 7509 /** 7510 * @type { number } 7511 * @readonly 7512 * @throws { BusinessError } 13900005 - I/O error 7513 * @throws { BusinessError } 13900042 - Unknown error 7514 * @syscap SystemCapability.FileManagement.File.FileIO 7515 * @crossplatform 7516 * @atomicservice 7517 * @since 11 7518 */ 7519 readonly mtime: number; 7520 /** 7521 * @type { number } 7522 * @readonly 7523 * @throws { BusinessError } 13900005 - I/O error 7524 * @throws { BusinessError } 13900042 - Unknown error 7525 * @syscap SystemCapability.FileManagement.File.FileIO 7526 * @since 9 7527 */ 7528 /** 7529 * @type { number } 7530 * @readonly 7531 * @throws { BusinessError } 13900005 - I/O error 7532 * @throws { BusinessError } 13900042 - Unknown error 7533 * @syscap SystemCapability.FileManagement.File.FileIO 7534 * @crossplatform 7535 * @since 10 7536 */ 7537 readonly ctime: number; 7538 /** 7539 * 7540 * @type { LocationType } 7541 * @readonly 7542 * @throws { BusinessError } 13900042 - Unknown error 7543 * @syscap SystemCapability.FileManagement.File.FileIO 7544 * @since 11 7545 */ 7546 readonly location: LocationType; 7547 7548 /** 7549 * Whether path/fd is block device. 7550 * 7551 * @returns { boolean } Returns whether the path/fd point to a block device or not. 7552 * @throws { BusinessError } 13900005 - I/O error 7553 * @throws { BusinessError } 13900042 - Unknown error 7554 * @syscap SystemCapability.FileManagement.File.FileIO 7555 * @since 9 7556 */ 7557 /** 7558 * Whether path/fd is block device. 7559 * 7560 * @returns { boolean } Returns whether the path/fd point to a block device or not. 7561 * @throws { BusinessError } 13900005 - I/O error 7562 * @throws { BusinessError } 13900042 - Unknown error 7563 * @syscap SystemCapability.FileManagement.File.FileIO 7564 * @crossplatform 7565 * @since 10 7566 */ 7567 isBlockDevice(): boolean; 7568 /** 7569 * Whether path/fd is character device. 7570 * 7571 * @returns { boolean } Returns whether the path/fd point to a character device or not. 7572 * @throws { BusinessError } 13900005 - I/O error 7573 * @throws { BusinessError } 13900042 - Unknown error 7574 * @syscap SystemCapability.FileManagement.File.FileIO 7575 * @since 9 7576 */ 7577 /** 7578 * Whether path/fd is character device. 7579 * 7580 * @returns { boolean } Returns whether the path/fd point to a character device or not. 7581 * @throws { BusinessError } 13900005 - I/O error 7582 * @throws { BusinessError } 13900042 - Unknown error 7583 * @syscap SystemCapability.FileManagement.File.FileIO 7584 * @crossplatform 7585 * @since 10 7586 */ 7587 isCharacterDevice(): boolean; 7588 /** 7589 * Whether path/fd is directory. 7590 * 7591 * @returns { boolean } Returns whether the path/fd point to a directory or not. 7592 * @throws { BusinessError } 13900005 - I/O error 7593 * @throws { BusinessError } 13900042 - Unknown error 7594 * @syscap SystemCapability.FileManagement.File.FileIO 7595 * @since 9 7596 */ 7597 /** 7598 * Whether path/fd is directory. 7599 * 7600 * @returns { boolean } Returns whether the path/fd point to a directory or not. 7601 * @throws { BusinessError } 13900005 - I/O error 7602 * @throws { BusinessError } 13900042 - Unknown error 7603 * @syscap SystemCapability.FileManagement.File.FileIO 7604 * @crossplatform 7605 * @since 10 7606 */ 7607 /** 7608 * Whether path/fd is directory. 7609 * 7610 * @returns { boolean } Returns whether the path/fd point to a directory or not. 7611 * @throws { BusinessError } 13900005 - I/O error 7612 * @throws { BusinessError } 13900042 - Unknown error 7613 * @syscap SystemCapability.FileManagement.File.FileIO 7614 * @crossplatform 7615 * @atomicservice 7616 * @since 11 7617 */ 7618 isDirectory(): boolean; 7619 /** 7620 * Whether path/fd is fifo. 7621 * 7622 * @returns { boolean } Returns whether the path/fd point to a fifo file or not. 7623 * @throws { BusinessError } 13900005 - I/O error 7624 * @throws { BusinessError } 13900042 - Unknown error 7625 * @syscap SystemCapability.FileManagement.File.FileIO 7626 * @since 9 7627 */ 7628 /** 7629 * Whether path/fd is fifo. 7630 * 7631 * @returns { boolean } Returns whether the path/fd point to a fifo file or not. 7632 * @throws { BusinessError } 13900005 - I/O error 7633 * @throws { BusinessError } 13900042 - Unknown error 7634 * @syscap SystemCapability.FileManagement.File.FileIO 7635 * @crossplatform 7636 * @since 10 7637 */ 7638 isFIFO(): boolean; 7639 /** 7640 * Whether path/fd is file. 7641 * 7642 * @returns { boolean } Returns whether the path/fd point to a normal file or not. 7643 * @throws { BusinessError } 13900005 - I/O error 7644 * @throws { BusinessError } 13900042 - Unknown error 7645 * @syscap SystemCapability.FileManagement.File.FileIO 7646 * @since 9 7647 */ 7648 /** 7649 * Whether path/fd is file. 7650 * 7651 * @returns { boolean } Returns whether the path/fd point to a normal file or not. 7652 * @throws { BusinessError } 13900005 - I/O error 7653 * @throws { BusinessError } 13900042 - Unknown error 7654 * @syscap SystemCapability.FileManagement.File.FileIO 7655 * @crossplatform 7656 * @since 10 7657 */ 7658 /** 7659 * Whether path/fd is file. 7660 * 7661 * @returns { boolean } Returns whether the path/fd point to a normal file or not. 7662 * @throws { BusinessError } 13900005 - I/O error 7663 * @throws { BusinessError } 13900042 - Unknown error 7664 * @syscap SystemCapability.FileManagement.File.FileIO 7665 * @crossplatform 7666 * @atomicservice 7667 * @since 11 7668 */ 7669 isFile(): boolean; 7670 /** 7671 * Whether path/fd is socket. 7672 * 7673 * @returns { boolean } Returns whether the path/fd point to a socket file or not. 7674 * @throws { BusinessError } 13900005 - I/O error 7675 * @throws { BusinessError } 13900042 - Unknown error 7676 * @syscap SystemCapability.FileManagement.File.FileIO 7677 * @since 9 7678 */ 7679 /** 7680 * Whether path/fd is socket. 7681 * 7682 * @returns { boolean } Returns whether the path/fd point to a socket file or not. 7683 * @throws { BusinessError } 13900005 - I/O error 7684 * @throws { BusinessError } 13900042 - Unknown error 7685 * @syscap SystemCapability.FileManagement.File.FileIO 7686 * @crossplatform 7687 * @since 10 7688 */ 7689 isSocket(): boolean; 7690 /** 7691 * Whether path/fd is symbolic link. 7692 * 7693 * @returns { boolean } Returns whether the path/fd point to a symbolic link or not. 7694 * @throws { BusinessError } 13900005 - I/O error 7695 * @throws { BusinessError } 13900042 - Unknown error 7696 * @syscap SystemCapability.FileManagement.File.FileIO 7697 * @since 9 7698 */ 7699 /** 7700 * Whether path/fd is symbolic link. 7701 * 7702 * @returns { boolean } Returns whether the path/fd point to a symbolic link or not. 7703 * @throws { BusinessError } 13900005 - I/O error 7704 * @throws { BusinessError } 13900042 - Unknown error 7705 * @syscap SystemCapability.FileManagement.File.FileIO 7706 * @crossplatform 7707 * @since 10 7708 */ 7709 isSymbolicLink(): boolean; 7710} 7711 7712/** 7713 * Stream object 7714 * 7715 * @interface Stream 7716 * @syscap SystemCapability.FileManagement.File.FileIO 7717 * @since 9 7718 */ 7719declare interface Stream { 7720 /** 7721 * Close stream. 7722 * 7723 * @returns { Promise<void> } The promise returned by the function. 7724 * @throws { BusinessError } 13900004 - Interrupted system call 7725 * @throws { BusinessError } 13900005 - I/O error 7726 * @throws { BusinessError } 13900008 - Bad file descriptor 7727 * @throws { BusinessError } 13900025 - No space left on device 7728 * @throws { BusinessError } 13900041 - Quota exceeded 7729 * @throws { BusinessError } 13900042 - Unknown error 7730 * @syscap SystemCapability.FileManagement.File.FileIO 7731 * @since 9 7732 */ 7733 close(): Promise<void>; 7734 7735 /** 7736 * Close stream. 7737 * 7738 * @param { AsyncCallback<void> } callback - Return the callback function. 7739 * @throws { BusinessError } 13900004 - Interrupted system call 7740 * @throws { BusinessError } 13900005 - I/O error 7741 * @throws { BusinessError } 13900008 - Bad file descriptor 7742 * @throws { BusinessError } 13900025 - No space left on device 7743 * @throws { BusinessError } 13900041 - Quota exceeded 7744 * @throws { BusinessError } 13900042 - Unknown error 7745 * @syscap SystemCapability.FileManagement.File.FileIO 7746 * @since 9 7747 */ 7748 close(callback: AsyncCallback<void>): void; 7749 7750 /** 7751 * Close stream with sync interface. 7752 * 7753 * @throws { BusinessError } 13900004 - Interrupted system call 7754 * @throws { BusinessError } 13900005 - I/O error 7755 * @throws { BusinessError } 13900008 - Bad file descriptor 7756 * @throws { BusinessError } 13900025 - No space left on device 7757 * @throws { BusinessError } 13900041 - Quota exceeded 7758 * @throws { BusinessError } 13900042 - Unknown error 7759 * @syscap SystemCapability.FileManagement.File.FileIO 7760 * @since 9 7761 */ 7762 closeSync(): void; 7763 7764 /** 7765 * Flush stream. 7766 * 7767 * @returns { Promise<void> } The promise returned by the function. 7768 * @throws { BusinessError } 13900001 - Operation not permitted 7769 * @throws { BusinessError } 13900004 - Interrupted system call 7770 * @throws { BusinessError } 13900005 - I/O error 7771 * @throws { BusinessError } 13900008 - Bad file descriptor 7772 * @throws { BusinessError } 13900010 - Try again 7773 * @throws { BusinessError } 13900013 - Bad address 7774 * @throws { BusinessError } 13900020 - Invalid argument 7775 * @throws { BusinessError } 13900024 - File too large 7776 * @throws { BusinessError } 13900025 - No space left on device 7777 * @throws { BusinessError } 13900034 - Operation would block 7778 * @throws { BusinessError } 13900041 - Quota exceeded 7779 * @throws { BusinessError } 13900042 - Unknown error 7780 * @syscap SystemCapability.FileManagement.File.FileIO 7781 * @since 9 7782 */ 7783 flush(): Promise<void>; 7784 7785 /** 7786 * Flush stream. 7787 * 7788 * @param { AsyncCallback<void> } callback - Return the callback function. 7789 * @throws { BusinessError } 13900001 - Operation not permitted 7790 * @throws { BusinessError } 13900004 - Interrupted system call 7791 * @throws { BusinessError } 13900005 - I/O error 7792 * @throws { BusinessError } 13900008 - Bad file descriptor 7793 * @throws { BusinessError } 13900010 - Try again 7794 * @throws { BusinessError } 13900013 - Bad address 7795 * @throws { BusinessError } 13900020 - Invalid argument 7796 * @throws { BusinessError } 13900024 - File too large 7797 * @throws { BusinessError } 13900025 - No space left on device 7798 * @throws { BusinessError } 13900034 - Operation would block 7799 * @throws { BusinessError } 13900041 - Quota exceeded 7800 * @throws { BusinessError } 13900042 - Unknown error 7801 * @syscap SystemCapability.FileManagement.File.FileIO 7802 * @since 9 7803 */ 7804 flush(callback: AsyncCallback<void>): void; 7805 7806 /** 7807 * Flush stream with sync interface. 7808 * 7809 * @throws { BusinessError } 13900001 - Operation not permitted 7810 * @throws { BusinessError } 13900004 - Interrupted system call 7811 * @throws { BusinessError } 13900005 - I/O error 7812 * @throws { BusinessError } 13900008 - Bad file descriptor 7813 * @throws { BusinessError } 13900010 - Try again 7814 * @throws { BusinessError } 13900013 - Bad address 7815 * @throws { BusinessError } 13900020 - Invalid argument 7816 * @throws { BusinessError } 13900024 - File too large 7817 * @throws { BusinessError } 13900025 - No space left on device 7818 * @throws { BusinessError } 13900034 - Operation would block 7819 * @throws { BusinessError } 13900041 - Quota exceeded 7820 * @throws { BusinessError } 13900042 - Unknown error 7821 * @syscap SystemCapability.FileManagement.File.FileIO 7822 * @since 9 7823 */ 7824 flushSync(): void; 7825 7826 /** 7827 * Write stream. 7828 * 7829 * @param { ArrayBuffer | string } buffer - buffer. 7830 * @param { object } [options] - options. 7831 * @returns { Promise<number> } Returns the number of file bytes written to file in promise mode. 7832 * @throws { BusinessError } 13900001 - Operation not permitted 7833 * @throws { BusinessError } 13900004 - Interrupted system call 7834 * @throws { BusinessError } 13900005 - I/O error 7835 * @throws { BusinessError } 13900008 - Bad file descriptor 7836 * @throws { BusinessError } 13900010 - Try again 7837 * @throws { BusinessError } 13900013 - Bad address 7838 * @throws { BusinessError } 13900020 - Invalid argument 7839 * @throws { BusinessError } 13900024 - File too large 7840 * @throws { BusinessError } 13900025 - No space left on device 7841 * @throws { BusinessError } 13900034 - Operation would block 7842 * @throws { BusinessError } 13900041 - Quota exceeded 7843 * @throws { BusinessError } 13900042 - Unknown error 7844 * @syscap SystemCapability.FileManagement.File.FileIO 7845 * @since 9 7846 */ 7847 /** 7848 * Write stream. 7849 * 7850 * @param { ArrayBuffer | string } buffer - buffer. 7851 * @param { WriteOptions } [options] - options. 7852 * @returns { Promise<number> } Returns the number of file bytes written to file in promise mode. 7853 * @throws { BusinessError } 13900001 - Operation not permitted 7854 * @throws { BusinessError } 13900004 - Interrupted system call 7855 * @throws { BusinessError } 13900005 - I/O error 7856 * @throws { BusinessError } 13900008 - Bad file descriptor 7857 * @throws { BusinessError } 13900010 - Try again 7858 * @throws { BusinessError } 13900013 - Bad address 7859 * @throws { BusinessError } 13900020 - Invalid argument 7860 * @throws { BusinessError } 13900024 - File too large 7861 * @throws { BusinessError } 13900025 - No space left on device 7862 * @throws { BusinessError } 13900034 - Operation would block 7863 * @throws { BusinessError } 13900041 - Quota exceeded 7864 * @throws { BusinessError } 13900042 - Unknown error 7865 * @syscap SystemCapability.FileManagement.File.FileIO 7866 * @since 11 7867 */ 7868 write( 7869 buffer: ArrayBuffer | string, 7870 options?: WriteOptions 7871 ): Promise<number>; 7872 7873 /** 7874 * Write stream. 7875 * 7876 * @param { ArrayBuffer | string } buffer - buffer. 7877 * @param { AsyncCallback<number> } callback - The callback is used to return the number of file bytes written to file. 7878 * @throws { BusinessError } 13900001 - Operation not permitted 7879 * @throws { BusinessError } 13900004 - Interrupted system call 7880 * @throws { BusinessError } 13900005 - I/O error 7881 * @throws { BusinessError } 13900008 - Bad file descriptor 7882 * @throws { BusinessError } 13900010 - Try again 7883 * @throws { BusinessError } 13900013 - Bad address 7884 * @throws { BusinessError } 13900020 - Invalid argument 7885 * @throws { BusinessError } 13900024 - File too large 7886 * @throws { BusinessError } 13900025 - No space left on device 7887 * @throws { BusinessError } 13900034 - Operation would block 7888 * @throws { BusinessError } 13900041 - Quota exceeded 7889 * @throws { BusinessError } 13900042 - Unknown error 7890 * @syscap SystemCapability.FileManagement.File.FileIO 7891 * @since 9 7892 */ 7893 write(buffer: ArrayBuffer | string, callback: AsyncCallback<number>): void; 7894 7895 /** 7896 * Write stream. 7897 * 7898 * @param { ArrayBuffer | string } buffer - buffer. 7899 * @param { object } [options] - options. 7900 * @param { AsyncCallback<number> } callback - The callback is used to return the number of file bytes written to file. 7901 * @throws { BusinessError } 13900001 - Operation not permitted 7902 * @throws { BusinessError } 13900004 - Interrupted system call 7903 * @throws { BusinessError } 13900005 - I/O error 7904 * @throws { BusinessError } 13900008 - Bad file descriptor 7905 * @throws { BusinessError } 13900010 - Try again 7906 * @throws { BusinessError } 13900013 - Bad address 7907 * @throws { BusinessError } 13900020 - Invalid argument 7908 * @throws { BusinessError } 13900024 - File too large 7909 * @throws { BusinessError } 13900025 - No space left on device 7910 * @throws { BusinessError } 13900034 - Operation would block 7911 * @throws { BusinessError } 13900041 - Quota exceeded 7912 * @throws { BusinessError } 13900042 - Unknown error 7913 * @syscap SystemCapability.FileManagement.File.FileIO 7914 * @since 9 7915 */ 7916 /** 7917 * Write stream. 7918 * 7919 * @param { ArrayBuffer | string } buffer - buffer. 7920 * @param { WriteOptions } [options] - options. 7921 * @param { AsyncCallback<number> } callback - The callback is used to return the number of file bytes written to file. 7922 * @throws { BusinessError } 13900001 - Operation not permitted 7923 * @throws { BusinessError } 13900004 - Interrupted system call 7924 * @throws { BusinessError } 13900005 - I/O error 7925 * @throws { BusinessError } 13900008 - Bad file descriptor 7926 * @throws { BusinessError } 13900010 - Try again 7927 * @throws { BusinessError } 13900013 - Bad address 7928 * @throws { BusinessError } 13900020 - Invalid argument 7929 * @throws { BusinessError } 13900024 - File too large 7930 * @throws { BusinessError } 13900025 - No space left on device 7931 * @throws { BusinessError } 13900034 - Operation would block 7932 * @throws { BusinessError } 13900041 - Quota exceeded 7933 * @throws { BusinessError } 13900042 - Unknown error 7934 * @syscap SystemCapability.FileManagement.File.FileIO 7935 * @since 11 7936 */ 7937 write( 7938 buffer: ArrayBuffer | string, 7939 options: WriteOptions, 7940 callback: AsyncCallback<number> 7941 ): void; 7942 7943 /** 7944 * Write stream with sync interface. 7945 * 7946 * @param { ArrayBuffer | string } buffer - buffer. 7947 * @param { object } [options] - options. 7948 * @returns { number } Returns the number of file bytes written to file. 7949 * @throws { BusinessError } 13900001 - Operation not permitted 7950 * @throws { BusinessError } 13900004 - Interrupted system call 7951 * @throws { BusinessError } 13900005 - I/O error 7952 * @throws { BusinessError } 13900008 - Bad file descriptor 7953 * @throws { BusinessError } 13900010 - Try again 7954 * @throws { BusinessError } 13900013 - Bad address 7955 * @throws { BusinessError } 13900020 - Invalid argument 7956 * @throws { BusinessError } 13900024 - File too large 7957 * @throws { BusinessError } 13900025 - No space left on device 7958 * @throws { BusinessError } 13900034 - Operation would block 7959 * @throws { BusinessError } 13900041 - Quota exceeded 7960 * @throws { BusinessError } 13900042 - Unknown error 7961 * @syscap SystemCapability.FileManagement.File.FileIO 7962 * @since 9 7963 */ 7964 /** 7965 * Write stream with sync interface. 7966 * 7967 * @param { ArrayBuffer | string } buffer - buffer. 7968 * @param { WriteOptions } [options] - options. 7969 * @returns { number } Returns the number of file bytes written to file. 7970 * @throws { BusinessError } 13900001 - Operation not permitted 7971 * @throws { BusinessError } 13900004 - Interrupted system call 7972 * @throws { BusinessError } 13900005 - I/O error 7973 * @throws { BusinessError } 13900008 - Bad file descriptor 7974 * @throws { BusinessError } 13900010 - Try again 7975 * @throws { BusinessError } 13900013 - Bad address 7976 * @throws { BusinessError } 13900020 - Invalid argument 7977 * @throws { BusinessError } 13900024 - File too large 7978 * @throws { BusinessError } 13900025 - No space left on device 7979 * @throws { BusinessError } 13900034 - Operation would block 7980 * @throws { BusinessError } 13900041 - Quota exceeded 7981 * @throws { BusinessError } 13900042 - Unknown error 7982 * @syscap SystemCapability.FileManagement.File.FileIO 7983 * @since 11 7984 */ 7985 writeSync( 7986 buffer: ArrayBuffer | string, 7987 options?: WriteOptions 7988 ): number; 7989 7990 /** 7991 * Read stream. 7992 * 7993 * @param { ArrayBuffer } buffer - buffer. 7994 * @param { object } [options] - options. 7995 * @returns { Promise<number> } Returns the number of file bytes read to buffer in promise mode. 7996 * @throws { BusinessError } 13900004 - Interrupted system call 7997 * @throws { BusinessError } 13900005 - I/O error 7998 * @throws { BusinessError } 13900008 - Bad file descriptor 7999 * @throws { BusinessError } 13900010 - Try again 8000 * @throws { BusinessError } 13900013 - Bad address 8001 * @throws { BusinessError } 13900019 - Is a directory 8002 * @throws { BusinessError } 13900020 - Invalid argument 8003 * @throws { BusinessError } 13900034 - Operation would block 8004 * @throws { BusinessError } 13900042 - Unknown error 8005 * @syscap SystemCapability.FileManagement.File.FileIO 8006 * @since 9 8007 */ 8008 /** 8009 * Read stream. 8010 * 8011 * @param { ArrayBuffer } buffer - buffer. 8012 * @param { ReadOptions } [options] - options. 8013 * @returns { Promise<number> } Returns the number of file bytes read to buffer in promise mode. 8014 * @throws { BusinessError } 13900004 - Interrupted system call 8015 * @throws { BusinessError } 13900005 - I/O error 8016 * @throws { BusinessError } 13900008 - Bad file descriptor 8017 * @throws { BusinessError } 13900010 - Try again 8018 * @throws { BusinessError } 13900013 - Bad address 8019 * @throws { BusinessError } 13900019 - Is a directory 8020 * @throws { BusinessError } 13900020 - Invalid argument 8021 * @throws { BusinessError } 13900034 - Operation would block 8022 * @throws { BusinessError } 13900042 - Unknown error 8023 * @syscap SystemCapability.FileManagement.File.FileIO 8024 * @since 11 8025 */ 8026 /** 8027 * Read stream. 8028 * 8029 * @param { ArrayBuffer } buffer - buffer. 8030 * @param { ReadOptions } [options] - options. 8031 * @returns { Promise<number> } Returns the number of file bytes read to buffer in promise mode. 8032 * @throws { BusinessError } 13900004 - Interrupted system call 8033 * @throws { BusinessError } 13900005 - I/O error 8034 * @throws { BusinessError } 13900008 - Bad file descriptor 8035 * @throws { BusinessError } 13900010 - Try again 8036 * @throws { BusinessError } 13900013 - Bad address 8037 * @throws { BusinessError } 13900019 - Is a directory 8038 * @throws { BusinessError } 13900020 - Invalid argument 8039 * @throws { BusinessError } 13900034 - Operation would block 8040 * @throws { BusinessError } 13900042 - Unknown error 8041 * @throws { BusinessError } 13900044 - Network is unreachable 8042 * @syscap SystemCapability.FileManagement.File.FileIO 8043 * @since 12 8044 */ 8045 read( 8046 buffer: ArrayBuffer, 8047 options?: ReadOptions 8048 ): Promise<number>; 8049 8050 /** 8051 * Read stream. 8052 * 8053 * @param { ArrayBuffer } buffer - buffer. 8054 * @param { AsyncCallback<number> } callback - The callback is used to return the number of file bytes read to buffer. 8055 * @throws { BusinessError } 13900004 - Interrupted system call 8056 * @throws { BusinessError } 13900005 - I/O error 8057 * @throws { BusinessError } 13900008 - Bad file descriptor 8058 * @throws { BusinessError } 13900010 - Try again 8059 * @throws { BusinessError } 13900013 - Bad address 8060 * @throws { BusinessError } 13900019 - Is a directory 8061 * @throws { BusinessError } 13900020 - Invalid argument 8062 * @throws { BusinessError } 13900034 - Operation would block 8063 * @throws { BusinessError } 13900042 - Unknown error 8064 * @syscap SystemCapability.FileManagement.File.FileIO 8065 * @since 9 8066 */ 8067 read(buffer: ArrayBuffer, callback: AsyncCallback<number>): void; 8068 8069 /** 8070 * Read stream. 8071 * 8072 * @param { ArrayBuffer } buffer - buffer. 8073 * @param { object } [options] - options. 8074 * @param { AsyncCallback<number> } callback - The callback is used to return the number of file bytes read to buffer. 8075 * @throws { BusinessError } 13900004 - Interrupted system call 8076 * @throws { BusinessError } 13900005 - I/O error 8077 * @throws { BusinessError } 13900008 - Bad file descriptor 8078 * @throws { BusinessError } 13900010 - Try again 8079 * @throws { BusinessError } 13900013 - Bad address 8080 * @throws { BusinessError } 13900019 - Is a directory 8081 * @throws { BusinessError } 13900020 - Invalid argument 8082 * @throws { BusinessError } 13900034 - Operation would block 8083 * @throws { BusinessError } 13900042 - Unknown error 8084 * @syscap SystemCapability.FileManagement.File.FileIO 8085 * @since 9 8086 */ 8087 /** 8088 * Read stream. 8089 * 8090 * @param { ArrayBuffer } buffer - buffer. 8091 * @param { ReadOptions } [options] - options. 8092 * @param { AsyncCallback<number> } callback - The callback is used to return the number of file bytes read to buffer. 8093 * @throws { BusinessError } 13900004 - Interrupted system call 8094 * @throws { BusinessError } 13900005 - I/O error 8095 * @throws { BusinessError } 13900008 - Bad file descriptor 8096 * @throws { BusinessError } 13900010 - Try again 8097 * @throws { BusinessError } 13900013 - Bad address 8098 * @throws { BusinessError } 13900019 - Is a directory 8099 * @throws { BusinessError } 13900020 - Invalid argument 8100 * @throws { BusinessError } 13900034 - Operation would block 8101 * @throws { BusinessError } 13900042 - Unknown error 8102 * @syscap SystemCapability.FileManagement.File.FileIO 8103 * @since 11 8104 */ 8105 read( 8106 buffer: ArrayBuffer, 8107 options: ReadOptions, 8108 callback: AsyncCallback<number> 8109 ): void; 8110 8111 /** 8112 * Read stream with sync interface. 8113 * 8114 * @param { ArrayBuffer } buffer - buffer. 8115 * @param { object } [options] - options. 8116 * @returns { number } Returns the number of file bytes read to file. 8117 * @throws { BusinessError } 13900004 - Interrupted system call 8118 * @throws { BusinessError } 13900005 - I/O error 8119 * @throws { BusinessError } 13900008 - Bad file descriptor 8120 * @throws { BusinessError } 13900010 - Try again 8121 * @throws { BusinessError } 13900013 - Bad address 8122 * @throws { BusinessError } 13900019 - Is a directory 8123 * @throws { BusinessError } 13900020 - Invalid argument 8124 * @throws { BusinessError } 13900034 - Operation would block 8125 * @throws { BusinessError } 13900042 - Unknown error 8126 * @syscap SystemCapability.FileManagement.File.FileIO 8127 * @since 9 8128 */ 8129 /** 8130 * Read stream with sync interface. 8131 * 8132 * @param { ArrayBuffer } buffer - buffer. 8133 * @param { ReadOptions } [options] - options. 8134 * @returns { number } Returns the number of file bytes read to file. 8135 * @throws { BusinessError } 13900004 - Interrupted system call 8136 * @throws { BusinessError } 13900005 - I/O error 8137 * @throws { BusinessError } 13900008 - Bad file descriptor 8138 * @throws { BusinessError } 13900010 - Try again 8139 * @throws { BusinessError } 13900013 - Bad address 8140 * @throws { BusinessError } 13900019 - Is a directory 8141 * @throws { BusinessError } 13900020 - Invalid argument 8142 * @throws { BusinessError } 13900034 - Operation would block 8143 * @throws { BusinessError } 13900042 - Unknown error 8144 * @syscap SystemCapability.FileManagement.File.FileIO 8145 * @since 11 8146 */ 8147 /** 8148 * Read stream with sync interface. 8149 * 8150 * @param { ArrayBuffer } buffer - buffer. 8151 * @param { ReadOptions } [options] - options. 8152 * @returns { number } Returns the number of file bytes read to file. 8153 * @throws { BusinessError } 13900004 - Interrupted system call 8154 * @throws { BusinessError } 13900005 - I/O error 8155 * @throws { BusinessError } 13900008 - Bad file descriptor 8156 * @throws { BusinessError } 13900010 - Try again 8157 * @throws { BusinessError } 13900013 - Bad address 8158 * @throws { BusinessError } 13900019 - Is a directory 8159 * @throws { BusinessError } 13900020 - Invalid argument 8160 * @throws { BusinessError } 13900034 - Operation would block 8161 * @throws { BusinessError } 13900042 - Unknown error 8162 * @throws { BusinessError } 13900044 - Network is unreachable 8163 * @syscap SystemCapability.FileManagement.File.FileIO 8164 * @since 12 8165 */ 8166 readSync( 8167 buffer: ArrayBuffer, 8168 options?: ReadOptions 8169 ): number; 8170} 8171 8172/** 8173 * Implements watcher event listening. 8174 * 8175 * @interface WatchEventListener 8176 * @syscap SystemCapability.FileManagement.File.FileIO 8177 * @since 10 8178 */ 8179export interface WatchEventListener { 8180 /** 8181 * Specifies the callback function to be invoked. 8182 * 8183 * @param { WatchEvent } event - Event type for the callback to invoke. 8184 * @syscap SystemCapability.FileManagement.File.FileIO 8185 * @since 10 8186 */ 8187 (event: WatchEvent): void; 8188} 8189 8190/** 8191 * Event Listening. 8192 * 8193 * @interface WatchEvent 8194 * @syscap SystemCapability.FileManagement.File.FileIO 8195 * @since 10 8196 */ 8197export interface WatchEvent { 8198 /** 8199 * File name. 8200 * 8201 * @type { string } 8202 * @readonly 8203 * @syscap SystemCapability.FileManagement.File.FileIO 8204 * @since 10 8205 */ 8206 readonly fileName: string; 8207 8208 /** 8209 * Event happened. 8210 * 8211 * @type { number } 8212 * @readonly 8213 * @syscap SystemCapability.FileManagement.File.FileIO 8214 * @since 10 8215 */ 8216 readonly event: number; 8217 8218 /** 8219 * Associated rename event. 8220 * 8221 * @type { number } 8222 * @readonly 8223 * @syscap SystemCapability.FileManagement.File.FileIO 8224 * @since 10 8225 */ 8226 readonly cookie: number; 8227} 8228 8229/** 8230 * Watcher object 8231 * 8232 * @interface Watcher 8233 * @syscap SystemCapability.FileManagement.File.FileIO 8234 * @since 10 8235 */ 8236export interface Watcher { 8237 /** 8238 * Start watcher. 8239 * 8240 * @throws { BusinessError } 13900002 - No such file or directory 8241 * @throws { BusinessError } 13900008 - Bad file descriptor 8242 * @throws { BusinessError } 13900011 - Out of memory 8243 * @throws { BusinessError } 13900012 - Permission denied 8244 * @throws { BusinessError } 13900013 - Bad address 8245 * @throws { BusinessError } 13900015 - File exists 8246 * @throws { BusinessError } 13900018 - Not a directory 8247 * @throws { BusinessError } 13900020 - Invalid argument 8248 * @throws { BusinessError } 13900021 - File table overflow 8249 * @throws { BusinessError } 13900022 - Too many open files 8250 * @throws { BusinessError } 13900025 - No space left on device 8251 * @throws { BusinessError } 13900030 - File name too long 8252 * @throws { BusinessError } 13900042 - Unknown error 8253 * @syscap SystemCapability.FileManagement.File.FileIO 8254 * @since 10 8255 */ 8256 start(): void; 8257 8258 /** 8259 * Stop watcher. 8260 * 8261 * @throws { BusinessError } 13900002 - No such file or directory 8262 * @throws { BusinessError } 13900008 - Bad file descriptor 8263 * @throws { BusinessError } 13900011 - Out of memory 8264 * @throws { BusinessError } 13900012 - Permission denied 8265 * @throws { BusinessError } 13900013 - Bad address 8266 * @throws { BusinessError } 13900015 - File exists 8267 * @throws { BusinessError } 13900018 - Not a directory 8268 * @throws { BusinessError } 13900020 - Invalid argument 8269 * @throws { BusinessError } 13900021 - File table overflow 8270 * @throws { BusinessError } 13900022 - Too many open files 8271 * @throws { BusinessError } 13900025 - No space left on device 8272 * @throws { BusinessError } 13900030 - File name too long 8273 * @throws { BusinessError } 13900042 - Unknown error 8274 * @syscap SystemCapability.FileManagement.File.FileIO 8275 * @since 10 8276 */ 8277 stop(): void; 8278} 8279 8280/** 8281 * Reader Iterator Result 8282 * 8283 * @interface ReaderIteratorResult 8284 * @syscap SystemCapability.FileManagement.File.FileIO 8285 * @since 11 8286 */ 8287export interface ReaderIteratorResult { 8288 /** 8289 * Whether reader iterator completes the traversal. 8290 * 8291 * @type { boolean } 8292 * @syscap SystemCapability.FileManagement.File.FileIO 8293 * @since 11 8294 */ 8295 done: boolean; 8296 8297 /** 8298 * The value of reader iterator. 8299 * 8300 * @type { string } 8301 * @syscap SystemCapability.FileManagement.File.FileIO 8302 * @since 11 8303 */ 8304 value: string; 8305} 8306 8307/** 8308 * ReaderIterator object 8309 * 8310 * @interface ReaderIterator 8311 * @syscap SystemCapability.FileManagement.File.FileIO 8312 * @since 11 8313 */ 8314declare interface ReaderIterator { 8315 /** 8316 * Get next result from the iterator. 8317 * 8318 * @returns { ReaderIteratorResult } Returns the result of reader iterator. 8319 * @throws { BusinessError } 13900005 - I/O error 8320 * @throws { BusinessError } 13900037 - No data available 8321 * @throws { BusinessError } 13900042 - Unknown error 8322 * @syscap SystemCapability.FileManagement.File.FileIO 8323 * @since 11 8324 */ 8325 next(): ReaderIteratorResult; 8326} 8327 8328/** 8329 * File filter type 8330 * 8331 * @syscap SystemCapability.FileManagement.File.FileIO 8332 * @crossplatform 8333 * @since 10 8334 */ 8335/** 8336 * File filter type 8337 * 8338 * @interface Filter 8339 * @syscap SystemCapability.FileManagement.File.FileIO 8340 * @crossplatform 8341 * @atomicservice 8342 * @since 11 8343 */ 8344export interface Filter { 8345 /** 8346 * The suffix of the file. 8347 * 8348 * @type { ?Array<string> } 8349 * @syscap SystemCapability.FileManagement.File.FileIO 8350 * @since 10 8351 */ 8352 /** 8353 * The suffix of the file. 8354 * 8355 * @type { ?Array<string> } 8356 * @syscap SystemCapability.FileManagement.File.FileIO 8357 * @crossplatform 8358 * @atomicservice 8359 * @since 11 8360 */ 8361 suffix?: Array<string>; 8362 /** 8363 * The display name of the file. 8364 * 8365 * @type { ?Array<string> } 8366 * @syscap SystemCapability.FileManagement.File.FileIO 8367 * @since 10 8368 */ 8369 /** 8370 * The display name of the file. 8371 * 8372 * @type { ?Array<string> } 8373 * @syscap SystemCapability.FileManagement.File.FileIO 8374 * @crossplatform 8375 * @atomicservice 8376 * @since 11 8377 */ 8378 displayName?: Array<string>; 8379 /** 8380 * The mimetype of the file. 8381 * 8382 * @type { ?Array<string> } 8383 * @syscap SystemCapability.FileManagement.File.FileIO 8384 * @since 10 8385 */ 8386 /** 8387 * The mimetype of the file. 8388 * 8389 * @type { ?Array<string> } 8390 * @syscap SystemCapability.FileManagement.File.FileIO 8391 * @crossplatform 8392 * @atomicservice 8393 * @since 11 8394 */ 8395 mimeType?: Array<string>; 8396 /** 8397 * The exceeding size of the file. 8398 * 8399 * @type { ?number } 8400 * @syscap SystemCapability.FileManagement.File.FileIO 8401 * @since 10 8402 */ 8403 /** 8404 * The exceeding size of the file. 8405 * 8406 * @type { ?number } 8407 * @syscap SystemCapability.FileManagement.File.FileIO 8408 * @crossplatform 8409 * @atomicservice 8410 * @since 11 8411 */ 8412 fileSizeOver?: number; 8413 /** 8414 * The last modification time of the file. 8415 * 8416 * @type { ?number } 8417 * @syscap SystemCapability.FileManagement.File.FileIO 8418 * @since 10 8419 */ 8420 /** 8421 * The last modification time of the file. 8422 * 8423 * @type { ?number } 8424 * @syscap SystemCapability.FileManagement.File.FileIO 8425 * @crossplatform 8426 * @atomicservice 8427 * @since 11 8428 */ 8429 lastModifiedAfter?: number; 8430 /** 8431 * Whether to exclude media files. 8432 * 8433 * @type { ?boolean } 8434 * @syscap SystemCapability.FileManagement.File.FileIO 8435 * @since 10 8436 */ 8437 /** 8438 * Whether to exclude media files. 8439 * 8440 * @type { ?boolean } 8441 * @syscap SystemCapability.FileManagement.File.FileIO 8442 * @crossplatform 8443 * @atomicservice 8444 * @since 11 8445 */ 8446 excludeMedia?: boolean; 8447} 8448 8449/** 8450 * Conflict Files type 8451 * 8452 * @syscap SystemCapability.FileManagement.File.FileIO 8453 * @since 10 8454 */ 8455/** 8456 * Conflict Files type 8457 * 8458 * @interface ConflictFiles 8459 * @syscap SystemCapability.FileManagement.File.FileIO 8460 * @since 11 8461 */ 8462export interface ConflictFiles { 8463 /** 8464 * The path of the source file. 8465 * 8466 * @type { string } 8467 * @syscap SystemCapability.FileManagement.File.FileIO 8468 * @since 10 8469 */ 8470 /** 8471 * The path of the source file. 8472 * 8473 * @type { string } 8474 * @syscap SystemCapability.FileManagement.File.FileIO 8475 * @since 11 8476 */ 8477 srcFile: string; 8478 8479 /** 8480 * The path of the source file. 8481 * 8482 * @type { string } 8483 * @syscap SystemCapability.FileManagement.File.FileIO 8484 * @since 10 8485 */ 8486 /** 8487 * The path of the destination file. 8488 * 8489 * @type { string } 8490 * @syscap SystemCapability.FileManagement.File.FileIO 8491 * @since 11 8492 */ 8493 destFile: string; 8494} 8495 8496/** 8497 * Options type 8498 * 8499 * @interface Options 8500 * @syscap SystemCapability.FileManagement.File.FileIO 8501 * @since 11 8502 */ 8503export interface Options { 8504 /** 8505 * The encoding style. 8506 * 8507 * @type { ?string } 8508 * @syscap SystemCapability.FileManagement.File.FileIO 8509 * @since 11 8510 */ 8511 encoding?: string; 8512} 8513 8514/** 8515 * ReadOptions type 8516 * 8517 * @interface ReadOptions 8518 * @syscap SystemCapability.FileManagement.File.FileIO 8519 * @atomicservice 8520 * @since 11 8521 */ 8522export interface ReadOptions { 8523 /** 8524 * The offset when reading the file. 8525 * 8526 * @type { ?number } 8527 * @syscap SystemCapability.FileManagement.File.FileIO 8528 * @atomicservice 8529 * @since 11 8530 */ 8531 offset?: number; 8532 /** 8533 * The length for reading. 8534 * 8535 * @type { ?number } 8536 * @syscap SystemCapability.FileManagement.File.FileIO 8537 * @atomicservice 8538 * @since 11 8539 */ 8540 length?: number; 8541} 8542 8543/** 8544 * ReadTextOptions type 8545 * 8546 * @interface ReadTextOptions 8547 * @extends ReadOptions 8548 * @syscap SystemCapability.FileManagement.File.FileIO 8549 * @atomicservice 8550 * @since 11 8551 */ 8552export interface ReadTextOptions extends ReadOptions { 8553 /** 8554 * The encoding style when reading text. 8555 * 8556 * @type { ?string } 8557 * @syscap SystemCapability.FileManagement.File.FileIO 8558 * @atomicservice 8559 * @since 11 8560 */ 8561 encoding?: string; 8562} 8563 8564/** 8565 * WriteOptions type 8566 * 8567 * @interface WriteOptions 8568 * @extends Options 8569 * @syscap SystemCapability.FileManagement.File.FileIO 8570 * @atomicservice 8571 * @since 11 8572 */ 8573export interface WriteOptions extends Options { 8574 /** 8575 * The offset when writing the file. 8576 * 8577 * @type { ?number } 8578 * @syscap SystemCapability.FileManagement.File.FileIO 8579 * @atomicservice 8580 * @since 11 8581 */ 8582 offset?: number; 8583 /** 8584 * The length for writing. 8585 * 8586 * @type { ?number } 8587 * @syscap SystemCapability.FileManagement.File.FileIO 8588 * @atomicservice 8589 * @since 11 8590 */ 8591 length?: number; 8592} 8593 8594/** 8595 * ListFileOptions type 8596 * 8597 * @interface ListFileOptions 8598 * @syscap SystemCapability.FileManagement.File.FileIO 8599 * @atomicservice 8600 * @since 11 8601 */ 8602export interface ListFileOptions { 8603 /** 8604 * Whether to recursively list files. 8605 * 8606 * @type { ?boolean } 8607 * @syscap SystemCapability.FileManagement.File.FileIO 8608 * @atomicservice 8609 * @since 11 8610 */ 8611 recursion?: boolean; 8612 8613 /** 8614 * The number of files listed. 8615 * 8616 * @type { ?number } 8617 * @syscap SystemCapability.FileManagement.File.FileIO 8618 * @atomicservice 8619 * @since 11 8620 */ 8621 listNum?: number; 8622 8623 /** 8624 * The filter of listing files. 8625 * 8626 * @type { ?Filter } 8627 * @syscap SystemCapability.FileManagement.File.FileIO 8628 * @atomicservice 8629 * @since 11 8630 */ 8631 filter?: Filter; 8632} 8633 8634/** 8635 * RandomAccessFileOptions type 8636 * 8637 * @interface RandomAccessFileOptions 8638 * @syscap SystemCapability.FileManagement.File.FileIO 8639 * @since 12 8640 */ 8641export interface RandomAccessFileOptions { 8642 /** 8643 * The starting position of file offset. 8644 * 8645 * @type { ?number } 8646 * @syscap SystemCapability.FileManagement.File.FileIO 8647 * @since 12 8648 */ 8649 start?: number; 8650 8651 /** 8652 * The ending position of file offset. 8653 * 8654 * @type { ?number } 8655 * @syscap SystemCapability.FileManagement.File.FileIO 8656 * @since 12 8657 */ 8658 end?: number; 8659} 8660 8661/** 8662 * ReadStreamOptions type 8663 * 8664 * @interface ReadStreamOptions 8665 * @syscap SystemCapability.FileManagement.File.FileIO 8666 * @since 12 8667 */ 8668export interface ReadStreamOptions { 8669 /** 8670 * The starting range for reading a file by stream. 8671 * 8672 * @type { ?number } 8673 * @syscap SystemCapability.FileManagement.File.FileIO 8674 * @since 12 8675 */ 8676 start?: number; 8677 8678 /** 8679 * The ending range for reading a file by stream. 8680 * 8681 * @type { ?number } 8682 * @syscap SystemCapability.FileManagement.File.FileIO 8683 * @since 12 8684 */ 8685 end?: number; 8686} 8687 8688/** 8689 * WriteStreamOptions type 8690 * 8691 * @interface WriteStreamOptions 8692 * @syscap SystemCapability.FileManagement.File.FileIO 8693 * @since 12 8694 */ 8695export interface WriteStreamOptions { 8696 /** 8697 * The mode for creating write stream. 8698 * 8699 * @type { ?number } 8700 * @syscap SystemCapability.FileManagement.File.FileIO 8701 * @since 12 8702 */ 8703 mode?: number; 8704 /** 8705 * The starting range for writing a file by stream. 8706 * 8707 * @type { ?number } 8708 * @syscap SystemCapability.FileManagement.File.FileIO 8709 * @since 12 8710 */ 8711 start?: number; 8712} 8713 8714/** 8715 * The listeners of Distributed File System. 8716 * 8717 * @typedef DfsListeners 8718 * @syscap SystemCapability.FileManagement.File.FileIO 8719 * @since 12 8720 */ 8721export interface DfsListeners { 8722 /** 8723 * The Listener of Distributed File System status 8724 * 8725 * @param { string } networkId - The networkId of device. 8726 * @param { number } status - The status code of Distributed File System. 8727 * @syscap SystemCapability.FileManagement.File.FileIO 8728 * @since 12 8729 */ 8730 onStatus(networkId: string, status: number): void; 8731} 8732 8733/** 8734 * Enumeration of different types of whence. 8735 * 8736 * @enum { number } whence type 8737 * @syscap SystemCapability.FileManagement.File.FileIO 8738 * @since 11 8739 */ 8740declare enum WhenceType { 8741 /** 8742 * Starting position of the file offset. 8743 * 8744 * @syscap SystemCapability.FileManagement.File.FileIO 8745 * @since 11 8746 */ 8747 SEEK_SET = 0, 8748 8749 /** 8750 * Current position of the file offset. 8751 * 8752 * @syscap SystemCapability.FileManagement.File.FileIO 8753 * @since 11 8754 */ 8755 SEEK_CUR = 1, 8756 8757 /** 8758 * Ending position of the file offset. 8759 * 8760 * @syscap SystemCapability.FileManagement.File.FileIO 8761 * @since 11 8762 */ 8763 SEEK_END = 2, 8764} 8765 8766/** 8767 * Enumeration of different types of file location. 8768 * 8769 * @enum { number } location type 8770 * @syscap SystemCapability.FileManagement.File.FileIO 8771 * @since 11 8772 */ 8773declare enum LocationType { 8774 /** 8775 * Local file. 8776 * 8777 * @syscap SystemCapability.FileManagement.File.FileIO 8778 * @since 11 8779 */ 8780 LOCAL = 1 << 0, 8781 8782 /** 8783 * Cloud file. 8784 * 8785 * @syscap SystemCapability.FileManagement.File.FileIO 8786 * @since 11 8787 */ 8788 CLOUD = 1 << 1, 8789} 8790 8791/** 8792 * Enumeration of different types of access mode. 8793 * 8794 * @enum { number } access mode type 8795 * @syscap SystemCapability.FileManagement.File.FileIO 8796 * @atomicservice 8797 * @since 12 8798 */ 8799declare enum AccessModeType { 8800 /** 8801 * Check if the file exists. 8802 * 8803 * @syscap SystemCapability.FileManagement.File.FileIO 8804 * @atomicservice 8805 * @since 12 8806 */ 8807 EXIST = 0, 8808 8809 /** 8810 * Check if the file has write permission. 8811 * 8812 * @syscap SystemCapability.FileManagement.File.FileIO 8813 * @atomicservice 8814 * @since 12 8815 */ 8816 WRITE = 2, 8817 8818 /** 8819 * Check if the file has read permission. 8820 * 8821 * @syscap SystemCapability.FileManagement.File.FileIO 8822 * @atomicservice 8823 * @since 12 8824 */ 8825 READ = 4, 8826 8827 /** 8828 * Check if the file has read and write permission. 8829 * 8830 * @syscap SystemCapability.FileManagement.File.FileIO 8831 * @atomicservice 8832 * @since 12 8833 */ 8834 READ_WRITE = 6, 8835} 8836 8837/** 8838 * Enumeration of different types of access flag. 8839 * 8840 * @enum { number } access flag type 8841 * @syscap SystemCapability.FileManagement.File.FileIO 8842 * @since 12 8843 */ 8844declare enum AccessFlagType { 8845 /** 8846 * Check if the file is on the local. 8847 * 8848 * @syscap SystemCapability.FileManagement.File.FileIO 8849 * @since 12 8850 */ 8851 LOCAL = 0, 8852} 8853