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