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