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 16import { AsyncCallback } from './@ohos.base'; 17 18export default fileIo; 19 20/** 21 * FileIO 22 * 23 * @namespace fileIo 24 * @syscap SystemCapability.FileManagement.File.FileIO 25 * @since 9 26 */ 27/** 28 * FileIO 29 * 30 * @namespace fileIo 31 * @syscap SystemCapability.FileManagement.File.FileIO 32 * @crossplatform 33 * @since 10 34 */ 35declare namespace fileIo { 36 export { access }; 37 export { accessSync }; 38 export { close }; 39 export { closeSync }; 40 export { copyDir }; 41 export { copyDirSync }; 42 export { copyFile }; 43 export { copyFileSync }; 44 export { createRandomAccessFile }; 45 export { createRandomAccessFileSync }; 46 export { createStream }; 47 export { createStreamSync }; 48 export { createWatcher }; 49 export { dup }; 50 export { fdatasync }; 51 export { fdatasyncSync }; 52 export { fdopenStream }; 53 export { fdopenStreamSync }; 54 export { fsync }; 55 export { fsyncSync }; 56 export { listFile }; 57 export { listFileSync }; 58 export { lstat }; 59 export { lstatSync }; 60 export { mkdir }; 61 export { mkdirSync }; 62 export { mkdtemp }; 63 export { mkdtempSync }; 64 export { moveDir }; 65 export { moveDirSync }; 66 export { moveFile }; 67 export { moveFileSync }; 68 export { open }; 69 export { openSync }; 70 export { read }; 71 export { readSync }; 72 export { readText }; 73 export { readTextSync }; 74 export { rename }; 75 export { renameSync }; 76 export { rmdir }; 77 export { rmdirSync }; 78 export { stat }; 79 export { statSync }; 80 export { symlink }; 81 export { symlinkSync }; 82 export { truncate }; 83 export { truncateSync }; 84 export { unlink }; 85 export { unlinkSync }; 86 export { write }; 87 export { writeSync }; 88 export { File }; 89 export { OpenMode }; 90 export { RandomAccessFile }; 91 export { Stat }; 92 export { Stream }; 93 export { Watcher }; 94 95 /** 96 * Mode Indicates the open flags. 97 * 98 * @namespace OpenMode 99 * @syscap SystemCapability.FileManagement.File.FileIO 100 * @since 9 101 */ 102 /** 103 * Mode Indicates the open flags. 104 * 105 * @namespace OpenMode 106 * @syscap SystemCapability.FileManagement.File.FileIO 107 * @crossplatform 108 * @since 10 109 */ 110 namespace OpenMode { 111 /** 112 * Read only Permission. 113 * 114 * @constant 115 * @syscap SystemCapability.FileManagement.File.FileIO 116 * @since 9 117 */ 118 /** 119 * Read only Permission. 120 * 121 * @constant 122 * @syscap SystemCapability.FileManagement.File.FileIO 123 * @crossplatform 124 * @since 10 125 */ 126 const READ_ONLY = 0o0; 127 /** 128 * Write only Permission. 129 * 130 * @constant 131 * @syscap SystemCapability.FileManagement.File.FileIO 132 * @since 9 133 */ 134 /** 135 * Write only Permission. 136 * 137 * @constant 138 * @syscap SystemCapability.FileManagement.File.FileIO 139 * @crossplatform 140 * @since 10 141 */ 142 const WRITE_ONLY = 0o1; 143 /** 144 * Write and Read Permission. 145 * 146 * @constant 147 * @syscap SystemCapability.FileManagement.File.FileIO 148 * @since 9 149 */ 150 /** 151 * Write and Read Permission. 152 * 153 * @constant 154 * @syscap SystemCapability.FileManagement.File.FileIO 155 * @crossplatform 156 * @since 10 157 */ 158 const READ_WRITE = 0o2; 159 /** 160 * If not exist, create file. 161 * 162 * @constant 163 * @syscap SystemCapability.FileManagement.File.FileIO 164 * @since 9 165 */ 166 /** 167 * If not exist, create file. 168 * 169 * @constant 170 * @syscap SystemCapability.FileManagement.File.FileIO 171 * @crossplatform 172 * @since 10 173 */ 174 const CREATE = 0o100; 175 /** 176 * File truncate len 0. 177 * 178 * @constant 179 * @syscap SystemCapability.FileManagement.File.FileIO 180 * @since 9 181 */ 182 /** 183 * File truncate len 0. 184 * 185 * @constant 186 * @syscap SystemCapability.FileManagement.File.FileIO 187 * @crossplatform 188 * @since 10 189 */ 190 const TRUNC = 0o1000; 191 /** 192 * File append write. 193 * 194 * @constant 195 * @syscap SystemCapability.FileManagement.File.FileIO 196 * @since 9 197 */ 198 /** 199 * File append write. 200 * 201 * @constant 202 * @syscap SystemCapability.FileManagement.File.FileIO 203 * @crossplatform 204 * @since 10 205 */ 206 const APPEND = 0o2000; 207 /** 208 * File open in nonblocking mode. 209 * 210 * @constant 211 * @syscap SystemCapability.FileManagement.File.FileIO 212 * @since 9 213 */ 214 /** 215 * File open in nonblocking mode. 216 * 217 * @constant 218 * @syscap SystemCapability.FileManagement.File.FileIO 219 * @crossplatform 220 * @since 10 221 */ 222 const NONBLOCK = 0o4000; 223 /** 224 * File is Dir. 225 * 226 * @constant 227 * @syscap SystemCapability.FileManagement.File.FileIO 228 * @since 9 229 */ 230 /** 231 * File is Dir. 232 * 233 * @constant 234 * @syscap SystemCapability.FileManagement.File.FileIO 235 * @crossplatform 236 * @since 10 237 */ 238 const DIR = 0o200000; 239 /** 240 * File is not symbolic link. 241 * 242 * @constant 243 * @syscap SystemCapability.FileManagement.File.FileIO 244 * @since 9 245 */ 246 /** 247 * File is not symbolic link. 248 * 249 * @constant 250 * @syscap SystemCapability.FileManagement.File.FileIO 251 * @crossplatform 252 * @since 10 253 */ 254 const NOFOLLOW = 0o400000; 255 /** 256 * SYNC IO. 257 * 258 * @constant 259 * @syscap SystemCapability.FileManagement.File.FileIO 260 * @since 9 261 */ 262 /** 263 * SYNC IO. 264 * 265 * @constant 266 * @syscap SystemCapability.FileManagement.File.FileIO 267 * @crossplatform 268 * @since 10 269 */ 270 const SYNC = 0o4010000; 271 } 272} 273 274/** 275 * Access file. 276 * 277 * @param { string } path - path. 278 * @returns { Promise<boolean> } return Promise 279 * @throws { BusinessError } 13900002 - No such file or directory 280 * @throws { BusinessError } 13900005 - I/O error 281 * @throws { BusinessError } 13900008 - Bad file descriptor 282 * @throws { BusinessError } 13900011 - Out of memory 283 * @throws { BusinessError } 13900012 - Permission denied 284 * @throws { BusinessError } 13900013 - Bad address 285 * @throws { BusinessError } 13900018 - Not a directory 286 * @throws { BusinessError } 13900020 - Invalid argument 287 * @throws { BusinessError } 13900023 - Text file busy 288 * @throws { BusinessError } 13900030 - File name too long 289 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 290 * @throws { BusinessError } 13900042 - Unknown error 291 * @syscap SystemCapability.FileManagement.File.FileIO 292 * @since 9 293 */ 294/** 295 * Access file. 296 * 297 * @param { string } path - path. 298 * @returns { Promise<boolean> } Returns the file is accessible or not in promise mode. 299 * @throws { BusinessError } 13900002 - No such file or directory 300 * @throws { BusinessError } 13900005 - I/O error 301 * @throws { BusinessError } 13900008 - Bad file descriptor 302 * @throws { BusinessError } 13900011 - Out of memory 303 * @throws { BusinessError } 13900012 - Permission denied 304 * @throws { BusinessError } 13900013 - Bad address 305 * @throws { BusinessError } 13900018 - Not a directory 306 * @throws { BusinessError } 13900020 - Invalid argument 307 * @throws { BusinessError } 13900023 - Text file busy 308 * @throws { BusinessError } 13900030 - File name too long 309 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 310 * @throws { BusinessError } 13900042 - Unknown error 311 * @syscap SystemCapability.FileManagement.File.FileIO 312 * @crossplatform 313 * @since 10 314 */ 315declare function access(path: string): Promise<boolean>; 316 317/** 318 * Access file. 319 * 320 * @param { string } path - path. 321 * @param { AsyncCallback<boolean> } callback - The callback is used to return the file is accessible or not. 322 * @throws { BusinessError } 13900002 - No such file or directory 323 * @throws { BusinessError } 13900005 - I/O error 324 * @throws { BusinessError } 13900008 - Bad file descriptor 325 * @throws { BusinessError } 13900011 - Out of memory 326 * @throws { BusinessError } 13900012 - Permission denied 327 * @throws { BusinessError } 13900013 - Bad address 328 * @throws { BusinessError } 13900018 - Not a directory 329 * @throws { BusinessError } 13900020 - Invalid argument 330 * @throws { BusinessError } 13900023 - Text file busy 331 * @throws { BusinessError } 13900030 - File name too long 332 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 333 * @throws { BusinessError } 13900042 - Unknown error 334 * @syscap SystemCapability.FileManagement.File.FileIO 335 * @since 9 336 */ 337/** 338 * Access file. 339 * 340 * @param { string } path - path. 341 * @param { AsyncCallback<boolean> } callback - The callback is used to return the file is accessible or not. 342 * @throws { BusinessError } 13900002 - No such file or directory 343 * @throws { BusinessError } 13900005 - I/O error 344 * @throws { BusinessError } 13900008 - Bad file descriptor 345 * @throws { BusinessError } 13900011 - Out of memory 346 * @throws { BusinessError } 13900012 - Permission denied 347 * @throws { BusinessError } 13900013 - Bad address 348 * @throws { BusinessError } 13900018 - Not a directory 349 * @throws { BusinessError } 13900020 - Invalid argument 350 * @throws { BusinessError } 13900023 - Text file busy 351 * @throws { BusinessError } 13900030 - File name too long 352 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 353 * @throws { BusinessError } 13900042 - Unknown error 354 * @syscap SystemCapability.FileManagement.File.FileIO 355 * @crossplatform 356 * @since 10 357 */ 358declare function access(path: string, callback: AsyncCallback<boolean>): void; 359 360/** 361 * Access file with sync interface. 362 * 363 * @param { string } path - path. 364 * @returns { boolean } Returns the file is accessible or not. 365 * @throws { BusinessError } 13900002 - No such file or directory 366 * @throws { BusinessError } 13900005 - I/O error 367 * @throws { BusinessError } 13900008 - Bad file descriptor 368 * @throws { BusinessError } 13900011 - Out of memory 369 * @throws { BusinessError } 13900012 - Permission denied 370 * @throws { BusinessError } 13900013 - Bad address 371 * @throws { BusinessError } 13900018 - Not a directory 372 * @throws { BusinessError } 13900020 - Invalid argument 373 * @throws { BusinessError } 13900023 - Text file busy 374 * @throws { BusinessError } 13900030 - File name too long 375 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 376 * @throws { BusinessError } 13900042 - Unknown error 377 * @syscap SystemCapability.FileManagement.File.FileIO 378 * @since 9 379 */ 380/** 381 * Access file with sync interface. 382 * 383 * @param { string } path - path. 384 * @returns { boolean } Returns the file is accessible or not. 385 * @throws { BusinessError } 13900002 - No such file or directory 386 * @throws { BusinessError } 13900005 - I/O error 387 * @throws { BusinessError } 13900008 - Bad file descriptor 388 * @throws { BusinessError } 13900011 - Out of memory 389 * @throws { BusinessError } 13900012 - Permission denied 390 * @throws { BusinessError } 13900013 - Bad address 391 * @throws { BusinessError } 13900018 - Not a directory 392 * @throws { BusinessError } 13900020 - Invalid argument 393 * @throws { BusinessError } 13900023 - Text file busy 394 * @throws { BusinessError } 13900030 - File name too long 395 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 396 * @throws { BusinessError } 13900042 - Unknown error 397 * @syscap SystemCapability.FileManagement.File.FileIO 398 * @crossplatform 399 * @since 10 400 */ 401declare function accessSync(path: string): boolean; 402 403/** 404 * Close file or fd. 405 * 406 * @param { number | File } file - file object or fd. 407 * @returns { Promise<void> } The promise returned by the function. 408 * @throws { BusinessError } 13900004 - Interrupted system call 409 * @throws { BusinessError } 13900005 - I/O error 410 * @throws { BusinessError } 13900008 - Bad file descriptor 411 * @throws { BusinessError } 13900025 - No space left on device 412 * @throws { BusinessError } 13900041 - Quota exceeded 413 * @throws { BusinessError } 13900042 - Unknown error 414 * @syscap SystemCapability.FileManagement.File.FileIO 415 * @since 9 416 */ 417/** 418 * Close file or fd. 419 * 420 * @param { number | File } file - file object or fd. 421 * @returns { Promise<void> } The promise returned by the function. 422 * @throws { BusinessError } 13900004 - Interrupted system call 423 * @throws { BusinessError } 13900005 - I/O error 424 * @throws { BusinessError } 13900008 - Bad file descriptor 425 * @throws { BusinessError } 13900025 - No space left on device 426 * @throws { BusinessError } 13900041 - Quota exceeded 427 * @throws { BusinessError } 13900042 - Unknown error 428 * @syscap SystemCapability.FileManagement.File.FileIO 429 * @crossplatform 430 * @since 10 431 */ 432declare function close(file: number | File): Promise<void>; 433 434/** 435 * Close file or fd. 436 * 437 * @param { number | File } file - file object or fd. 438 * @param { AsyncCallback<void> } callback - Return the callback function. 439 * @throws { BusinessError } 13900004 - Interrupted system call 440 * @throws { BusinessError } 13900005 - I/O error 441 * @throws { BusinessError } 13900008 - Bad file descriptor 442 * @throws { BusinessError } 13900025 - No space left on device 443 * @throws { BusinessError } 13900041 - Quota exceeded 444 * @throws { BusinessError } 13900042 - Unknown error 445 * @syscap SystemCapability.FileManagement.File.FileIO 446 * @since 9 447 */ 448/** 449 * Close file or fd. 450 * 451 * @param { number | File } file - file object or fd. 452 * @param { AsyncCallback<void> } callback - Return the callback function. 453 * @throws { BusinessError } 13900004 - Interrupted system call 454 * @throws { BusinessError } 13900005 - I/O error 455 * @throws { BusinessError } 13900008 - Bad file descriptor 456 * @throws { BusinessError } 13900025 - No space left on device 457 * @throws { BusinessError } 13900041 - Quota exceeded 458 * @throws { BusinessError } 13900042 - Unknown error 459 * @syscap SystemCapability.FileManagement.File.FileIO 460 * @crossplatform 461 * @since 10 462 */ 463declare function close(file: number | File, callback: AsyncCallback<void>): void; 464 465/** 466 * Close file or fd with sync interface. 467 * 468 * @param { number | File } file - file object or fd. 469 * @throws { BusinessError } 13900004 - Interrupted system call 470 * @throws { BusinessError } 13900005 - I/O error 471 * @throws { BusinessError } 13900008 - Bad file descriptor 472 * @throws { BusinessError } 13900025 - No space left on device 473 * @throws { BusinessError } 13900041 - Quota exceeded 474 * @throws { BusinessError } 13900042 - Unknown error 475 * @syscap SystemCapability.FileManagement.File.FileIO 476 * @since 9 477 */ 478/** 479 * Close file or fd with sync interface. 480 * 481 * @param { number | File } file - file object or fd. 482 * @throws { BusinessError } 13900004 - Interrupted system call 483 * @throws { BusinessError } 13900005 - I/O error 484 * @throws { BusinessError } 13900008 - Bad file descriptor 485 * @throws { BusinessError } 13900025 - No space left on device 486 * @throws { BusinessError } 13900041 - Quota exceeded 487 * @throws { BusinessError } 13900042 - Unknown error 488 * @syscap SystemCapability.FileManagement.File.FileIO 489 * @crossplatform 490 * @since 10 491 */ 492declare function closeSync(file: number | File): void; 493 494/** 495 * Copy directory. 496 * 497 * @param { string } src - source path. 498 * @param { string } dest - destination path. 499 * @param { number } [mode = 0] - mode. 500 * @returns { Promise<void> } The promise returned by the function. 501 * @throws { BusinessError } 13900002 - No such file or directory 502 * @throws { BusinessError } 13900004 - Interrupted system call 503 * @throws { BusinessError } 13900005 - I/O error 504 * @throws { BusinessError } 13900008 - Bad file descriptor 505 * @throws { BusinessError } 13900010 - Try again 506 * @throws { BusinessError } 13900011 - Out of memory 507 * @throws { BusinessError } 13900012 - Permission denied 508 * @throws { BusinessError } 13900013 - Bad address 509 * @throws { BusinessError } 13900018 - Not a directory 510 * @throws { BusinessError } 13900019 - Is a directory 511 * @throws { BusinessError } 13900020 - Invalid argument 512 * @throws { BusinessError } 13900030 - File name too long 513 * @throws { BusinessError } 13900031 - Function not implemented 514 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 515 * @throws { BusinessError } 13900034 - Operation would block 516 * @throws { BusinessError } 13900038 - Value too large for defined data type 517 * @throws { BusinessError } 13900042 - Unknown error 518 * @syscap SystemCapability.FileManagement.File.FileIO 519 * @since 10 520 */ 521declare function copyDir(src: string, dest: string, mode?: number): Promise<void>; 522 523/** 524 * Copy directory. 525 * 526 * @param { string } src - source path. 527 * @param { string } dest - destination path. 528 * @param { AsyncCallback<void> } callback - Return the callback function. 529 * @throws { BusinessError } 13900002 - No such file or directory 530 * @throws { BusinessError } 13900004 - Interrupted system call 531 * @throws { BusinessError } 13900005 - I/O error 532 * @throws { BusinessError } 13900008 - Bad file descriptor 533 * @throws { BusinessError } 13900010 - Try again 534 * @throws { BusinessError } 13900011 - Out of memory 535 * @throws { BusinessError } 13900012 - Permission denied 536 * @throws { BusinessError } 13900013 - Bad address 537 * @throws { BusinessError } 13900018 - Not a directory 538 * @throws { BusinessError } 13900019 - Is a directory 539 * @throws { BusinessError } 13900020 - Invalid argument 540 * @throws { BusinessError } 13900030 - File name too long 541 * @throws { BusinessError } 13900031 - Function not implemented 542 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 543 * @throws { BusinessError } 13900034 - Operation would block 544 * @throws { BusinessError } 13900038 - Value too large for defined data type 545 * @throws { BusinessError } 13900042 - Unknown error 546 * @syscap SystemCapability.FileManagement.File.FileIO 547 * @since 10 548 */ 549declare function copyDir(src: string, dest: string, callback: AsyncCallback<void>): void; 550 551/** 552 * Copy directory. 553 * 554 * @param { string } src - source path. 555 * @param { string } dest - destination path. 556 * @param { AsyncCallback<void, Array<ConflictFiles>> } callback - Return the callback function. 557 * @throws { BusinessError } 13900015 - File exists 558 * @syscap SystemCapability.FileManagement.File.FileIO 559 * @since 10 560 */ 561declare function copyDir(src: string, dest: string, callback: AsyncCallback<void, Array<ConflictFiles>>): void; 562 563 564/** 565 * Copy directory. 566 * 567 * @param { string } src - source path. 568 * @param { string } dest - destination path. 569 * @param { number } mode - mode. 570 * @param { AsyncCallback<void> } callback - Return the callback function. 571 * @throws { BusinessError } 13900002 - No such file or directory 572 * @throws { BusinessError } 13900004 - Interrupted system call 573 * @throws { BusinessError } 13900005 - I/O error 574 * @throws { BusinessError } 13900008 - Bad file descriptor 575 * @throws { BusinessError } 13900010 - Try again 576 * @throws { BusinessError } 13900011 - Out of memory 577 * @throws { BusinessError } 13900012 - Permission denied 578 * @throws { BusinessError } 13900013 - Bad address 579 * @throws { BusinessError } 13900018 - Not a directory 580 * @throws { BusinessError } 13900019 - Is a directory 581 * @throws { BusinessError } 13900020 - Invalid argument 582 * @throws { BusinessError } 13900030 - File name too long 583 * @throws { BusinessError } 13900031 - Function not implemented 584 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 585 * @throws { BusinessError } 13900034 - Operation would block 586 * @throws { BusinessError } 13900038 - Value too large for defined data type 587 * @throws { BusinessError } 13900042 - Unknown error 588 * @syscap SystemCapability.FileManagement.File.FileIO 589 * @since 10 590 */ 591declare function copyDir(src: string, dest: string, mode: number, callback: AsyncCallback<void>): void; 592 593/** 594 * Copy directory. 595 * 596 * @param { string } src - source path. 597 * @param { string } dest - destination path. 598 * @param { number } mode - mode. 599 * @param { AsyncCallback<void, Array<ConflictFiles>> } callback - Return the callback function. 600 * @throws { BusinessError } 13900015 - File exists 601 * @syscap SystemCapability.FileManagement.File.FileIO 602 * @since 10 603 */ 604declare function copyDir(src: string, dest: string, mode: number, callback: AsyncCallback<void, Array<ConflictFiles>>): void; 605 606/** 607 * Copy directory with sync interface. 608 * 609 * @param { string } src - source path. 610 * @param { string } dest - destination path. 611 * @param { number } [mode = 0] - mode. 612 * @throws { BusinessError } 13900002 - No such file or directory 613 * @throws { BusinessError } 13900004 - Interrupted system call 614 * @throws { BusinessError } 13900005 - I/O error 615 * @throws { BusinessError } 13900008 - Bad file descriptor 616 * @throws { BusinessError } 13900010 - Try again 617 * @throws { BusinessError } 13900011 - Out of memory 618 * @throws { BusinessError } 13900012 - Permission denied 619 * @throws { BusinessError } 13900013 - Bad address 620 * @throws { BusinessError } 13900015 - File exists 621 * @throws { BusinessError } 13900018 - Not a directory 622 * @throws { BusinessError } 13900019 - Is a directory 623 * @throws { BusinessError } 13900020 - Invalid argument 624 * @throws { BusinessError } 13900030 - File name too long 625 * @throws { BusinessError } 13900031 - Function not implemented 626 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 627 * @throws { BusinessError } 13900034 - Operation would block 628 * @throws { BusinessError } 13900038 - Value too large for defined data type 629 * @throws { BusinessError } 13900042 - Unknown error 630 * @syscap SystemCapability.FileManagement.File.FileIO 631 * @since 10 632 */ 633declare function copyDirSync(src: string, dest: string, mode?: number): void; 634 635/** 636 * Copy file. 637 * 638 * @param { string | number } src - src. 639 * @param { string | number } dest - dest. 640 * @param { number } [mode = 0] - mode. 641 * @returns { Promise<void> } The promise returned by the function. 642 * @throws { BusinessError } 13900002 - No such file or directory 643 * @throws { BusinessError } 13900004 - Interrupted system call 644 * @throws { BusinessError } 13900005 - I/O error 645 * @throws { BusinessError } 13900008 - Bad file descriptor 646 * @throws { BusinessError } 13900010 - Try again 647 * @throws { BusinessError } 13900011 - Out of memory 648 * @throws { BusinessError } 13900012 - Permission denied 649 * @throws { BusinessError } 13900013 - Bad address 650 * @throws { BusinessError } 13900018 - Not a directory 651 * @throws { BusinessError } 13900019 - Is a directory 652 * @throws { BusinessError } 13900020 - Invalid argument 653 * @throws { BusinessError } 13900030 - File name too long 654 * @throws { BusinessError } 13900031 - Function not implemented 655 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 656 * @throws { BusinessError } 13900034 - Operation would block 657 * @throws { BusinessError } 13900038 - Value too large for defined data type 658 * @throws { BusinessError } 13900042 - Unknown error 659 * @syscap SystemCapability.FileManagement.File.FileIO 660 * @since 9 661 */ 662/** 663 * Copy file. 664 * 665 * @param { string | number } src - src. 666 * @param { string | number } dest - dest. 667 * @param { number } [mode = 0] - mode. 668 * @returns { Promise<void> } The promise returned by the function. 669 * @throws { BusinessError } 13900002 - No such file or directory 670 * @throws { BusinessError } 13900004 - Interrupted system call 671 * @throws { BusinessError } 13900005 - I/O error 672 * @throws { BusinessError } 13900008 - Bad file descriptor 673 * @throws { BusinessError } 13900010 - Try again 674 * @throws { BusinessError } 13900011 - Out of memory 675 * @throws { BusinessError } 13900012 - Permission denied 676 * @throws { BusinessError } 13900013 - Bad address 677 * @throws { BusinessError } 13900018 - Not a directory 678 * @throws { BusinessError } 13900019 - Is a directory 679 * @throws { BusinessError } 13900020 - Invalid argument 680 * @throws { BusinessError } 13900030 - File name too long 681 * @throws { BusinessError } 13900031 - Function not implemented 682 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 683 * @throws { BusinessError } 13900034 - Operation would block 684 * @throws { BusinessError } 13900038 - Value too large for defined data type 685 * @throws { BusinessError } 13900042 - Unknown error 686 * @syscap SystemCapability.FileManagement.File.FileIO 687 * @crossplatform 688 * @since 10 689 */ 690declare function copyFile(src: string | number, dest: string | number, mode?: number): Promise<void>; 691 692/** 693 * Copy file. 694 * 695 * @param { string | number } src - src. 696 * @param { string | number } dest - dest. 697 * @param { AsyncCallback<void> } callback - Return the callback function. 698 * @throws { BusinessError } 13900002 - No such file or directory 699 * @throws { BusinessError } 13900004 - Interrupted system call 700 * @throws { BusinessError } 13900005 - I/O error 701 * @throws { BusinessError } 13900008 - Bad file descriptor 702 * @throws { BusinessError } 13900010 - Try again 703 * @throws { BusinessError } 13900011 - Out of memory 704 * @throws { BusinessError } 13900012 - Permission denied 705 * @throws { BusinessError } 13900013 - Bad address 706 * @throws { BusinessError } 13900018 - Not a directory 707 * @throws { BusinessError } 13900019 - Is a directory 708 * @throws { BusinessError } 13900020 - Invalid argument 709 * @throws { BusinessError } 13900030 - File name too long 710 * @throws { BusinessError } 13900031 - Function not implemented 711 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 712 * @throws { BusinessError } 13900034 - Operation would block 713 * @throws { BusinessError } 13900038 - Value too large for defined data type 714 * @throws { BusinessError } 13900042 - Unknown error 715 * @syscap SystemCapability.FileManagement.File.FileIO 716 * @since 9 717 */ 718/** 719 * Copy file. 720 * 721 * @param { string | number } src - src. 722 * @param { string | number } dest - dest. 723 * @param { AsyncCallback<void> } callback - Return the callback function. 724 * @throws { BusinessError } 13900002 - No such file or directory 725 * @throws { BusinessError } 13900004 - Interrupted system call 726 * @throws { BusinessError } 13900005 - I/O error 727 * @throws { BusinessError } 13900008 - Bad file descriptor 728 * @throws { BusinessError } 13900010 - Try again 729 * @throws { BusinessError } 13900011 - Out of memory 730 * @throws { BusinessError } 13900012 - Permission denied 731 * @throws { BusinessError } 13900013 - Bad address 732 * @throws { BusinessError } 13900018 - Not a directory 733 * @throws { BusinessError } 13900019 - Is a directory 734 * @throws { BusinessError } 13900020 - Invalid argument 735 * @throws { BusinessError } 13900030 - File name too long 736 * @throws { BusinessError } 13900031 - Function not implemented 737 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 738 * @throws { BusinessError } 13900034 - Operation would block 739 * @throws { BusinessError } 13900038 - Value too large for defined data type 740 * @throws { BusinessError } 13900042 - Unknown error 741 * @syscap SystemCapability.FileManagement.File.FileIO 742 * @crossplatform 743 * @since 10 744 */ 745declare function copyFile(src: string | number, dest: string | number, callback: AsyncCallback<void>): void; 746 747/** 748 * Copy file. 749 * 750 * @param { string | number } src - src. 751 * @param { string | number } dest - dest. 752 * @param { number } [mode = 0] - mode. 753 * @param { AsyncCallback<void> } callback - Return the callback function. 754 * @throws { BusinessError } 13900002 - No such file or directory 755 * @throws { BusinessError } 13900004 - Interrupted system call 756 * @throws { BusinessError } 13900005 - I/O error 757 * @throws { BusinessError } 13900008 - Bad file descriptor 758 * @throws { BusinessError } 13900010 - Try again 759 * @throws { BusinessError } 13900011 - Out of memory 760 * @throws { BusinessError } 13900012 - Permission denied 761 * @throws { BusinessError } 13900013 - Bad address 762 * @throws { BusinessError } 13900018 - Not a directory 763 * @throws { BusinessError } 13900019 - Is a directory 764 * @throws { BusinessError } 13900020 - Invalid argument 765 * @throws { BusinessError } 13900030 - File name too long 766 * @throws { BusinessError } 13900031 - Function not implemented 767 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 768 * @throws { BusinessError } 13900034 - Operation would block 769 * @throws { BusinessError } 13900038 - Value too large for defined data type 770 * @throws { BusinessError } 13900042 - Unknown error 771 * @syscap SystemCapability.FileManagement.File.FileIO 772 * @since 9 773 */ 774/** 775 * Copy file. 776 * 777 * @param { string | number } src - src. 778 * @param { string | number } dest - dest. 779 * @param { number } [mode = 0] - mode. 780 * @param { AsyncCallback<void> } callback - Return the callback function. 781 * @throws { BusinessError } 13900002 - No such file or directory 782 * @throws { BusinessError } 13900004 - Interrupted system call 783 * @throws { BusinessError } 13900005 - I/O error 784 * @throws { BusinessError } 13900008 - Bad file descriptor 785 * @throws { BusinessError } 13900010 - Try again 786 * @throws { BusinessError } 13900011 - Out of memory 787 * @throws { BusinessError } 13900012 - Permission denied 788 * @throws { BusinessError } 13900013 - Bad address 789 * @throws { BusinessError } 13900018 - Not a directory 790 * @throws { BusinessError } 13900019 - Is a directory 791 * @throws { BusinessError } 13900020 - Invalid argument 792 * @throws { BusinessError } 13900030 - File name too long 793 * @throws { BusinessError } 13900031 - Function not implemented 794 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 795 * @throws { BusinessError } 13900034 - Operation would block 796 * @throws { BusinessError } 13900038 - Value too large for defined data type 797 * @throws { BusinessError } 13900042 - Unknown error 798 * @syscap SystemCapability.FileManagement.File.FileIO 799 * @crossplatform 800 * @since 10 801 */ 802declare function copyFile( 803 src: string | number, 804 dest: string | number, 805 mode: number, 806 callback: AsyncCallback<void> 807): void; 808 809/** 810 * Copy file with sync interface. 811 * 812 * @param { string | number } src - src. 813 * @param { string | number } dest - dest. 814 * @param { number } [mode = 0] - mode. 815 * @throws { BusinessError } 13900002 - No such file or directory 816 * @throws { BusinessError } 13900004 - Interrupted system call 817 * @throws { BusinessError } 13900005 - I/O error 818 * @throws { BusinessError } 13900008 - Bad file descriptor 819 * @throws { BusinessError } 13900010 - Try again 820 * @throws { BusinessError } 13900011 - Out of memory 821 * @throws { BusinessError } 13900012 - Permission denied 822 * @throws { BusinessError } 13900013 - Bad address 823 * @throws { BusinessError } 13900018 - Not a directory 824 * @throws { BusinessError } 13900019 - Is a directory 825 * @throws { BusinessError } 13900020 - Invalid argument 826 * @throws { BusinessError } 13900030 - File name too long 827 * @throws { BusinessError } 13900031 - Function not implemented 828 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 829 * @throws { BusinessError } 13900034 - Operation would block 830 * @throws { BusinessError } 13900038 - Value too large for defined data type 831 * @throws { BusinessError } 13900042 - Unknown error 832 * @syscap SystemCapability.FileManagement.File.FileIO 833 * @since 9 834 */ 835/** 836 * Copy file with sync interface. 837 * 838 * @param { string | number } src - src. 839 * @param { string | number } dest - dest. 840 * @param { number } [mode = 0] - mode. 841 * @throws { BusinessError } 13900002 - No such file or directory 842 * @throws { BusinessError } 13900004 - Interrupted system call 843 * @throws { BusinessError } 13900005 - I/O error 844 * @throws { BusinessError } 13900008 - Bad file descriptor 845 * @throws { BusinessError } 13900010 - Try again 846 * @throws { BusinessError } 13900011 - Out of memory 847 * @throws { BusinessError } 13900012 - Permission denied 848 * @throws { BusinessError } 13900013 - Bad address 849 * @throws { BusinessError } 13900018 - Not a directory 850 * @throws { BusinessError } 13900019 - Is a directory 851 * @throws { BusinessError } 13900020 - Invalid argument 852 * @throws { BusinessError } 13900030 - File name too long 853 * @throws { BusinessError } 13900031 - Function not implemented 854 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 855 * @throws { BusinessError } 13900034 - Operation would block 856 * @throws { BusinessError } 13900038 - Value too large for defined data type 857 * @throws { BusinessError } 13900042 - Unknown error 858 * @syscap SystemCapability.FileManagement.File.FileIO 859 * @crossplatform 860 * @since 10 861 */ 862declare function copyFileSync(src: string | number, dest: string | number, mode?: number): void; 863 864/** 865 * Create class Stream. 866 * 867 * @param { string } path - path. 868 * @param { string } mode - mode. 869 * @returns { Promise<Stream> } return Promise 870 * @throws { BusinessError } 13900001 - Operation not permitted 871 * @throws { BusinessError } 13900002 - No such file or directory 872 * @throws { BusinessError } 13900004 - Interrupted system call 873 * @throws { BusinessError } 13900006 - No such device or address 874 * @throws { BusinessError } 13900008 - Bad file descriptor 875 * @throws { BusinessError } 13900011 - Out of memory 876 * @throws { BusinessError } 13900012 - Permission denied 877 * @throws { BusinessError } 13900013 - Bad address 878 * @throws { BusinessError } 13900014 - Device or resource busy 879 * @throws { BusinessError } 13900015 - File exists 880 * @throws { BusinessError } 13900017 - No such device 881 * @throws { BusinessError } 13900018 - Not a directory 882 * @throws { BusinessError } 13900019 - Is a directory 883 * @throws { BusinessError } 13900020 - Invalid argument 884 * @throws { BusinessError } 13900022 - Too many open files 885 * @throws { BusinessError } 13900023 - Text file busy 886 * @throws { BusinessError } 13900024 - File too large 887 * @throws { BusinessError } 13900025 - No space left on device 888 * @throws { BusinessError } 13900027 - Read-only file system 889 * @throws { BusinessError } 13900029 - Resource deadlock would occur 890 * @throws { BusinessError } 13900030 - File name too long 891 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 892 * @throws { BusinessError } 13900034 - Operation would block 893 * @throws { BusinessError } 13900038 - Value too large for defined data type 894 * @throws { BusinessError } 13900041 - Quota exceeded 895 * @throws { BusinessError } 13900042 - Unknown error 896 * @syscap SystemCapability.FileManagement.File.FileIO 897 * @since 9 898 */ 899declare function createStream(path: string, mode: string): Promise<Stream>; 900 901/** 902 * Create class Stream. 903 * 904 * @param { string } path - path. 905 * @param { string } mode - mode. 906 * @param { AsyncCallback<Stream> } callback - callback. 907 * @throws { BusinessError } 13900001 - Operation not permitted 908 * @throws { BusinessError } 13900002 - No such file or directory 909 * @throws { BusinessError } 13900004 - Interrupted system call 910 * @throws { BusinessError } 13900006 - No such device or address 911 * @throws { BusinessError } 13900008 - Bad file descriptor 912 * @throws { BusinessError } 13900011 - Out of memory 913 * @throws { BusinessError } 13900012 - Permission denied 914 * @throws { BusinessError } 13900013 - Bad address 915 * @throws { BusinessError } 13900014 - Device or resource busy 916 * @throws { BusinessError } 13900015 - File exists 917 * @throws { BusinessError } 13900017 - No such device 918 * @throws { BusinessError } 13900018 - Not a directory 919 * @throws { BusinessError } 13900019 - Is a directory 920 * @throws { BusinessError } 13900020 - Invalid argument 921 * @throws { BusinessError } 13900022 - Too many open files 922 * @throws { BusinessError } 13900023 - Text file busy 923 * @throws { BusinessError } 13900024 - File too large 924 * @throws { BusinessError } 13900025 - No space left on device 925 * @throws { BusinessError } 13900027 - Read-only file system 926 * @throws { BusinessError } 13900029 - Resource deadlock would occur 927 * @throws { BusinessError } 13900030 - File name too long 928 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 929 * @throws { BusinessError } 13900034 - Operation would block 930 * @throws { BusinessError } 13900038 - Value too large for defined data type 931 * @throws { BusinessError } 13900041 - Quota exceeded 932 * @throws { BusinessError } 13900042 - Unknown error 933 * @syscap SystemCapability.FileManagement.File.FileIO 934 * @since 9 935 */ 936declare function createStream(path: string, mode: string, callback: AsyncCallback<Stream>): void; 937 938/** 939 * Create class Stream with sync interface. 940 * 941 * @param { string } path - path. 942 * @param { string } mode - mode. 943 * @returns { Stream } createStream 944 * @throws { BusinessError } 13900001 - Operation not permitted 945 * @throws { BusinessError } 13900002 - No such file or directory 946 * @throws { BusinessError } 13900004 - Interrupted system call 947 * @throws { BusinessError } 13900006 - No such device or address 948 * @throws { BusinessError } 13900008 - Bad file descriptor 949 * @throws { BusinessError } 13900011 - Out of memory 950 * @throws { BusinessError } 13900012 - Permission denied 951 * @throws { BusinessError } 13900013 - Bad address 952 * @throws { BusinessError } 13900014 - Device or resource busy 953 * @throws { BusinessError } 13900015 - File exists 954 * @throws { BusinessError } 13900017 - No such device 955 * @throws { BusinessError } 13900018 - Not a directory 956 * @throws { BusinessError } 13900019 - Is a directory 957 * @throws { BusinessError } 13900020 - Invalid argument 958 * @throws { BusinessError } 13900022 - Too many open files 959 * @throws { BusinessError } 13900023 - Text file busy 960 * @throws { BusinessError } 13900024 - File too large 961 * @throws { BusinessError } 13900025 - No space left on device 962 * @throws { BusinessError } 13900027 - Read-only file system 963 * @throws { BusinessError } 13900029 - Resource deadlock would occur 964 * @throws { BusinessError } 13900030 - File name too long 965 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 966 * @throws { BusinessError } 13900034 - Operation would block 967 * @throws { BusinessError } 13900038 - Value too large for defined data type 968 * @throws { BusinessError } 13900041 - Quota exceeded 969 * @throws { BusinessError } 13900042 - Unknown error 970 * @syscap SystemCapability.FileManagement.File.FileIO 971 * @since 9 972 */ 973declare function createStreamSync(path: string, mode: string): Stream; 974 975 976/** 977 * Create class RandomAccessFile. 978 * 979 * @param { string | File } file - file path, object. 980 * @param { number } [mode = OpenMode.READ_ONLY] - mode. 981 * @returns { Promise<RandomAccessFile> } Returns the RandomAccessFile object which has been created in promise mode. 982 * @throws { BusinessError } 13900001 - Operation not permitted 983 * @throws { BusinessError } 13900002 - No such file or directory 984 * @throws { BusinessError } 13900004 - Interrupted system call 985 * @throws { BusinessError } 13900006 - No such device or address 986 * @throws { BusinessError } 13900008 - Bad file descriptor 987 * @throws { BusinessError } 13900011 - Out of memory 988 * @throws { BusinessError } 13900012 - Permission denied 989 * @throws { BusinessError } 13900013 - Bad address 990 * @throws { BusinessError } 13900014 - Device or resource busy 991 * @throws { BusinessError } 13900015 - File exists 992 * @throws { BusinessError } 13900017 - No such device 993 * @throws { BusinessError } 13900018 - Not a directory 994 * @throws { BusinessError } 13900019 - Is a directory 995 * @throws { BusinessError } 13900020 - Invalid argument 996 * @throws { BusinessError } 13900022 - Too many open files 997 * @throws { BusinessError } 13900023 - Text file busy 998 * @throws { BusinessError } 13900024 - File too large 999 * @throws { BusinessError } 13900025 - No space left on device 1000 * @throws { BusinessError } 13900027 - Read-only file system 1001 * @throws { BusinessError } 13900029 - Resource deadlock would occur 1002 * @throws { BusinessError } 13900030 - File name too long 1003 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 1004 * @throws { BusinessError } 13900034 - Operation would block 1005 * @throws { BusinessError } 13900038 - Value too large for defined data type 1006 * @throws { BusinessError } 13900041 - Quota exceeded 1007 * @throws { BusinessError } 13900042 - Unknown error 1008 * @syscap SystemCapability.FileManagement.File.FileIO 1009 * @since 10 1010 */ 1011declare function createRandomAccessFile(file: string | File, mode?: number): Promise<RandomAccessFile>; 1012 1013/** 1014 * Create class RandomAccessFile. 1015 * 1016 * @param { string | File } file - file path, object. 1017 * @param { AsyncCallback<RandomAccessFile> } callback - The callback is used to return the RandomAccessFile object which has been created. 1018 * @throws { BusinessError } 13900001 - Operation not permitted 1019 * @throws { BusinessError } 13900002 - No such file or directory 1020 * @throws { BusinessError } 13900004 - Interrupted system call 1021 * @throws { BusinessError } 13900006 - No such device or address 1022 * @throws { BusinessError } 13900008 - Bad file descriptor 1023 * @throws { BusinessError } 13900011 - Out of memory 1024 * @throws { BusinessError } 13900012 - Permission denied 1025 * @throws { BusinessError } 13900013 - Bad address 1026 * @throws { BusinessError } 13900014 - Device or resource busy 1027 * @throws { BusinessError } 13900015 - File exists 1028 * @throws { BusinessError } 13900017 - No such device 1029 * @throws { BusinessError } 13900018 - Not a directory 1030 * @throws { BusinessError } 13900019 - Is a directory 1031 * @throws { BusinessError } 13900020 - Invalid argument 1032 * @throws { BusinessError } 13900022 - Too many open files 1033 * @throws { BusinessError } 13900023 - Text file busy 1034 * @throws { BusinessError } 13900024 - File too large 1035 * @throws { BusinessError } 13900025 - No space left on device 1036 * @throws { BusinessError } 13900027 - Read-only file system 1037 * @throws { BusinessError } 13900029 - Resource deadlock would occur 1038 * @throws { BusinessError } 13900030 - File name too long 1039 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 1040 * @throws { BusinessError } 13900034 - Operation would block 1041 * @throws { BusinessError } 13900038 - Value too large for defined data type 1042 * @throws { BusinessError } 13900041 - Quota exceeded 1043 * @throws { BusinessError } 13900042 - Unknown error 1044 * @syscap SystemCapability.FileManagement.File.FileIO 1045 * @since 10 1046 */ 1047declare function createRandomAccessFile(file: string | File, callback: AsyncCallback<RandomAccessFile>): void; 1048 1049/** 1050 * Create class RandomAccessFile. 1051 * 1052 * @param { string | File } file - file path, object. 1053 * @param { number } [mode = OpenMode.READ_ONLY] - mode. 1054 * @param { AsyncCallback<RandomAccessFile> } callback - The callback is used to return the RandomAccessFile object which has been created. 1055 * @throws { BusinessError } 13900001 - Operation not permitted 1056 * @throws { BusinessError } 13900002 - No such file or directory 1057 * @throws { BusinessError } 13900004 - Interrupted system call 1058 * @throws { BusinessError } 13900006 - No such device or address 1059 * @throws { BusinessError } 13900008 - Bad file descriptor 1060 * @throws { BusinessError } 13900011 - Out of memory 1061 * @throws { BusinessError } 13900012 - Permission denied 1062 * @throws { BusinessError } 13900013 - Bad address 1063 * @throws { BusinessError } 13900014 - Device or resource busy 1064 * @throws { BusinessError } 13900015 - File exists 1065 * @throws { BusinessError } 13900017 - No such device 1066 * @throws { BusinessError } 13900018 - Not a directory 1067 * @throws { BusinessError } 13900019 - Is a directory 1068 * @throws { BusinessError } 13900020 - Invalid argument 1069 * @throws { BusinessError } 13900022 - Too many open files 1070 * @throws { BusinessError } 13900023 - Text file busy 1071 * @throws { BusinessError } 13900024 - File too large 1072 * @throws { BusinessError } 13900025 - No space left on device 1073 * @throws { BusinessError } 13900027 - Read-only file system 1074 * @throws { BusinessError } 13900029 - Resource deadlock would occur 1075 * @throws { BusinessError } 13900030 - File name too long 1076 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 1077 * @throws { BusinessError } 13900034 - Operation would block 1078 * @throws { BusinessError } 13900038 - Value too large for defined data type 1079 * @throws { BusinessError } 13900041 - Quota exceeded 1080 * @throws { BusinessError } 13900042 - Unknown error 1081 * @syscap SystemCapability.FileManagement.File.FileIO 1082 * @since 10 1083 */ 1084declare function createRandomAccessFile(file: string | File, mode: number, callback: AsyncCallback<RandomAccessFile>): void; 1085 1086/** 1087 * Create class RandomAccessFile with sync interface. 1088 * 1089 * @param { string | File } file - file path, object. 1090 * @param { number } [mode = OpenMode.READ_ONLY] - mode. 1091 * @returns { RandomAccessFile } Returns the RandomAccessFile object which has been created. 1092 * @throws { BusinessError } 13900001 - Operation not permitted 1093 * @throws { BusinessError } 13900002 - No such file or directory 1094 * @throws { BusinessError } 13900004 - Interrupted system call 1095 * @throws { BusinessError } 13900006 - No such device or address 1096 * @throws { BusinessError } 13900008 - Bad file descriptor 1097 * @throws { BusinessError } 13900011 - Out of memory 1098 * @throws { BusinessError } 13900012 - Permission denied 1099 * @throws { BusinessError } 13900013 - Bad address 1100 * @throws { BusinessError } 13900014 - Device or resource busy 1101 * @throws { BusinessError } 13900015 - File exists 1102 * @throws { BusinessError } 13900017 - No such device 1103 * @throws { BusinessError } 13900018 - Not a directory 1104 * @throws { BusinessError } 13900019 - Is a directory 1105 * @throws { BusinessError } 13900020 - Invalid argument 1106 * @throws { BusinessError } 13900022 - Too many open files 1107 * @throws { BusinessError } 13900023 - Text file busy 1108 * @throws { BusinessError } 13900024 - File too large 1109 * @throws { BusinessError } 13900025 - No space left on device 1110 * @throws { BusinessError } 13900027 - Read-only file system 1111 * @throws { BusinessError } 13900029 - Resource deadlock would occur 1112 * @throws { BusinessError } 13900030 - File name too long 1113 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 1114 * @throws { BusinessError } 13900034 - Operation would block 1115 * @throws { BusinessError } 13900038 - Value too large for defined data type 1116 * @throws { BusinessError } 13900041 - Quota exceeded 1117 * @throws { BusinessError } 13900042 - Unknown error 1118 * @syscap SystemCapability.FileManagement.File.FileIO 1119 * @since 10 1120 */ 1121declare function createRandomAccessFileSync(file: string | File, mode?: number): RandomAccessFile; 1122 1123/** 1124 * Create watcher to listen for file changes. 1125 * 1126 * @param { string } path - path. 1127 * @param { number } events - listened events. 1128 * @param { WatchEventListener } listener - Callback to invoke when an event of the specified type occurs. 1129 * @returns { Watcher } Returns the Watcher object which has been created. 1130 * @throws { BusinessError } 13900002 - No such file or directory 1131 * @throws { BusinessError } 13900008 - Bad file descriptor 1132 * @throws { BusinessError } 13900011 - Out of memory 1133 * @throws { BusinessError } 13900012 - Permission denied 1134 * @throws { BusinessError } 13900013 - Bad address 1135 * @throws { BusinessError } 13900015 - File exists 1136 * @throws { BusinessError } 13900018 - Not a directory 1137 * @throws { BusinessError } 13900020 - Invalid argument 1138 * @throws { BusinessError } 13900021 - File table overflow 1139 * @throws { BusinessError } 13900022 - Too many open files 1140 * @throws { BusinessError } 13900025 - No space left on device 1141 * @throws { BusinessError } 13900030 - File name too long 1142 * @throws { BusinessError } 13900042 - Unknown error 1143 * @syscap SystemCapability.FileManagement.File.FileIO 1144 * @since 10 1145 */ 1146declare function createWatcher(path: string, events: number, listener: WatchEventListener): Watcher; 1147 1148/** 1149 * Duplicate fd to File Object. 1150 * 1151 * @param { number } fd - fd. 1152 * @returns { File } return File 1153 * @throws { BusinessError } 13900004 - Interrupted system call 1154 * @throws { BusinessError } 13900005 - I/O error 1155 * @throws { BusinessError } 13900008 - Bad file descriptor 1156 * @throws { BusinessError } 13900014 - Device or resource busy 1157 * @throws { BusinessError } 13900020 - Invalid argument 1158 * @throws { BusinessError } 13900022 - Too many open files 1159 * @throws { BusinessError } 13900042 - Unknown error 1160 * @syscap SystemCapability.FileManagement.File.FileIO 1161 * @since 10 1162 */ 1163declare function dup(fd: number): File; 1164 1165/** 1166 * Synchronize file metadata. 1167 * 1168 * @param { number } fd - fd. 1169 * @returns { Promise<void> } The promise returned by the function. 1170 * @throws { BusinessError } 13900005 - I/O error 1171 * @throws { BusinessError } 13900008 - Bad file descriptor 1172 * @throws { BusinessError } 13900020 - Invalid argument 1173 * @throws { BusinessError } 13900025 - No space left on device 1174 * @throws { BusinessError } 13900027 - Read-only file system 1175 * @throws { BusinessError } 13900041 - Quota exceeded 1176 * @throws { BusinessError } 13900042 - Unknown error 1177 * @syscap SystemCapability.FileManagement.File.FileIO 1178 * @since 9 1179 */ 1180/** 1181 * Synchronize file metadata. 1182 * 1183 * @param { number } fd - fd. 1184 * @returns { Promise<void> } The promise returned by the function. 1185 * @throws { BusinessError } 13900005 - I/O error 1186 * @throws { BusinessError } 13900008 - Bad file descriptor 1187 * @throws { BusinessError } 13900020 - Invalid argument 1188 * @throws { BusinessError } 13900025 - No space left on device 1189 * @throws { BusinessError } 13900027 - Read-only file system 1190 * @throws { BusinessError } 13900041 - Quota exceeded 1191 * @throws { BusinessError } 13900042 - Unknown error 1192 * @syscap SystemCapability.FileManagement.File.FileIO 1193 * @crossplatform 1194 * @since 10 1195 */ 1196declare function fdatasync(fd: number): Promise<void>; 1197 1198/** 1199 * Synchronize file metadata. 1200 * 1201 * @param { number } fd - fd. 1202 * @param { AsyncCallback<void> } callback - Return the callback function. 1203 * @throws { BusinessError } 13900005 - I/O error 1204 * @throws { BusinessError } 13900008 - Bad file descriptor 1205 * @throws { BusinessError } 13900020 - Invalid argument 1206 * @throws { BusinessError } 13900025 - No space left on device 1207 * @throws { BusinessError } 13900027 - Read-only file system 1208 * @throws { BusinessError } 13900041 - Quota exceeded 1209 * @throws { BusinessError } 13900042 - Unknown error 1210 * @syscap SystemCapability.FileManagement.File.FileIO 1211 * @since 9 1212 */ 1213/** 1214 * Synchronize file metadata. 1215 * 1216 * @param { number } fd - fd. 1217 * @param { AsyncCallback<void> } callback - Return the callback function. 1218 * @throws { BusinessError } 13900005 - I/O error 1219 * @throws { BusinessError } 13900008 - Bad file descriptor 1220 * @throws { BusinessError } 13900020 - Invalid argument 1221 * @throws { BusinessError } 13900025 - No space left on device 1222 * @throws { BusinessError } 13900027 - Read-only file system 1223 * @throws { BusinessError } 13900041 - Quota exceeded 1224 * @throws { BusinessError } 13900042 - Unknown error 1225 * @syscap SystemCapability.FileManagement.File.FileIO 1226 * @crossplatform 1227 * @since 10 1228 */ 1229declare function fdatasync(fd: number, callback: AsyncCallback<void>): void; 1230 1231/** 1232 * Synchronize file metadata with sync interface. 1233 * 1234 * @param { number } fd - fd. 1235 * @throws { BusinessError } 13900005 - I/O error 1236 * @throws { BusinessError } 13900008 - Bad file descriptor 1237 * @throws { BusinessError } 13900020 - Invalid argument 1238 * @throws { BusinessError } 13900025 - No space left on device 1239 * @throws { BusinessError } 13900027 - Read-only file system 1240 * @throws { BusinessError } 13900041 - Quota exceeded 1241 * @throws { BusinessError } 13900042 - Unknown error 1242 * @syscap SystemCapability.FileManagement.File.FileIO 1243 * @since 9 1244 */ 1245/** 1246 * Synchronize file metadata with sync interface. 1247 * 1248 * @param { number } fd - fd. 1249 * @throws { BusinessError } 13900005 - I/O error 1250 * @throws { BusinessError } 13900008 - Bad file descriptor 1251 * @throws { BusinessError } 13900020 - Invalid argument 1252 * @throws { BusinessError } 13900025 - No space left on device 1253 * @throws { BusinessError } 13900027 - Read-only file system 1254 * @throws { BusinessError } 13900041 - Quota exceeded 1255 * @throws { BusinessError } 13900042 - Unknown error 1256 * @syscap SystemCapability.FileManagement.File.FileIO 1257 * @crossplatform 1258 * @since 10 1259 */ 1260declare function fdatasyncSync(fd: number): void; 1261 1262/** 1263 * Create class Stream by using fd. 1264 * 1265 * @param { number } fd - fd. 1266 * @param { string } mode - mode. 1267 * @returns { Promise<Stream> } Returns the Stream object in promise mode. 1268 * @throws { BusinessError } 13900001 - Operation not permitted 1269 * @throws { BusinessError } 13900002 - No such file or directory 1270 * @throws { BusinessError } 13900004 - Interrupted system call 1271 * @throws { BusinessError } 13900006 - No such device or address 1272 * @throws { BusinessError } 13900008 - Bad file descriptor 1273 * @throws { BusinessError } 13900010 - Try again 1274 * @throws { BusinessError } 13900011 - Out of memory 1275 * @throws { BusinessError } 13900012 - Permission denied 1276 * @throws { BusinessError } 13900013 - Bad address 1277 * @throws { BusinessError } 13900014 - Device or resource busy 1278 * @throws { BusinessError } 13900015 - File exists 1279 * @throws { BusinessError } 13900017 - No such device 1280 * @throws { BusinessError } 13900018 - Not a directory 1281 * @throws { BusinessError } 13900019 - Is a directory 1282 * @throws { BusinessError } 13900020 - Invalid argument 1283 * @throws { BusinessError } 13900022 - Too many open files 1284 * @throws { BusinessError } 13900023 - Text file busy 1285 * @throws { BusinessError } 13900024 - File too large 1286 * @throws { BusinessError } 13900025 - No space left on device 1287 * @throws { BusinessError } 13900027 - Read-only file system 1288 * @throws { BusinessError } 13900029 - Resource deadlock would occur 1289 * @throws { BusinessError } 13900030 - File name too long 1290 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 1291 * @throws { BusinessError } 13900034 - Operation would block 1292 * @throws { BusinessError } 13900038 - Value too large for defined data type 1293 * @throws { BusinessError } 13900041 - Quota exceeded 1294 * @throws { BusinessError } 13900042 - Unknown error 1295 * @syscap SystemCapability.FileManagement.File.FileIO 1296 * @since 9 1297 */ 1298declare function fdopenStream(fd: number, mode: string): Promise<Stream>; 1299 1300/** 1301 * Create class Stream by using fd. 1302 * 1303 * @param { number } fd - fd. 1304 * @param { string } mode - mode. 1305 * @param { AsyncCallback<Stream> } callback - The callback is used to return the Stream object. 1306 * @throws { BusinessError } 13900001 - Operation not permitted 1307 * @throws { BusinessError } 13900002 - No such file or directory 1308 * @throws { BusinessError } 13900004 - Interrupted system call 1309 * @throws { BusinessError } 13900006 - No such device or address 1310 * @throws { BusinessError } 13900008 - Bad file descriptor 1311 * @throws { BusinessError } 13900010 - Try again 1312 * @throws { BusinessError } 13900011 - Out of memory 1313 * @throws { BusinessError } 13900012 - Permission denied 1314 * @throws { BusinessError } 13900013 - Bad address 1315 * @throws { BusinessError } 13900014 - Device or resource busy 1316 * @throws { BusinessError } 13900015 - File exists 1317 * @throws { BusinessError } 13900017 - No such device 1318 * @throws { BusinessError } 13900018 - Not a directory 1319 * @throws { BusinessError } 13900019 - Is a directory 1320 * @throws { BusinessError } 13900020 - Invalid argument 1321 * @throws { BusinessError } 13900022 - Too many open files 1322 * @throws { BusinessError } 13900023 - Text file busy 1323 * @throws { BusinessError } 13900024 - File too large 1324 * @throws { BusinessError } 13900025 - No space left on device 1325 * @throws { BusinessError } 13900027 - Read-only file system 1326 * @throws { BusinessError } 13900029 - Resource deadlock would occur 1327 * @throws { BusinessError } 13900030 - File name too long 1328 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 1329 * @throws { BusinessError } 13900034 - Operation would block 1330 * @throws { BusinessError } 13900038 - Value too large for defined data type 1331 * @throws { BusinessError } 13900041 - Quota exceeded 1332 * @throws { BusinessError } 13900042 - Unknown error 1333 * @syscap SystemCapability.FileManagement.File.FileIO 1334 * @since 9 1335 */ 1336declare function fdopenStream(fd: number, mode: string, callback: AsyncCallback<Stream>): void; 1337 1338/** 1339 * Create class Stream by using fd with sync interface. 1340 * 1341 * @param { number } fd - fd. 1342 * @param { string } mode - mode. 1343 * @returns { Stream } Returns the Stream object. 1344 * @throws { BusinessError } 13900001 - Operation not permitted 1345 * @throws { BusinessError } 13900002 - No such file or directory 1346 * @throws { BusinessError } 13900004 - Interrupted system call 1347 * @throws { BusinessError } 13900006 - No such device or address 1348 * @throws { BusinessError } 13900008 - Bad file descriptor 1349 * @throws { BusinessError } 13900010 - Try again 1350 * @throws { BusinessError } 13900011 - Out of memory 1351 * @throws { BusinessError } 13900012 - Permission denied 1352 * @throws { BusinessError } 13900013 - Bad address 1353 * @throws { BusinessError } 13900014 - Device or resource busy 1354 * @throws { BusinessError } 13900015 - File exists 1355 * @throws { BusinessError } 13900017 - No such device 1356 * @throws { BusinessError } 13900018 - Not a directory 1357 * @throws { BusinessError } 13900019 - Is a directory 1358 * @throws { BusinessError } 13900020 - Invalid argument 1359 * @throws { BusinessError } 13900022 - Too many open files 1360 * @throws { BusinessError } 13900023 - Text file busy 1361 * @throws { BusinessError } 13900024 - File too large 1362 * @throws { BusinessError } 13900025 - No space left on device 1363 * @throws { BusinessError } 13900027 - Read-only file system 1364 * @throws { BusinessError } 13900029 - Resource deadlock would occur 1365 * @throws { BusinessError } 13900030 - File name too long 1366 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 1367 * @throws { BusinessError } 13900034 - Operation would block 1368 * @throws { BusinessError } 13900038 - Value too large for defined data type 1369 * @throws { BusinessError } 13900041 - Quota exceeded 1370 * @throws { BusinessError } 13900042 - Unknown error 1371 * @syscap SystemCapability.FileManagement.File.FileIO 1372 * @since 9 1373 */ 1374declare function fdopenStreamSync(fd: number, mode: string): Stream; 1375 1376/** 1377 * Synchronize file. 1378 * 1379 * @param { number } fd - fd. 1380 * @returns { Promise<void> } The promise returned by the function. 1381 * @throws { BusinessError } 13900005 - I/O error 1382 * @throws { BusinessError } 13900008 - Bad file descriptor 1383 * @throws { BusinessError } 13900020 - Invalid argument 1384 * @throws { BusinessError } 13900025 - No space left on device 1385 * @throws { BusinessError } 13900027 - Read-only file system 1386 * @throws { BusinessError } 13900041 - Quota exceeded 1387 * @throws { BusinessError } 13900042 - Unknown error 1388 * @syscap SystemCapability.FileManagement.File.FileIO 1389 * @since 9 1390 */ 1391/** 1392 * Synchronize file. 1393 * 1394 * @param { number } fd - fd. 1395 * @returns { Promise<void> } The promise returned by the function. 1396 * @throws { BusinessError } 13900005 - I/O error 1397 * @throws { BusinessError } 13900008 - Bad file descriptor 1398 * @throws { BusinessError } 13900020 - Invalid argument 1399 * @throws { BusinessError } 13900025 - No space left on device 1400 * @throws { BusinessError } 13900027 - Read-only file system 1401 * @throws { BusinessError } 13900041 - Quota exceeded 1402 * @throws { BusinessError } 13900042 - Unknown error 1403 * @syscap SystemCapability.FileManagement.File.FileIO 1404 * @crossplatform 1405 * @since 10 1406 */ 1407declare function fsync(fd: number): Promise<void>; 1408 1409/** 1410 * Synchronize file. 1411 * 1412 * @param { number } fd - fd. 1413 * @param { AsyncCallback<void> } callback - Return the callback function. 1414 * @throws { BusinessError } 13900005 - I/O error 1415 * @throws { BusinessError } 13900008 - Bad file descriptor 1416 * @throws { BusinessError } 13900020 - Invalid argument 1417 * @throws { BusinessError } 13900025 - No space left on device 1418 * @throws { BusinessError } 13900027 - Read-only file system 1419 * @throws { BusinessError } 13900041 - Quota exceeded 1420 * @throws { BusinessError } 13900042 - Unknown error 1421 * @syscap SystemCapability.FileManagement.File.FileIO 1422 * @since 9 1423 */ 1424/** 1425 * Synchronize file. 1426 * 1427 * @param { number } fd - fd. 1428 * @param { AsyncCallback<void> } callback - Return the callback function. 1429 * @throws { BusinessError } 13900005 - I/O error 1430 * @throws { BusinessError } 13900008 - Bad file descriptor 1431 * @throws { BusinessError } 13900020 - Invalid argument 1432 * @throws { BusinessError } 13900025 - No space left on device 1433 * @throws { BusinessError } 13900027 - Read-only file system 1434 * @throws { BusinessError } 13900041 - Quota exceeded 1435 * @throws { BusinessError } 13900042 - Unknown error 1436 * @syscap SystemCapability.FileManagement.File.FileIO 1437 * @crossplatform 1438 * @since 10 1439 */ 1440declare function fsync(fd: number, callback: AsyncCallback<void>): void; 1441 1442/** 1443 * Synchronize file with sync interface. 1444 * 1445 * @param { number } fd - fd. 1446 * @throws { BusinessError } 13900005 - I/O error 1447 * @throws { BusinessError } 13900008 - Bad file descriptor 1448 * @throws { BusinessError } 13900020 - Invalid argument 1449 * @throws { BusinessError } 13900025 - No space left on device 1450 * @throws { BusinessError } 13900027 - Read-only file system 1451 * @throws { BusinessError } 13900041 - Quota exceeded 1452 * @throws { BusinessError } 13900042 - Unknown error 1453 * @syscap SystemCapability.FileManagement.File.FileIO 1454 * @since 9 1455 */ 1456/** 1457 * Synchronize file with sync interface. 1458 * 1459 * @param { number } fd - fd. 1460 * @throws { BusinessError } 13900005 - I/O error 1461 * @throws { BusinessError } 13900008 - Bad file descriptor 1462 * @throws { BusinessError } 13900020 - Invalid argument 1463 * @throws { BusinessError } 13900025 - No space left on device 1464 * @throws { BusinessError } 13900027 - Read-only file system 1465 * @throws { BusinessError } 13900041 - Quota exceeded 1466 * @throws { BusinessError } 13900042 - Unknown error 1467 * @syscap SystemCapability.FileManagement.File.FileIO 1468 * @crossplatform 1469 * @since 10 1470 */ 1471declare function fsyncSync(fd: number): void; 1472 1473/** 1474 * List file. 1475 * 1476 * @param { string } path - path. 1477 * @param { object } [options] - options. 1478 * @returns { Promise<string[]> } Returns an Array containing the name of files or directories that meet the filter criteria in promise mode. 1479 * If present, Include the subdirectory structure. 1480 * @throws { BusinessError } 13900002 - No such file or directory 1481 * @throws { BusinessError } 13900008 - Bad file descriptor 1482 * @throws { BusinessError } 13900011 - Out of memory 1483 * @throws { BusinessError } 13900018 - Not a directory 1484 * @throws { BusinessError } 13900042 - Unknown error 1485 * @syscap SystemCapability.FileManagement.File.FileIO 1486 * @since 9 1487 */ 1488/** 1489 * List file. 1490 * 1491 * @param { string } path - path. 1492 * @param { object } [options] - options. 1493 * @returns { Promise<string[]> } Returns an Array containing the name of files or directories that meet the filter criteria. 1494 * If present, Include the subdirectory structure. 1495 * @throws { BusinessError } 13900002 - No such file or directory 1496 * @throws { BusinessError } 13900008 - Bad file descriptor 1497 * @throws { BusinessError } 13900011 - Out of memory 1498 * @throws { BusinessError } 13900018 - Not a directory 1499 * @throws { BusinessError } 13900042 - Unknown error 1500 * @syscap SystemCapability.FileManagement.File.FileIO 1501 * @crossplatform 1502 * @since 10 1503 */ 1504declare function listFile( 1505 path: string, 1506 options?: { 1507 recursion?: boolean; 1508 listNum?: number; 1509 filter?: Filter; 1510 } 1511): Promise<string[]>; 1512 1513/** 1514 * List file. 1515 * 1516 * @param { string } path - path. 1517 * @param { AsyncCallback<string[]> } callback - The callback is used to return an Array containing the name of files or directories 1518 * that meet the filter criteria in promise mode. If present, Include the subdirectory structure. 1519 * @throws { BusinessError } 13900002 - No such file or directory 1520 * @throws { BusinessError } 13900008 - Bad file descriptor 1521 * @throws { BusinessError } 13900011 - Out of memory 1522 * @throws { BusinessError } 13900018 - Not a directory 1523 * @throws { BusinessError } 13900042 - Unknown error 1524 * @syscap SystemCapability.FileManagement.File.FileIO 1525 * @since 9 1526 */ 1527/** 1528 * List file. 1529 * 1530 * @param { string } path - path. 1531 * @param { AsyncCallback<string[]> } callback - The callback is used to return an Array containing the name of files or directories 1532 * that meet the filter criteria in promise mode. If present, Include the subdirectory structure. 1533 * @throws { BusinessError } 13900002 - No such file or directory 1534 * @throws { BusinessError } 13900008 - Bad file descriptor 1535 * @throws { BusinessError } 13900011 - Out of memory 1536 * @throws { BusinessError } 13900018 - Not a directory 1537 * @throws { BusinessError } 13900042 - Unknown error 1538 * @syscap SystemCapability.FileManagement.File.FileIO 1539 * @crossplatform 1540 * @since 10 1541 */ 1542declare function listFile(path: string, callback: AsyncCallback<string[]>): void; 1543 1544/** 1545 * List file. 1546 * 1547 * @param { string } path - path. 1548 * @param { object } [options] - options. 1549 * @param { AsyncCallback<string[]> } callback - The callback is used to return an Array containing the name of files or directories 1550 * that meet the filter criteria in promise mode. If present, Include the subdirectory structure. 1551 * @throws { BusinessError } 13900002 - No such file or directory 1552 * @throws { BusinessError } 13900008 - Bad file descriptor 1553 * @throws { BusinessError } 13900011 - Out of memory 1554 * @throws { BusinessError } 13900018 - Not a directory 1555 * @throws { BusinessError } 13900042 - Unknown error 1556 * @syscap SystemCapability.FileManagement.File.FileIO 1557 * @since 9 1558 */ 1559/** 1560 * List file. 1561 * 1562 * @param { string } path - path. 1563 * @param { object } [options] - options. 1564 * @param { AsyncCallback<string[]> } callback - The callback is used to return an Array containing the name of files or directories 1565 * that meet the filter criteria in promise mode. If present, Include the subdirectory structure. 1566 * @throws { BusinessError } 13900002 - No such file or directory 1567 * @throws { BusinessError } 13900008 - Bad file descriptor 1568 * @throws { BusinessError } 13900011 - Out of memory 1569 * @throws { BusinessError } 13900018 - Not a directory 1570 * @throws { BusinessError } 13900042 - Unknown error 1571 * @syscap SystemCapability.FileManagement.File.FileIO 1572 * @crossplatform 1573 * @since 10 1574 */ 1575declare function listFile( 1576 path: string, 1577 options: { 1578 recursion?: boolean; 1579 listNum?: number; 1580 filter?: Filter; 1581 }, 1582 callback: AsyncCallback<string[]> 1583): void; 1584 1585/** 1586 * List file with sync interface. 1587 * 1588 * @param { string } path - path. 1589 * @param { object } [options] - options. 1590 * @returns { string[] } Returns an Array containing the name of files or directories that meet the filter criteria. 1591 * @throws { BusinessError } 13900002 - No such file or directory 1592 * @throws { BusinessError } 13900008 - Bad file descriptor 1593 * @throws { BusinessError } 13900011 - Out of memory 1594 * @throws { BusinessError } 13900018 - Not a directory 1595 * @throws { BusinessError } 13900042 - Unknown error 1596 * @syscap SystemCapability.FileManagement.File.FileIO 1597 * @since 9 1598 */ 1599/** 1600 * List file with sync interface. 1601 * 1602 * @param { string } path - path. 1603 * @param { object } [options] - options. 1604 * @returns { string[] } Returns an Array containing the name of files or directories that meet the filter criteria. 1605 * @throws { BusinessError } 13900002 - No such file or directory 1606 * @throws { BusinessError } 13900008 - Bad file descriptor 1607 * @throws { BusinessError } 13900011 - Out of memory 1608 * @throws { BusinessError } 13900018 - Not a directory 1609 * @throws { BusinessError } 13900042 - Unknown error 1610 * @syscap SystemCapability.FileManagement.File.FileIO 1611 * @crossplatform 1612 * @since 10 1613 */ 1614declare function listFileSync( 1615 path: string, 1616 options?: { 1617 recursion?: boolean; 1618 listNum?: number; 1619 filter?: Filter; 1620 } 1621): string[]; 1622 1623/** 1624 * Stat link file. 1625 * 1626 * @param { string } path - path. 1627 * @returns { Promise<Stat> } Returns the Stat object in promise mode. 1628 * @throws { BusinessError } 13900002 - No such file or directory 1629 * @throws { BusinessError } 13900008 - Bad file descriptor 1630 * @throws { BusinessError } 13900011 - Out of memory 1631 * @throws { BusinessError } 13900012 - Permission denied 1632 * @throws { BusinessError } 13900013 - Bad address 1633 * @throws { BusinessError } 13900018 - Not a directory 1634 * @throws { BusinessError } 13900030 - File name too long 1635 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 1636 * @throws { BusinessError } 13900038 - Value too large for defined data type 1637 * @throws { BusinessError } 13900042 - Unknown error 1638 * @syscap SystemCapability.FileManagement.File.FileIO 1639 * @since 9 1640 */ 1641declare function lstat(path: string): Promise<Stat>; 1642 1643/** 1644 * Stat link file. 1645 * 1646 * @param { string } path - path. 1647 * @param { AsyncCallback<Stat> } callback - The callback is used to return the Stat object. 1648 * @throws { BusinessError } 13900002 - No such file or directory 1649 * @throws { BusinessError } 13900008 - Bad file descriptor 1650 * @throws { BusinessError } 13900011 - Out of memory 1651 * @throws { BusinessError } 13900012 - Permission denied 1652 * @throws { BusinessError } 13900013 - Bad address 1653 * @throws { BusinessError } 13900018 - Not a directory 1654 * @throws { BusinessError } 13900030 - File name too long 1655 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 1656 * @throws { BusinessError } 13900038 - Value too large for defined data type 1657 * @throws { BusinessError } 13900042 - Unknown error 1658 * @syscap SystemCapability.FileManagement.File.FileIO 1659 * @since 9 1660 */ 1661declare function lstat(path: string, callback: AsyncCallback<Stat>): void; 1662 1663/** 1664 * Stat link file with sync interface. 1665 * 1666 * @param { string } path - path. 1667 * @returns { Stat } Returns the Stat object. 1668 * @throws { BusinessError } 13900002 - No such file or directory 1669 * @throws { BusinessError } 13900008 - Bad file descriptor 1670 * @throws { BusinessError } 13900011 - Out of memory 1671 * @throws { BusinessError } 13900012 - Permission denied 1672 * @throws { BusinessError } 13900013 - Bad address 1673 * @throws { BusinessError } 13900018 - Not a directory 1674 * @throws { BusinessError } 13900030 - File name too long 1675 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 1676 * @throws { BusinessError } 13900038 - Value too large for defined data type 1677 * @throws { BusinessError } 13900042 - Unknown error 1678 * @syscap SystemCapability.FileManagement.File.FileIO 1679 * @since 9 1680 */ 1681declare function lstatSync(path: string): Stat; 1682 1683/** 1684 * Make dir. 1685 * 1686 * @param { string } path - path. 1687 * @returns { Promise<void> } The promise returned by the function. 1688 * @throws { BusinessError } 13900001 - Operation not permitted 1689 * @throws { BusinessError } 13900002 - No such file or directory 1690 * @throws { BusinessError } 13900008 - Bad file descriptor 1691 * @throws { BusinessError } 13900011 - Out of memory 1692 * @throws { BusinessError } 13900012 - Permission denied 1693 * @throws { BusinessError } 13900013 - Bad address 1694 * @throws { BusinessError } 13900015 - File exists 1695 * @throws { BusinessError } 13900018 - Not a directory 1696 * @throws { BusinessError } 13900020 - Invalid argument 1697 * @throws { BusinessError } 13900025 - No space left on device 1698 * @throws { BusinessError } 13900028 - Too many links 1699 * @throws { BusinessError } 13900030 - File name too long 1700 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 1701 * @throws { BusinessError } 13900041 - Quota exceeded 1702 * @throws { BusinessError } 13900042 - Unknown error 1703 * @syscap SystemCapability.FileManagement.File.FileIO 1704 * @since 9 1705 */ 1706/** 1707 * Make dir. 1708 * 1709 * @param { string } path - path. 1710 * @returns { Promise<void> } The promise returned by the function. 1711 * @throws { BusinessError } 13900001 - Operation not permitted 1712 * @throws { BusinessError } 13900002 - No such file or directory 1713 * @throws { BusinessError } 13900008 - Bad file descriptor 1714 * @throws { BusinessError } 13900011 - Out of memory 1715 * @throws { BusinessError } 13900012 - Permission denied 1716 * @throws { BusinessError } 13900013 - Bad address 1717 * @throws { BusinessError } 13900015 - File exists 1718 * @throws { BusinessError } 13900018 - Not a directory 1719 * @throws { BusinessError } 13900020 - Invalid argument 1720 * @throws { BusinessError } 13900025 - No space left on device 1721 * @throws { BusinessError } 13900028 - Too many links 1722 * @throws { BusinessError } 13900030 - File name too long 1723 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 1724 * @throws { BusinessError } 13900041 - Quota exceeded 1725 * @throws { BusinessError } 13900042 - Unknown error 1726 * @syscap SystemCapability.FileManagement.File.FileIO 1727 * @crossplatform 1728 * @since 10 1729 */ 1730declare function mkdir(path: string): Promise<void>; 1731 1732/** 1733 * Make dir. 1734 * 1735 * @param { string } path - path. 1736 * @param { AsyncCallback<void> } callback - Return the callback function. 1737 * @throws { BusinessError } 13900001 - Operation not permitted 1738 * @throws { BusinessError } 13900002 - No such file or directory 1739 * @throws { BusinessError } 13900008 - Bad file descriptor 1740 * @throws { BusinessError } 13900011 - Out of memory 1741 * @throws { BusinessError } 13900012 - Permission denied 1742 * @throws { BusinessError } 13900013 - Bad address 1743 * @throws { BusinessError } 13900015 - File exists 1744 * @throws { BusinessError } 13900018 - Not a directory 1745 * @throws { BusinessError } 13900020 - Invalid argument 1746 * @throws { BusinessError } 13900025 - No space left on device 1747 * @throws { BusinessError } 13900028 - Too many links 1748 * @throws { BusinessError } 13900030 - File name too long 1749 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 1750 * @throws { BusinessError } 13900041 - Quota exceeded 1751 * @throws { BusinessError } 13900042 - Unknown error 1752 * @syscap SystemCapability.FileManagement.File.FileIO 1753 * @since 9 1754 */ 1755/** 1756 * Make dir. 1757 * 1758 * @param { string } path - path. 1759 * @param { AsyncCallback<void> } callback - Return the callback function. 1760 * @throws { BusinessError } 13900001 - Operation not permitted 1761 * @throws { BusinessError } 13900002 - No such file or directory 1762 * @throws { BusinessError } 13900008 - Bad file descriptor 1763 * @throws { BusinessError } 13900011 - Out of memory 1764 * @throws { BusinessError } 13900012 - Permission denied 1765 * @throws { BusinessError } 13900013 - Bad address 1766 * @throws { BusinessError } 13900015 - File exists 1767 * @throws { BusinessError } 13900018 - Not a directory 1768 * @throws { BusinessError } 13900020 - Invalid argument 1769 * @throws { BusinessError } 13900025 - No space left on device 1770 * @throws { BusinessError } 13900028 - Too many links 1771 * @throws { BusinessError } 13900030 - File name too long 1772 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 1773 * @throws { BusinessError } 13900041 - Quota exceeded 1774 * @throws { BusinessError } 13900042 - Unknown error 1775 * @syscap SystemCapability.FileManagement.File.FileIO 1776 * @crossplatform 1777 * @since 10 1778 */ 1779declare function mkdir(path: string, callback: AsyncCallback<void>): void; 1780 1781/** 1782 * Make dir with sync interface. 1783 * 1784 * @param { string } path - path. 1785 * @throws { BusinessError } 13900001 - Operation not permitted 1786 * @throws { BusinessError } 13900002 - No such file or directory 1787 * @throws { BusinessError } 13900008 - Bad file descriptor 1788 * @throws { BusinessError } 13900011 - Out of memory 1789 * @throws { BusinessError } 13900012 - Permission denied 1790 * @throws { BusinessError } 13900013 - Bad address 1791 * @throws { BusinessError } 13900015 - File exists 1792 * @throws { BusinessError } 13900018 - Not a directory 1793 * @throws { BusinessError } 13900020 - Invalid argument 1794 * @throws { BusinessError } 13900025 - No space left on device 1795 * @throws { BusinessError } 13900028 - Too many links 1796 * @throws { BusinessError } 13900030 - File name too long 1797 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 1798 * @throws { BusinessError } 13900041 - Quota exceeded 1799 * @throws { BusinessError } 13900042 - Unknown error 1800 * @syscap SystemCapability.FileManagement.File.FileIO 1801 * @since 9 1802 */ 1803/** 1804 * Make dir with sync interface. 1805 * 1806 * @param { string } path - path. 1807 * @throws { BusinessError } 13900001 - Operation not permitted 1808 * @throws { BusinessError } 13900002 - No such file or directory 1809 * @throws { BusinessError } 13900008 - Bad file descriptor 1810 * @throws { BusinessError } 13900011 - Out of memory 1811 * @throws { BusinessError } 13900012 - Permission denied 1812 * @throws { BusinessError } 13900013 - Bad address 1813 * @throws { BusinessError } 13900015 - File exists 1814 * @throws { BusinessError } 13900018 - Not a directory 1815 * @throws { BusinessError } 13900020 - Invalid argument 1816 * @throws { BusinessError } 13900025 - No space left on device 1817 * @throws { BusinessError } 13900028 - Too many links 1818 * @throws { BusinessError } 13900030 - File name too long 1819 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 1820 * @throws { BusinessError } 13900041 - Quota exceeded 1821 * @throws { BusinessError } 13900042 - Unknown error 1822 * @syscap SystemCapability.FileManagement.File.FileIO 1823 * @crossplatform 1824 * @since 10 1825 */ 1826declare function mkdirSync(path: string): void; 1827 1828/** 1829 * Make temp dir. 1830 * 1831 * @param { string } prefix - dir prefix. 1832 * @returns { Promise<string> } Returns the path to the new directory in promise mode. 1833 * @throws { BusinessError } 13900001 - Operation not permitted 1834 * @throws { BusinessError } 13900002 - No such file or directory 1835 * @throws { BusinessError } 13900008 - Bad file descriptor 1836 * @throws { BusinessError } 13900011 - Out of memory 1837 * @throws { BusinessError } 13900012 - Permission denied 1838 * @throws { BusinessError } 13900013 - Bad address 1839 * @throws { BusinessError } 13900015 - File exists 1840 * @throws { BusinessError } 13900018 - Not a directory 1841 * @throws { BusinessError } 13900020 - Invalid argument 1842 * @throws { BusinessError } 13900025 - No space left on device 1843 * @throws { BusinessError } 13900028 - Too many links 1844 * @throws { BusinessError } 13900030 - File name too long 1845 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 1846 * @throws { BusinessError } 13900041 - Quota exceeded 1847 * @throws { BusinessError } 13900042 - Unknown error 1848 * @syscap SystemCapability.FileManagement.File.FileIO 1849 * @since 9 1850 */ 1851/** 1852 * Make temp dir. 1853 * 1854 * @param { string } prefix - dir prefix. 1855 * @returns { Promise<string> } Returns the path to the new directory in promise mode. 1856 * @throws { BusinessError } 13900001 - Operation not permitted 1857 * @throws { BusinessError } 13900002 - No such file or directory 1858 * @throws { BusinessError } 13900008 - Bad file descriptor 1859 * @throws { BusinessError } 13900011 - Out of memory 1860 * @throws { BusinessError } 13900012 - Permission denied 1861 * @throws { BusinessError } 13900013 - Bad address 1862 * @throws { BusinessError } 13900015 - File exists 1863 * @throws { BusinessError } 13900018 - Not a directory 1864 * @throws { BusinessError } 13900020 - Invalid argument 1865 * @throws { BusinessError } 13900025 - No space left on device 1866 * @throws { BusinessError } 13900028 - Too many links 1867 * @throws { BusinessError } 13900030 - File name too long 1868 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 1869 * @throws { BusinessError } 13900041 - Quota exceeded 1870 * @throws { BusinessError } 13900042 - Unknown error 1871 * @syscap SystemCapability.FileManagement.File.FileIO 1872 * @crossplatform 1873 * @since 10 1874 */ 1875declare function mkdtemp(prefix: string): Promise<string>; 1876 1877/** 1878 * Make temp dir. 1879 * 1880 * @param { string } prefix - dir prefix. 1881 * @param { AsyncCallback<string> } callback - The callback is used to return the path to the new directory. 1882 * @throws { BusinessError } 13900001 - Operation not permitted 1883 * @throws { BusinessError } 13900002 - No such file or directory 1884 * @throws { BusinessError } 13900008 - Bad file descriptor 1885 * @throws { BusinessError } 13900011 - Out of memory 1886 * @throws { BusinessError } 13900012 - Permission denied 1887 * @throws { BusinessError } 13900013 - Bad address 1888 * @throws { BusinessError } 13900015 - File exists 1889 * @throws { BusinessError } 13900018 - Not a directory 1890 * @throws { BusinessError } 13900020 - Invalid argument 1891 * @throws { BusinessError } 13900025 - No space left on device 1892 * @throws { BusinessError } 13900028 - Too many links 1893 * @throws { BusinessError } 13900030 - File name too long 1894 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 1895 * @throws { BusinessError } 13900041 - Quota exceeded 1896 * @throws { BusinessError } 13900042 - Unknown error 1897 * @syscap SystemCapability.FileManagement.File.FileIO 1898 * @since 9 1899 */ 1900/** 1901 * Make temp dir. 1902 * 1903 * @param { string } prefix - dir prefix. 1904 * @param { AsyncCallback<string> } callback - The callback is used to return the path to the new directory. 1905 * @throws { BusinessError } 13900001 - Operation not permitted 1906 * @throws { BusinessError } 13900002 - No such file or directory 1907 * @throws { BusinessError } 13900008 - Bad file descriptor 1908 * @throws { BusinessError } 13900011 - Out of memory 1909 * @throws { BusinessError } 13900012 - Permission denied 1910 * @throws { BusinessError } 13900013 - Bad address 1911 * @throws { BusinessError } 13900015 - File exists 1912 * @throws { BusinessError } 13900018 - Not a directory 1913 * @throws { BusinessError } 13900020 - Invalid argument 1914 * @throws { BusinessError } 13900025 - No space left on device 1915 * @throws { BusinessError } 13900028 - Too many links 1916 * @throws { BusinessError } 13900030 - File name too long 1917 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 1918 * @throws { BusinessError } 13900041 - Quota exceeded 1919 * @throws { BusinessError } 13900042 - Unknown error 1920 * @syscap SystemCapability.FileManagement.File.FileIO 1921 * @crossplatform 1922 * @since 10 1923 */ 1924declare function mkdtemp(prefix: string, callback: AsyncCallback<string>): void; 1925 1926/** 1927 * Make temp dir with sync interface. 1928 * 1929 * @param { string } prefix - dir prefix. 1930 * @returns { string } Returns the path to the new directory. 1931 * @throws { BusinessError } 13900001 - Operation not permitted 1932 * @throws { BusinessError } 13900002 - No such file or directory 1933 * @throws { BusinessError } 13900008 - Bad file descriptor 1934 * @throws { BusinessError } 13900011 - Out of memory 1935 * @throws { BusinessError } 13900012 - Permission denied 1936 * @throws { BusinessError } 13900013 - Bad address 1937 * @throws { BusinessError } 13900015 - File exists 1938 * @throws { BusinessError } 13900018 - Not a directory 1939 * @throws { BusinessError } 13900020 - Invalid argument 1940 * @throws { BusinessError } 13900025 - No space left on device 1941 * @throws { BusinessError } 13900028 - Too many links 1942 * @throws { BusinessError } 13900030 - File name too long 1943 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 1944 * @throws { BusinessError } 13900041 - Quota exceeded 1945 * @throws { BusinessError } 13900042 - Unknown error 1946 * @syscap SystemCapability.FileManagement.File.FileIO 1947 * @since 9 1948 */ 1949/** 1950 * Make temp dir with sync interface. 1951 * 1952 * @param { string } prefix - dir prefix. 1953 * @returns { string } Returns the path to the new directory. 1954 * @throws { BusinessError } 13900001 - Operation not permitted 1955 * @throws { BusinessError } 13900002 - No such file or directory 1956 * @throws { BusinessError } 13900008 - Bad file descriptor 1957 * @throws { BusinessError } 13900011 - Out of memory 1958 * @throws { BusinessError } 13900012 - Permission denied 1959 * @throws { BusinessError } 13900013 - Bad address 1960 * @throws { BusinessError } 13900015 - File exists 1961 * @throws { BusinessError } 13900018 - Not a directory 1962 * @throws { BusinessError } 13900020 - Invalid argument 1963 * @throws { BusinessError } 13900025 - No space left on device 1964 * @throws { BusinessError } 13900028 - Too many links 1965 * @throws { BusinessError } 13900030 - File name too long 1966 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 1967 * @throws { BusinessError } 13900041 - Quota exceeded 1968 * @throws { BusinessError } 13900042 - Unknown error 1969 * @syscap SystemCapability.FileManagement.File.FileIO 1970 * @crossplatform 1971 * @since 10 1972 */ 1973declare function mkdtempSync(prefix: string): string; 1974 1975/** 1976 * Move directory. 1977 * 1978 * @param { string } src - source file path. 1979 * @param { string } dest - destination file path. 1980 * @param { number } [mode = 0] - move mode when duplicate file name exists. 1981 * @returns { Promise<void> } The promise returned by the function. 1982 * @throws { BusinessError } 13900001 - Operation not permitted 1983 * @throws { BusinessError } 13900002 - No such file or directory 1984 * @throws { BusinessError } 13900008 - Bad file descriptor 1985 * @throws { BusinessError } 13900011 - Out of memory 1986 * @throws { BusinessError } 13900012 - Permission denied 1987 * @throws { BusinessError } 13900013 - Bad address 1988 * @throws { BusinessError } 13900014 - Device or resource busy 1989 * @throws { BusinessError } 13900015 - File exists 1990 * @throws { BusinessError } 13900016 - Cross-device link 1991 * @throws { BusinessError } 13900018 - Not a directory 1992 * @throws { BusinessError } 13900019 - Is a directory 1993 * @throws { BusinessError } 13900020 - Invalid argument 1994 * @throws { BusinessError } 13900025 - No space left on device 1995 * @throws { BusinessError } 13900027 - Read-only file system 1996 * @throws { BusinessError } 13900028 - Too many links 1997 * @throws { BusinessError } 13900032 - Directory not empty 1998 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 1999 * @throws { BusinessError } 13900041 - Quota exceeded 2000 * @throws { BusinessError } 13900042 - Unknown error 2001 * @syscap SystemCapability.FileManagement.File.FileIO 2002 * @since 10 2003 */ 2004declare function moveDir(src: string, dest: string, mode?: number): Promise<void>; 2005 2006/** 2007 * Move directory. 2008 * 2009 * @param { string } src - source file path. 2010 * @param { string } dest - destination file path. 2011 * @param { AsyncCallback<void> } callback - Return the callback function. 2012 * @throws { BusinessError } 13900001 - Operation not permitted 2013 * @throws { BusinessError } 13900002 - No such file or directory 2014 * @throws { BusinessError } 13900008 - Bad file descriptor 2015 * @throws { BusinessError } 13900011 - Out of memory 2016 * @throws { BusinessError } 13900012 - Permission denied 2017 * @throws { BusinessError } 13900013 - Bad address 2018 * @throws { BusinessError } 13900014 - Device or resource busy 2019 * @throws { BusinessError } 13900016 - Cross-device link 2020 * @throws { BusinessError } 13900018 - Not a directory 2021 * @throws { BusinessError } 13900019 - Is a directory 2022 * @throws { BusinessError } 13900020 - Invalid argument 2023 * @throws { BusinessError } 13900025 - No space left on device 2024 * @throws { BusinessError } 13900027 - Read-only file system 2025 * @throws { BusinessError } 13900028 - Too many links 2026 * @throws { BusinessError } 13900032 - Directory not empty 2027 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 2028 * @throws { BusinessError } 13900041 - Quota exceeded 2029 * @throws { BusinessError } 13900042 - Unknown error 2030 * @syscap SystemCapability.FileManagement.File.FileIO 2031 * @since 10 2032 */ 2033declare function moveDir(src: string, dest: string, callback: AsyncCallback<void>): void; 2034 2035/** 2036 * Move directory. 2037 * 2038 * @param { string } src - source file path. 2039 * @param { string } dest - destination file path. 2040 * @param { AsyncCallback<void, Array<ConflictFiles>> } callback - Return the callback function. 2041 * @throws { BusinessError } 13900015 - File exists 2042 * @syscap SystemCapability.FileManagement.File.FileIO 2043 * @since 10 2044 */ 2045declare function moveDir(src: string, dest: string, callback: AsyncCallback<void, Array<ConflictFiles>>): void; 2046 2047/** 2048 * Move directory. 2049 * 2050 * @param { string } src - source file path. 2051 * @param { string } dest - destination file path. 2052 * @param { number } mode - move mode when duplicate file name exists. 2053 * @param { AsyncCallback<void> } callback - Return the callback function. 2054 * @throws { BusinessError } 13900001 - Operation not permitted 2055 * @throws { BusinessError } 13900002 - No such file or directory 2056 * @throws { BusinessError } 13900008 - Bad file descriptor 2057 * @throws { BusinessError } 13900011 - Out of memory 2058 * @throws { BusinessError } 13900012 - Permission denied 2059 * @throws { BusinessError } 13900013 - Bad address 2060 * @throws { BusinessError } 13900014 - Device or resource busy 2061 * @throws { BusinessError } 13900016 - Cross-device link 2062 * @throws { BusinessError } 13900018 - Not a directory 2063 * @throws { BusinessError } 13900019 - Is a directory 2064 * @throws { BusinessError } 13900020 - Invalid argument 2065 * @throws { BusinessError } 13900025 - No space left on device 2066 * @throws { BusinessError } 13900027 - Read-only file system 2067 * @throws { BusinessError } 13900028 - Too many links 2068 * @throws { BusinessError } 13900032 - Directory not empty 2069 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 2070 * @throws { BusinessError } 13900041 - Quota exceeded 2071 * @throws { BusinessError } 13900042 - Unknown error 2072 * @syscap SystemCapability.FileManagement.File.FileIO 2073 * @since 10 2074 */ 2075declare function moveDir(src: string, dest: string, mode: number, callback: AsyncCallback<void>): void; 2076 2077/** 2078 * Move directory. 2079 * 2080 * @param { string } src - source file path. 2081 * @param { string } dest - destination file path. 2082 * @param { number } mode - move mode when duplicate file name exists. 2083 * @param { AsyncCallback<void, Array<ConflictFiles>> } callback - Return the callback function. 2084 * @throws { BusinessError } 13900015 - File exists 2085 * @syscap SystemCapability.FileManagement.File.FileIO 2086 * @since 10 2087 */ 2088declare function moveDir(src: string, dest: string, mode: number, callback: AsyncCallback<void, Array<ConflictFiles>>): void; 2089 2090/** 2091 * Move directory with sync interface. 2092 * 2093 * @param { string } src - source file path. 2094 * @param { string } dest - destination file path. 2095 * @param { number } [mode = 0] - move mode when duplicate file name exists. 2096 * @throws { BusinessError } 13900001 - Operation not permitted 2097 * @throws { BusinessError } 13900002 - No such file or directory 2098 * @throws { BusinessError } 13900008 - Bad file descriptor 2099 * @throws { BusinessError } 13900011 - Out of memory 2100 * @throws { BusinessError } 13900012 - Permission denied 2101 * @throws { BusinessError } 13900013 - Bad address 2102 * @throws { BusinessError } 13900014 - Device or resource busy 2103 * @throws { BusinessError } 13900015 - File exists 2104 * @throws { BusinessError } 13900016 - Cross-device link 2105 * @throws { BusinessError } 13900018 - Not a directory 2106 * @throws { BusinessError } 13900019 - Is a directory 2107 * @throws { BusinessError } 13900020 - Invalid argument 2108 * @throws { BusinessError } 13900025 - No space left on device 2109 * @throws { BusinessError } 13900027 - Read-only file system 2110 * @throws { BusinessError } 13900028 - Too many links 2111 * @throws { BusinessError } 13900032 - Directory not empty 2112 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 2113 * @throws { BusinessError } 13900041 - Quota exceeded 2114 * @throws { BusinessError } 13900042 - Unknown error 2115 * @syscap SystemCapability.FileManagement.File.FileIO 2116 * @since 10 2117 */ 2118declare function moveDirSync(src: string, dest: string, mode?: number): void; 2119 2120/** 2121 * Move file. 2122 * 2123 * @param { string } src - source file path. 2124 * @param { string } dest - destination file path. 2125 * @param { number } [mode = 0] - move mode when duplicate file name exists. 2126 * @returns { Promise<void> } The promise returned by the function. 2127 * @throws { BusinessError } 13900001 - Operation not permitted 2128 * @throws { BusinessError } 13900002 - No such file or directory 2129 * @throws { BusinessError } 13900008 - Bad file descriptor 2130 * @throws { BusinessError } 13900011 - Out of memory 2131 * @throws { BusinessError } 13900012 - Permission denied 2132 * @throws { BusinessError } 13900013 - Bad address 2133 * @throws { BusinessError } 13900014 - Device or resource busy 2134 * @throws { BusinessError } 13900015 - File exists 2135 * @throws { BusinessError } 13900016 - Cross-device link 2136 * @throws { BusinessError } 13900018 - Not a directory 2137 * @throws { BusinessError } 13900019 - Is a directory 2138 * @throws { BusinessError } 13900020 - Invalid argument 2139 * @throws { BusinessError } 13900025 - No space left on device 2140 * @throws { BusinessError } 13900027 - Read-only file system 2141 * @throws { BusinessError } 13900028 - Too many links 2142 * @throws { BusinessError } 13900032 - Directory not empty 2143 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 2144 * @throws { BusinessError } 13900041 - Quota exceeded 2145 * @throws { BusinessError } 13900042 - Unknown error 2146 * @syscap SystemCapability.FileManagement.File.FileIO 2147 * @since 9 2148 */ 2149/** 2150 * Move file. 2151 * 2152 * @param { string } src - source file path. 2153 * @param { string } dest - destination file path. 2154 * @param { number } [mode = 0] - move mode when duplicate file name exists. 2155 * @returns { Promise<void> } The promise returned by the function. 2156 * @throws { BusinessError } 13900001 - Operation not permitted 2157 * @throws { BusinessError } 13900002 - No such file or directory 2158 * @throws { BusinessError } 13900008 - Bad file descriptor 2159 * @throws { BusinessError } 13900011 - Out of memory 2160 * @throws { BusinessError } 13900012 - Permission denied 2161 * @throws { BusinessError } 13900013 - Bad address 2162 * @throws { BusinessError } 13900014 - Device or resource busy 2163 * @throws { BusinessError } 13900015 - File exists 2164 * @throws { BusinessError } 13900016 - Cross-device link 2165 * @throws { BusinessError } 13900018 - Not a directory 2166 * @throws { BusinessError } 13900019 - Is a directory 2167 * @throws { BusinessError } 13900020 - Invalid argument 2168 * @throws { BusinessError } 13900025 - No space left on device 2169 * @throws { BusinessError } 13900027 - Read-only file system 2170 * @throws { BusinessError } 13900028 - Too many links 2171 * @throws { BusinessError } 13900032 - Directory not empty 2172 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 2173 * @throws { BusinessError } 13900041 - Quota exceeded 2174 * @throws { BusinessError } 13900042 - Unknown error 2175 * @syscap SystemCapability.FileManagement.File.FileIO 2176 * @crossplatform 2177 * @since 10 2178 */ 2179declare function moveFile(src: string, dest: string, mode?: number): Promise<void>; 2180 2181/** 2182 * Move file. 2183 * 2184 * @param { string } src - source file path. 2185 * @param { string } dest - destination file path. 2186 * @param { AsyncCallback<void> } callback - Return the callback function. 2187 * @throws { BusinessError } 13900001 - Operation not permitted 2188 * @throws { BusinessError } 13900002 - No such file or directory 2189 * @throws { BusinessError } 13900008 - Bad file descriptor 2190 * @throws { BusinessError } 13900011 - Out of memory 2191 * @throws { BusinessError } 13900012 - Permission denied 2192 * @throws { BusinessError } 13900013 - Bad address 2193 * @throws { BusinessError } 13900014 - Device or resource busy 2194 * @throws { BusinessError } 13900015 - File exists 2195 * @throws { BusinessError } 13900016 - Cross-device link 2196 * @throws { BusinessError } 13900018 - Not a directory 2197 * @throws { BusinessError } 13900019 - Is a directory 2198 * @throws { BusinessError } 13900020 - Invalid argument 2199 * @throws { BusinessError } 13900025 - No space left on device 2200 * @throws { BusinessError } 13900027 - Read-only file system 2201 * @throws { BusinessError } 13900028 - Too many links 2202 * @throws { BusinessError } 13900032 - Directory not empty 2203 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 2204 * @throws { BusinessError } 13900041 - Quota exceeded 2205 * @throws { BusinessError } 13900042 - Unknown error 2206 * @syscap SystemCapability.FileManagement.File.FileIO 2207 * @since 9 2208 */ 2209/** 2210 * Move file. 2211 * 2212 * @param { string } src - source file path. 2213 * @param { string } dest - destination file path. 2214 * @param { AsyncCallback<void> } callback - Return the callback function. 2215 * @throws { BusinessError } 13900001 - Operation not permitted 2216 * @throws { BusinessError } 13900002 - No such file or directory 2217 * @throws { BusinessError } 13900008 - Bad file descriptor 2218 * @throws { BusinessError } 13900011 - Out of memory 2219 * @throws { BusinessError } 13900012 - Permission denied 2220 * @throws { BusinessError } 13900013 - Bad address 2221 * @throws { BusinessError } 13900014 - Device or resource busy 2222 * @throws { BusinessError } 13900015 - File exists 2223 * @throws { BusinessError } 13900016 - Cross-device link 2224 * @throws { BusinessError } 13900018 - Not a directory 2225 * @throws { BusinessError } 13900019 - Is a directory 2226 * @throws { BusinessError } 13900020 - Invalid argument 2227 * @throws { BusinessError } 13900025 - No space left on device 2228 * @throws { BusinessError } 13900027 - Read-only file system 2229 * @throws { BusinessError } 13900028 - Too many links 2230 * @throws { BusinessError } 13900032 - Directory not empty 2231 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 2232 * @throws { BusinessError } 13900041 - Quota exceeded 2233 * @throws { BusinessError } 13900042 - Unknown error 2234 * @syscap SystemCapability.FileManagement.File.FileIO 2235 * @crossplatform 2236 * @since 10 2237 */ 2238declare function moveFile(src: string, dest: string, callback: AsyncCallback<void>): void; 2239 2240/** 2241 * Move file. 2242 * 2243 * @param { string } src - source file path. 2244 * @param { string } dest - destination file path. 2245 * @param { number } [mode = 0] - move mode when duplicate file name exists. 2246 * @param { AsyncCallback<void> } callback - Return the callback function. 2247 * @throws { BusinessError } 13900001 - Operation not permitted 2248 * @throws { BusinessError } 13900002 - No such file or directory 2249 * @throws { BusinessError } 13900008 - Bad file descriptor 2250 * @throws { BusinessError } 13900011 - Out of memory 2251 * @throws { BusinessError } 13900012 - Permission denied 2252 * @throws { BusinessError } 13900013 - Bad address 2253 * @throws { BusinessError } 13900014 - Device or resource busy 2254 * @throws { BusinessError } 13900015 - File exists 2255 * @throws { BusinessError } 13900016 - Cross-device link 2256 * @throws { BusinessError } 13900018 - Not a directory 2257 * @throws { BusinessError } 13900019 - Is a directory 2258 * @throws { BusinessError } 13900020 - Invalid argument 2259 * @throws { BusinessError } 13900025 - No space left on device 2260 * @throws { BusinessError } 13900027 - Read-only file system 2261 * @throws { BusinessError } 13900028 - Too many links 2262 * @throws { BusinessError } 13900032 - Directory not empty 2263 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 2264 * @throws { BusinessError } 13900041 - Quota exceeded 2265 * @throws { BusinessError } 13900042 - Unknown error 2266 * @syscap SystemCapability.FileManagement.File.FileIO 2267 * @since 9 2268 */ 2269/** 2270 * Move file. 2271 * 2272 * @param { string } src - source file path. 2273 * @param { string } dest - destination file path. 2274 * @param { number } [mode = 0] - move mode when duplicate file name exists. 2275 * @param { AsyncCallback<void> } callback - Return the callback 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 } 13900014 - Device or resource busy 2283 * @throws { BusinessError } 13900015 - File exists 2284 * @throws { BusinessError } 13900016 - Cross-device link 2285 * @throws { BusinessError } 13900018 - Not a directory 2286 * @throws { BusinessError } 13900019 - Is a directory 2287 * @throws { BusinessError } 13900020 - Invalid argument 2288 * @throws { BusinessError } 13900025 - No space left on device 2289 * @throws { BusinessError } 13900027 - Read-only file system 2290 * @throws { BusinessError } 13900028 - Too many links 2291 * @throws { BusinessError } 13900032 - Directory not empty 2292 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 2293 * @throws { BusinessError } 13900041 - Quota exceeded 2294 * @throws { BusinessError } 13900042 - Unknown error 2295 * @syscap SystemCapability.FileManagement.File.FileIO 2296 * @crossplatform 2297 * @since 10 2298 */ 2299declare function moveFile(src: string, dest: string, mode: number, callback: AsyncCallback<void>): void; 2300 2301/** 2302 * Move file with sync interface. 2303 * 2304 * @param { string } src - source file path. 2305 * @param { string } dest - destination file path. 2306 * @param { number } [mode = 0] - move mode when duplicate file name exists. 2307 * @throws { BusinessError } 13900001 - Operation not permitted 2308 * @throws { BusinessError } 13900002 - No such file or directory 2309 * @throws { BusinessError } 13900008 - Bad file descriptor 2310 * @throws { BusinessError } 13900011 - Out of memory 2311 * @throws { BusinessError } 13900012 - Permission denied 2312 * @throws { BusinessError } 13900013 - Bad address 2313 * @throws { BusinessError } 13900014 - Device or resource busy 2314 * @throws { BusinessError } 13900015 - File exists 2315 * @throws { BusinessError } 13900016 - Cross-device link 2316 * @throws { BusinessError } 13900018 - Not a directory 2317 * @throws { BusinessError } 13900019 - Is a directory 2318 * @throws { BusinessError } 13900020 - Invalid argument 2319 * @throws { BusinessError } 13900025 - No space left on device 2320 * @throws { BusinessError } 13900027 - Read-only file system 2321 * @throws { BusinessError } 13900028 - Too many links 2322 * @throws { BusinessError } 13900032 - Directory not empty 2323 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 2324 * @throws { BusinessError } 13900041 - Quota exceeded 2325 * @throws { BusinessError } 13900042 - Unknown error 2326 * @syscap SystemCapability.FileManagement.File.FileIO 2327 * @since 9 2328 */ 2329/** 2330 * Move file with sync interface. 2331 * 2332 * @param { string } src - source file path. 2333 * @param { string } dest - destination file path. 2334 * @param { number } [mode = 0] - move mode when duplicate file name exists. 2335 * @throws { BusinessError } 13900001 - Operation not permitted 2336 * @throws { BusinessError } 13900002 - No such file or directory 2337 * @throws { BusinessError } 13900008 - Bad file descriptor 2338 * @throws { BusinessError } 13900011 - Out of memory 2339 * @throws { BusinessError } 13900012 - Permission denied 2340 * @throws { BusinessError } 13900013 - Bad address 2341 * @throws { BusinessError } 13900014 - Device or resource busy 2342 * @throws { BusinessError } 13900015 - File exists 2343 * @throws { BusinessError } 13900016 - Cross-device link 2344 * @throws { BusinessError } 13900018 - Not a directory 2345 * @throws { BusinessError } 13900019 - Is a directory 2346 * @throws { BusinessError } 13900020 - Invalid argument 2347 * @throws { BusinessError } 13900025 - No space left on device 2348 * @throws { BusinessError } 13900027 - Read-only file system 2349 * @throws { BusinessError } 13900028 - Too many links 2350 * @throws { BusinessError } 13900032 - Directory not empty 2351 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 2352 * @throws { BusinessError } 13900041 - Quota exceeded 2353 * @throws { BusinessError } 13900042 - Unknown error 2354 * @syscap SystemCapability.FileManagement.File.FileIO 2355 * @crossplatform 2356 * @since 10 2357 */ 2358declare function moveFileSync(src: string, dest: string, mode?: number): void; 2359 2360/** 2361 * Open file. 2362 * 2363 * @param { string } path - path. 2364 * @param { number } [mode = OpenMode.READ_ONLY] - mode. 2365 * @returns { Promise<File> } Returns the File object in Promise mode to record the file descriptor. 2366 * @throws { BusinessError } 13900001 - Operation not permitted 2367 * @throws { BusinessError } 13900002 - No such file or directory 2368 * @throws { BusinessError } 13900004 - Interrupted system call 2369 * @throws { BusinessError } 13900006 - No such device or address 2370 * @throws { BusinessError } 13900008 - Bad file descriptor 2371 * @throws { BusinessError } 13900011 - Out of memory 2372 * @throws { BusinessError } 13900012 - Permission denied 2373 * @throws { BusinessError } 13900013 - Bad address 2374 * @throws { BusinessError } 13900014 - Device or resource busy 2375 * @throws { BusinessError } 13900015 - File exists 2376 * @throws { BusinessError } 13900017 - No such device 2377 * @throws { BusinessError } 13900018 - Not a directory 2378 * @throws { BusinessError } 13900019 - Is a directory 2379 * @throws { BusinessError } 13900020 - Invalid argument 2380 * @throws { BusinessError } 13900022 - Too many open files 2381 * @throws { BusinessError } 13900023 - Text file busy 2382 * @throws { BusinessError } 13900024 - File too large 2383 * @throws { BusinessError } 13900025 - No space left on device 2384 * @throws { BusinessError } 13900027 - Read-only file system 2385 * @throws { BusinessError } 13900029 - Resource deadlock would occur 2386 * @throws { BusinessError } 13900030 - File name too long 2387 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 2388 * @throws { BusinessError } 13900034 - Operation would block 2389 * @throws { BusinessError } 13900038 - Value too large for defined data type 2390 * @throws { BusinessError } 13900041 - Quota exceeded 2391 * @throws { BusinessError } 13900042 - Unknown error 2392 * @syscap SystemCapability.FileManagement.File.FileIO 2393 * @since 9 2394 */ 2395/** 2396 * Open file. 2397 * 2398 * @param { string } path - path. 2399 * @param { number } [mode = OpenMode.READ_ONLY] - mode. 2400 * @returns { Promise<File> } Returns the File object in Promise mode to record the file descriptor. 2401 * @throws { BusinessError } 13900001 - Operation not permitted 2402 * @throws { BusinessError } 13900002 - No such file or directory 2403 * @throws { BusinessError } 13900004 - Interrupted system call 2404 * @throws { BusinessError } 13900006 - No such device or address 2405 * @throws { BusinessError } 13900008 - Bad file descriptor 2406 * @throws { BusinessError } 13900011 - Out of memory 2407 * @throws { BusinessError } 13900012 - Permission denied 2408 * @throws { BusinessError } 13900013 - Bad address 2409 * @throws { BusinessError } 13900014 - Device or resource busy 2410 * @throws { BusinessError } 13900015 - File exists 2411 * @throws { BusinessError } 13900017 - No such device 2412 * @throws { BusinessError } 13900018 - Not a directory 2413 * @throws { BusinessError } 13900019 - Is a directory 2414 * @throws { BusinessError } 13900020 - Invalid argument 2415 * @throws { BusinessError } 13900022 - Too many open files 2416 * @throws { BusinessError } 13900023 - Text file busy 2417 * @throws { BusinessError } 13900024 - File too large 2418 * @throws { BusinessError } 13900025 - No space left on device 2419 * @throws { BusinessError } 13900027 - Read-only file system 2420 * @throws { BusinessError } 13900029 - Resource deadlock would occur 2421 * @throws { BusinessError } 13900030 - File name too long 2422 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 2423 * @throws { BusinessError } 13900034 - Operation would block 2424 * @throws { BusinessError } 13900038 - Value too large for defined data type 2425 * @throws { BusinessError } 13900041 - Quota exceeded 2426 * @throws { BusinessError } 13900042 - Unknown error 2427 * @syscap SystemCapability.FileManagement.File.FileIO 2428 * @crossplatform 2429 * @since 10 2430 */ 2431declare function open(path: string, mode?: number): Promise<File>; 2432 2433/** 2434 * Open file. 2435 * 2436 * @param { string } path - path. 2437 * @param { AsyncCallback<File> } callback - The callback is used to return the File object to record the file descriptor. 2438 * @throws { BusinessError } 13900001 - Operation not permitted 2439 * @throws { BusinessError } 13900002 - No such file or directory 2440 * @throws { BusinessError } 13900004 - Interrupted system call 2441 * @throws { BusinessError } 13900006 - No such device or address 2442 * @throws { BusinessError } 13900008 - Bad file descriptor 2443 * @throws { BusinessError } 13900011 - Out of memory 2444 * @throws { BusinessError } 13900012 - Permission denied 2445 * @throws { BusinessError } 13900013 - Bad address 2446 * @throws { BusinessError } 13900014 - Device or resource busy 2447 * @throws { BusinessError } 13900015 - File exists 2448 * @throws { BusinessError } 13900017 - No such device 2449 * @throws { BusinessError } 13900018 - Not a directory 2450 * @throws { BusinessError } 13900019 - Is a directory 2451 * @throws { BusinessError } 13900020 - Invalid argument 2452 * @throws { BusinessError } 13900022 - Too many open files 2453 * @throws { BusinessError } 13900023 - Text file busy 2454 * @throws { BusinessError } 13900024 - File too large 2455 * @throws { BusinessError } 13900025 - No space left on device 2456 * @throws { BusinessError } 13900027 - Read-only file system 2457 * @throws { BusinessError } 13900029 - Resource deadlock would occur 2458 * @throws { BusinessError } 13900030 - File name too long 2459 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 2460 * @throws { BusinessError } 13900034 - Operation would block 2461 * @throws { BusinessError } 13900038 - Value too large for defined data type 2462 * @throws { BusinessError } 13900041 - Quota exceeded 2463 * @throws { BusinessError } 13900042 - Unknown error 2464 * @syscap SystemCapability.FileManagement.File.FileIO 2465 * @since 9 2466 */ 2467/** 2468 * Open file. 2469 * 2470 * @param { string } path - path. 2471 * @param { AsyncCallback<File> } callback - The callback is used to return the File object to record the file descriptor. 2472 * @throws { BusinessError } 13900001 - Operation not permitted 2473 * @throws { BusinessError } 13900002 - No such file or directory 2474 * @throws { BusinessError } 13900004 - Interrupted system call 2475 * @throws { BusinessError } 13900006 - No such device or address 2476 * @throws { BusinessError } 13900008 - Bad file descriptor 2477 * @throws { BusinessError } 13900011 - Out of memory 2478 * @throws { BusinessError } 13900012 - Permission denied 2479 * @throws { BusinessError } 13900013 - Bad address 2480 * @throws { BusinessError } 13900014 - Device or resource busy 2481 * @throws { BusinessError } 13900015 - File exists 2482 * @throws { BusinessError } 13900017 - No such device 2483 * @throws { BusinessError } 13900018 - Not a directory 2484 * @throws { BusinessError } 13900019 - Is a directory 2485 * @throws { BusinessError } 13900020 - Invalid argument 2486 * @throws { BusinessError } 13900022 - Too many open files 2487 * @throws { BusinessError } 13900023 - Text file busy 2488 * @throws { BusinessError } 13900024 - File too large 2489 * @throws { BusinessError } 13900025 - No space left on device 2490 * @throws { BusinessError } 13900027 - Read-only file system 2491 * @throws { BusinessError } 13900029 - Resource deadlock would occur 2492 * @throws { BusinessError } 13900030 - File name too long 2493 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 2494 * @throws { BusinessError } 13900034 - Operation would block 2495 * @throws { BusinessError } 13900038 - Value too large for defined data type 2496 * @throws { BusinessError } 13900041 - Quota exceeded 2497 * @throws { BusinessError } 13900042 - Unknown error 2498 * @syscap SystemCapability.FileManagement.File.FileIO 2499 * @crossplatform 2500 * @since 10 2501 */ 2502declare function open(path: string, callback: AsyncCallback<File>): void; 2503 2504/** 2505 * Open file. 2506 * 2507 * @param { string } path - path. 2508 * @param { number } [mode = OpenMode.READ_ONLY] - mode. 2509 * @param { AsyncCallback<File> } callback - The callback is used to return the File object to record the file descriptor. 2510 * @throws { BusinessError } 13900001 - Operation not permitted 2511 * @throws { BusinessError } 13900002 - No such file or directory 2512 * @throws { BusinessError } 13900004 - Interrupted system call 2513 * @throws { BusinessError } 13900006 - No such device or address 2514 * @throws { BusinessError } 13900008 - Bad file descriptor 2515 * @throws { BusinessError } 13900011 - Out of memory 2516 * @throws { BusinessError } 13900012 - Permission denied 2517 * @throws { BusinessError } 13900013 - Bad address 2518 * @throws { BusinessError } 13900014 - Device or resource busy 2519 * @throws { BusinessError } 13900015 - File exists 2520 * @throws { BusinessError } 13900017 - No such device 2521 * @throws { BusinessError } 13900018 - Not a directory 2522 * @throws { BusinessError } 13900019 - Is a directory 2523 * @throws { BusinessError } 13900020 - Invalid argument 2524 * @throws { BusinessError } 13900022 - Too many open files 2525 * @throws { BusinessError } 13900023 - Text file busy 2526 * @throws { BusinessError } 13900024 - File too large 2527 * @throws { BusinessError } 13900025 - No space left on device 2528 * @throws { BusinessError } 13900027 - Read-only file system 2529 * @throws { BusinessError } 13900029 - Resource deadlock would occur 2530 * @throws { BusinessError } 13900030 - File name too long 2531 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 2532 * @throws { BusinessError } 13900034 - Operation would block 2533 * @throws { BusinessError } 13900038 - Value too large for defined data type 2534 * @throws { BusinessError } 13900041 - Quota exceeded 2535 * @throws { BusinessError } 13900042 - Unknown error 2536 * @syscap SystemCapability.FileManagement.File.FileIO 2537 * @since 9 2538 */ 2539/** 2540 * Open file. 2541 * 2542 * @param { string } path - path. 2543 * @param { number } [mode = OpenMode.READ_ONLY] - mode. 2544 * @param { AsyncCallback<File> } callback - The callback is used to return the File object to record the file descriptor. 2545 * @throws { BusinessError } 13900001 - Operation not permitted 2546 * @throws { BusinessError } 13900002 - No such file or directory 2547 * @throws { BusinessError } 13900004 - Interrupted system call 2548 * @throws { BusinessError } 13900006 - No such device or address 2549 * @throws { BusinessError } 13900008 - Bad file descriptor 2550 * @throws { BusinessError } 13900011 - Out of memory 2551 * @throws { BusinessError } 13900012 - Permission denied 2552 * @throws { BusinessError } 13900013 - Bad address 2553 * @throws { BusinessError } 13900014 - Device or resource busy 2554 * @throws { BusinessError } 13900015 - File exists 2555 * @throws { BusinessError } 13900017 - No such device 2556 * @throws { BusinessError } 13900018 - Not a directory 2557 * @throws { BusinessError } 13900019 - Is a directory 2558 * @throws { BusinessError } 13900020 - Invalid argument 2559 * @throws { BusinessError } 13900022 - Too many open files 2560 * @throws { BusinessError } 13900023 - Text file busy 2561 * @throws { BusinessError } 13900024 - File too large 2562 * @throws { BusinessError } 13900025 - No space left on device 2563 * @throws { BusinessError } 13900027 - Read-only file system 2564 * @throws { BusinessError } 13900029 - Resource deadlock would occur 2565 * @throws { BusinessError } 13900030 - File name too long 2566 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 2567 * @throws { BusinessError } 13900034 - Operation would block 2568 * @throws { BusinessError } 13900038 - Value too large for defined data type 2569 * @throws { BusinessError } 13900041 - Quota exceeded 2570 * @throws { BusinessError } 13900042 - Unknown error 2571 * @syscap SystemCapability.FileManagement.File.FileIO 2572 * @crossplatform 2573 * @since 10 2574 */ 2575declare function open(path: string, mode: number, callback: AsyncCallback<File>): void; 2576 2577/** 2578 * Open file with sync interface. 2579 * 2580 * @param { string } path - path. 2581 * @param { number } [mode = OpenMode.READ_ONLY] - mode. 2582 * @returns { File } Returns the File object to record the file descriptor. 2583 * @throws { BusinessError } 13900001 - Operation not permitted 2584 * @throws { BusinessError } 13900002 - No such file or directory 2585 * @throws { BusinessError } 13900004 - Interrupted system call 2586 * @throws { BusinessError } 13900006 - No such device or address 2587 * @throws { BusinessError } 13900008 - Bad file descriptor 2588 * @throws { BusinessError } 13900011 - Out of memory 2589 * @throws { BusinessError } 13900012 - Permission denied 2590 * @throws { BusinessError } 13900013 - Bad address 2591 * @throws { BusinessError } 13900014 - Device or resource busy 2592 * @throws { BusinessError } 13900015 - File exists 2593 * @throws { BusinessError } 13900017 - No such device 2594 * @throws { BusinessError } 13900018 - Not a directory 2595 * @throws { BusinessError } 13900019 - Is a directory 2596 * @throws { BusinessError } 13900020 - Invalid argument 2597 * @throws { BusinessError } 13900022 - Too many open files 2598 * @throws { BusinessError } 13900023 - Text file busy 2599 * @throws { BusinessError } 13900024 - File too large 2600 * @throws { BusinessError } 13900025 - No space left on device 2601 * @throws { BusinessError } 13900027 - Read-only file system 2602 * @throws { BusinessError } 13900029 - Resource deadlock would occur 2603 * @throws { BusinessError } 13900030 - File name too long 2604 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 2605 * @throws { BusinessError } 13900034 - Operation would block 2606 * @throws { BusinessError } 13900038 - Value too large for defined data type 2607 * @throws { BusinessError } 13900041 - Quota exceeded 2608 * @throws { BusinessError } 13900042 - Unknown error 2609 * @syscap SystemCapability.FileManagement.File.FileIO 2610 * @since 9 2611 */ 2612/** 2613 * Open file with sync interface. 2614 * 2615 * @param { string } path - path. 2616 * @param { number } [mode = OpenMode.READ_ONLY] - mode. 2617 * @returns { File } Returns the File object to record the file descriptor. 2618 * @throws { BusinessError } 13900001 - Operation not permitted 2619 * @throws { BusinessError } 13900002 - No such file or directory 2620 * @throws { BusinessError } 13900004 - Interrupted system call 2621 * @throws { BusinessError } 13900006 - No such device or address 2622 * @throws { BusinessError } 13900008 - Bad file descriptor 2623 * @throws { BusinessError } 13900011 - Out of memory 2624 * @throws { BusinessError } 13900012 - Permission denied 2625 * @throws { BusinessError } 13900013 - Bad address 2626 * @throws { BusinessError } 13900014 - Device or resource busy 2627 * @throws { BusinessError } 13900015 - File exists 2628 * @throws { BusinessError } 13900017 - No such device 2629 * @throws { BusinessError } 13900018 - Not a directory 2630 * @throws { BusinessError } 13900019 - Is a directory 2631 * @throws { BusinessError } 13900020 - Invalid argument 2632 * @throws { BusinessError } 13900022 - Too many open files 2633 * @throws { BusinessError } 13900023 - Text file busy 2634 * @throws { BusinessError } 13900024 - File too large 2635 * @throws { BusinessError } 13900025 - No space left on device 2636 * @throws { BusinessError } 13900027 - Read-only file system 2637 * @throws { BusinessError } 13900029 - Resource deadlock would occur 2638 * @throws { BusinessError } 13900030 - File name too long 2639 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 2640 * @throws { BusinessError } 13900034 - Operation would block 2641 * @throws { BusinessError } 13900038 - Value too large for defined data type 2642 * @throws { BusinessError } 13900041 - Quota exceeded 2643 * @throws { BusinessError } 13900042 - Unknown error 2644 * @syscap SystemCapability.FileManagement.File.FileIO 2645 * @crossplatform 2646 * @since 10 2647 */ 2648declare function openSync(path: string, mode?: number): File; 2649 2650/** 2651 * Read file. 2652 * 2653 * @param { number } fd - file descriptor. 2654 * @param { ArrayBuffer } buffer - buffer. 2655 * @param { object } [options] - options. 2656 * @returns { Promise<number> } Returns the number of file bytes read to buffer in promise mode. 2657 * @throws { BusinessError } 13900004 - Interrupted system call 2658 * @throws { BusinessError } 13900005 - I/O error 2659 * @throws { BusinessError } 13900008 - Bad file descriptor 2660 * @throws { BusinessError } 13900010 - Try again 2661 * @throws { BusinessError } 13900013 - Bad address 2662 * @throws { BusinessError } 13900019 - Is a directory 2663 * @throws { BusinessError } 13900020 - Invalid argument 2664 * @throws { BusinessError } 13900034 - Operation would block 2665 * @throws { BusinessError } 13900042 - Unknown error 2666 * @syscap SystemCapability.FileManagement.File.FileIO 2667 * @since 9 2668 */ 2669/** 2670 * Read file. 2671 * 2672 * @param { number } fd - file descriptor. 2673 * @param { ArrayBuffer } buffer - buffer. 2674 * @param { object } [options] - options. 2675 * @returns { Promise<number> } Returns the number of file bytes read to buffer in promise mode. 2676 * @throws { BusinessError } 13900004 - Interrupted system call 2677 * @throws { BusinessError } 13900005 - I/O error 2678 * @throws { BusinessError } 13900008 - Bad file descriptor 2679 * @throws { BusinessError } 13900010 - Try again 2680 * @throws { BusinessError } 13900013 - Bad address 2681 * @throws { BusinessError } 13900019 - Is a directory 2682 * @throws { BusinessError } 13900020 - Invalid argument 2683 * @throws { BusinessError } 13900034 - Operation would block 2684 * @throws { BusinessError } 13900042 - Unknown error 2685 * @syscap SystemCapability.FileManagement.File.FileIO 2686 * @crossplatform 2687 * @since 10 2688 */ 2689declare function read( 2690 fd: number, 2691 buffer: ArrayBuffer, 2692 options?: { 2693 offset?: number; 2694 length?: number; 2695 } 2696): Promise<number>; 2697 2698/** 2699 * Read file. 2700 * 2701 * @param { number } fd - file descriptor. 2702 * @param { ArrayBuffer } buffer - buffer. 2703 * @param { AsyncCallback<number> } callback - The callback is used to return the number of file bytes read to buffer. 2704 * @throws { BusinessError } 13900004 - Interrupted system call 2705 * @throws { BusinessError } 13900005 - I/O error 2706 * @throws { BusinessError } 13900008 - Bad file descriptor 2707 * @throws { BusinessError } 13900010 - Try again 2708 * @throws { BusinessError } 13900013 - Bad address 2709 * @throws { BusinessError } 13900019 - Is a directory 2710 * @throws { BusinessError } 13900020 - Invalid argument 2711 * @throws { BusinessError } 13900034 - Operation would block 2712 * @throws { BusinessError } 13900042 - Unknown error 2713 * @syscap SystemCapability.FileManagement.File.FileIO 2714 * @since 9 2715 */ 2716/** 2717 * Read file. 2718 * 2719 * @param { number } fd - file descriptor. 2720 * @param { ArrayBuffer } buffer - buffer. 2721 * @param { AsyncCallback<number> } callback - The callback is used to return the number of file bytes read to buffer. 2722 * @throws { BusinessError } 13900004 - Interrupted system call 2723 * @throws { BusinessError } 13900005 - I/O error 2724 * @throws { BusinessError } 13900008 - Bad file descriptor 2725 * @throws { BusinessError } 13900010 - Try again 2726 * @throws { BusinessError } 13900013 - Bad address 2727 * @throws { BusinessError } 13900019 - Is a directory 2728 * @throws { BusinessError } 13900020 - Invalid argument 2729 * @throws { BusinessError } 13900034 - Operation would block 2730 * @throws { BusinessError } 13900042 - Unknown error 2731 * @syscap SystemCapability.FileManagement.File.FileIO 2732 * @crossplatform 2733 * @since 10 2734 */ 2735declare function read(fd: number, buffer: ArrayBuffer, callback: AsyncCallback<number>): void; 2736 2737/** 2738 * Read file. 2739 * 2740 * @param { number } fd - file descriptor. 2741 * @param { ArrayBuffer } buffer - buffer. 2742 * @param { object } [options] - options. 2743 * @param { AsyncCallback<number> } callback - The callback is used to return the number of file bytes read to buffer. 2744 * @throws { BusinessError } 13900004 - Interrupted system call 2745 * @throws { BusinessError } 13900005 - I/O error 2746 * @throws { BusinessError } 13900008 - Bad file descriptor 2747 * @throws { BusinessError } 13900010 - Try again 2748 * @throws { BusinessError } 13900013 - Bad address 2749 * @throws { BusinessError } 13900019 - Is a directory 2750 * @throws { BusinessError } 13900020 - Invalid argument 2751 * @throws { BusinessError } 13900034 - Operation would block 2752 * @throws { BusinessError } 13900042 - Unknown error 2753 * @syscap SystemCapability.FileManagement.File.FileIO 2754 * @since 9 2755 */ 2756/** 2757 * Read file. 2758 * 2759 * @param { number } fd - file descriptor. 2760 * @param { ArrayBuffer } buffer - buffer. 2761 * @param { object } [options] - options. 2762 * @param { AsyncCallback<number> } callback - The callback is used to return the number of file bytes read to buffer. 2763 * @throws { BusinessError } 13900004 - Interrupted system call 2764 * @throws { BusinessError } 13900005 - I/O error 2765 * @throws { BusinessError } 13900008 - Bad file descriptor 2766 * @throws { BusinessError } 13900010 - Try again 2767 * @throws { BusinessError } 13900013 - Bad address 2768 * @throws { BusinessError } 13900019 - Is a directory 2769 * @throws { BusinessError } 13900020 - Invalid argument 2770 * @throws { BusinessError } 13900034 - Operation would block 2771 * @throws { BusinessError } 13900042 - Unknown error 2772 * @syscap SystemCapability.FileManagement.File.FileIO 2773 * @crossplatform 2774 * @since 10 2775 */ 2776declare function read( 2777 fd: number, 2778 buffer: ArrayBuffer, 2779 options: { 2780 offset?: number; 2781 length?: number; 2782 }, 2783 callback: AsyncCallback<number> 2784): void; 2785 2786/** 2787 * Read file with sync interface. 2788 * 2789 * @param { number } fd - file descriptor. 2790 * @param { ArrayBuffer } buffer - buffer. 2791 * @param { object } [options] - options. 2792 * @returns { number } Returns the number of file bytes read to buffer. 2793 * @throws { BusinessError } 13900004 - Interrupted system call 2794 * @throws { BusinessError } 13900005 - I/O error 2795 * @throws { BusinessError } 13900008 - Bad file descriptor 2796 * @throws { BusinessError } 13900010 - Try again 2797 * @throws { BusinessError } 13900013 - Bad address 2798 * @throws { BusinessError } 13900019 - Is a directory 2799 * @throws { BusinessError } 13900020 - Invalid argument 2800 * @throws { BusinessError } 13900034 - Operation would block 2801 * @throws { BusinessError } 13900042 - Unknown error 2802 * @syscap SystemCapability.FileManagement.File.FileIO 2803 * @since 9 2804 */ 2805/** 2806 * Read file with sync interface. 2807 * 2808 * @param { number } fd - file descriptor. 2809 * @param { ArrayBuffer } buffer - buffer. 2810 * @param { object } [options] - options. 2811 * @returns { number } Returns the number of file bytes read to buffer. 2812 * @throws { BusinessError } 13900004 - Interrupted system call 2813 * @throws { BusinessError } 13900005 - I/O error 2814 * @throws { BusinessError } 13900008 - Bad file descriptor 2815 * @throws { BusinessError } 13900010 - Try again 2816 * @throws { BusinessError } 13900013 - Bad address 2817 * @throws { BusinessError } 13900019 - Is a directory 2818 * @throws { BusinessError } 13900020 - Invalid argument 2819 * @throws { BusinessError } 13900034 - Operation would block 2820 * @throws { BusinessError } 13900042 - Unknown error 2821 * @syscap SystemCapability.FileManagement.File.FileIO 2822 * @crossplatform 2823 * @since 10 2824 */ 2825declare function readSync( 2826 fd: number, 2827 buffer: ArrayBuffer, 2828 options?: { 2829 offset?: number; 2830 length?: number; 2831 } 2832): number; 2833 2834/** 2835 * Read text. 2836 * 2837 * @param { string } filePath - file path. 2838 * @param { object } [options] - options. 2839 * @returns { Promise<string> } Returns the contents of the read file in promise mode. 2840 * @throws { BusinessError } 13900001 - Operation not permitted 2841 * @throws { BusinessError } 13900004 - Interrupted system call 2842 * @throws { BusinessError } 13900005 - I/O error 2843 * @throws { BusinessError } 13900008 - Bad file descriptor 2844 * @throws { BusinessError } 13900010 - Try again 2845 * @throws { BusinessError } 13900013 - Bad address 2846 * @throws { BusinessError } 13900019 - Is a directory 2847 * @throws { BusinessError } 13900020 - Invalid argument 2848 * @throws { BusinessError } 13900024 - File too large 2849 * @throws { BusinessError } 13900025 - No space left on device 2850 * @throws { BusinessError } 13900034 - Operation would block 2851 * @throws { BusinessError } 13900041 - Quota exceeded 2852 * @throws { BusinessError } 13900042 - Unknown error 2853 * @syscap SystemCapability.FileManagement.File.FileIO 2854 * @since 9 2855 */ 2856/** 2857 * Read text. 2858 * 2859 * @param { string } filePath - file path. 2860 * @param { object } [options] - options. 2861 * @returns { Promise<string> } Returns the contents of the read file in promise mode. 2862 * @throws { BusinessError } 13900001 - Operation not permitted 2863 * @throws { BusinessError } 13900004 - Interrupted system call 2864 * @throws { BusinessError } 13900005 - I/O error 2865 * @throws { BusinessError } 13900008 - Bad file descriptor 2866 * @throws { BusinessError } 13900010 - Try again 2867 * @throws { BusinessError } 13900013 - Bad address 2868 * @throws { BusinessError } 13900019 - Is a directory 2869 * @throws { BusinessError } 13900020 - Invalid argument 2870 * @throws { BusinessError } 13900024 - File too large 2871 * @throws { BusinessError } 13900025 - No space left on device 2872 * @throws { BusinessError } 13900034 - Operation would block 2873 * @throws { BusinessError } 13900041 - Quota exceeded 2874 * @throws { BusinessError } 13900042 - Unknown error 2875 * @syscap SystemCapability.FileManagement.File.FileIO 2876 * @crossplatform 2877 * @since 10 2878 */ 2879declare function readText( 2880 filePath: string, 2881 options?: { 2882 offset?: number; 2883 length?: number; 2884 encoding?: string; 2885 } 2886): Promise<string>; 2887 2888/** 2889 * Read text. 2890 * 2891 * @param { string } filePath - file path. 2892 * @param { AsyncCallback<string> } callback - The callback is used to return the contents of the read file. 2893 * @throws { BusinessError } 13900001 - Operation not permitted 2894 * @throws { BusinessError } 13900004 - Interrupted system call 2895 * @throws { BusinessError } 13900005 - I/O error 2896 * @throws { BusinessError } 13900008 - Bad file descriptor 2897 * @throws { BusinessError } 13900010 - Try again 2898 * @throws { BusinessError } 13900013 - Bad address 2899 * @throws { BusinessError } 13900019 - Is a directory 2900 * @throws { BusinessError } 13900020 - Invalid argument 2901 * @throws { BusinessError } 13900024 - File too large 2902 * @throws { BusinessError } 13900025 - No space left on device 2903 * @throws { BusinessError } 13900034 - Operation would block 2904 * @throws { BusinessError } 13900041 - Quota exceeded 2905 * @throws { BusinessError } 13900042 - Unknown error 2906 * @syscap SystemCapability.FileManagement.File.FileIO 2907 * @since 9 2908 */ 2909/** 2910 * Read text. 2911 * 2912 * @param { string } filePath - file path. 2913 * @param { AsyncCallback<string> } callback - The callback is used to return the contents of the read file. 2914 * @throws { BusinessError } 13900001 - Operation not permitted 2915 * @throws { BusinessError } 13900004 - Interrupted system call 2916 * @throws { BusinessError } 13900005 - I/O error 2917 * @throws { BusinessError } 13900008 - Bad file descriptor 2918 * @throws { BusinessError } 13900010 - Try again 2919 * @throws { BusinessError } 13900013 - Bad address 2920 * @throws { BusinessError } 13900019 - Is a directory 2921 * @throws { BusinessError } 13900020 - Invalid argument 2922 * @throws { BusinessError } 13900024 - File too large 2923 * @throws { BusinessError } 13900025 - No space left on device 2924 * @throws { BusinessError } 13900034 - Operation would block 2925 * @throws { BusinessError } 13900041 - Quota exceeded 2926 * @throws { BusinessError } 13900042 - Unknown error 2927 * @syscap SystemCapability.FileManagement.File.FileIO 2928 * @crossplatform 2929 * @since 10 2930 */ 2931declare function readText(filePath: string, callback: AsyncCallback<string>): void; 2932 2933/** 2934 * Read text. 2935 * 2936 * @param { string } filePath - file path. 2937 * @param { object } [options] - options. 2938 * @param { AsyncCallback<string> } callback - The callback is used to return the contents of the read file. 2939 * @throws { BusinessError } 13900001 - Operation not permitted 2940 * @throws { BusinessError } 13900004 - Interrupted system call 2941 * @throws { BusinessError } 13900005 - I/O error 2942 * @throws { BusinessError } 13900008 - Bad file descriptor 2943 * @throws { BusinessError } 13900010 - Try again 2944 * @throws { BusinessError } 13900013 - Bad address 2945 * @throws { BusinessError } 13900019 - Is a directory 2946 * @throws { BusinessError } 13900020 - Invalid argument 2947 * @throws { BusinessError } 13900024 - File too large 2948 * @throws { BusinessError } 13900025 - No space left on device 2949 * @throws { BusinessError } 13900034 - Operation would block 2950 * @throws { BusinessError } 13900041 - Quota exceeded 2951 * @throws { BusinessError } 13900042 - Unknown error 2952 * @syscap SystemCapability.FileManagement.File.FileIO 2953 * @since 9 2954 */ 2955/** 2956 * Read text. 2957 * 2958 * @param { string } filePath - file path. 2959 * @param { object } [options] - options. 2960 * @param { AsyncCallback<string> } callback - The callback is used to return the contents of the read file. 2961 * @throws { BusinessError } 13900001 - Operation not permitted 2962 * @throws { BusinessError } 13900004 - Interrupted system call 2963 * @throws { BusinessError } 13900005 - I/O error 2964 * @throws { BusinessError } 13900008 - Bad file descriptor 2965 * @throws { BusinessError } 13900010 - Try again 2966 * @throws { BusinessError } 13900013 - Bad address 2967 * @throws { BusinessError } 13900019 - Is a directory 2968 * @throws { BusinessError } 13900020 - Invalid argument 2969 * @throws { BusinessError } 13900024 - File too large 2970 * @throws { BusinessError } 13900025 - No space left on device 2971 * @throws { BusinessError } 13900034 - Operation would block 2972 * @throws { BusinessError } 13900041 - Quota exceeded 2973 * @throws { BusinessError } 13900042 - Unknown error 2974 * @syscap SystemCapability.FileManagement.File.FileIO 2975 * @crossplatform 2976 * @since 10 2977 */ 2978declare function readText( 2979 filePath: string, 2980 options: { 2981 offset?: number; 2982 length?: number; 2983 encoding?: string; 2984 }, 2985 callback: AsyncCallback<string> 2986): void; 2987 2988/** 2989 * Read text with sync interface. 2990 * 2991 * @param { string } filePath - file path. 2992 * @param { object } [options] - options. 2993 * @returns { string } Returns the contents of the read file. 2994 * @throws { BusinessError } 13900001 - Operation not permitted 2995 * @throws { BusinessError } 13900004 - Interrupted system call 2996 * @throws { BusinessError } 13900005 - I/O error 2997 * @throws { BusinessError } 13900008 - Bad file descriptor 2998 * @throws { BusinessError } 13900010 - Try again 2999 * @throws { BusinessError } 13900013 - Bad address 3000 * @throws { BusinessError } 13900019 - Is a directory 3001 * @throws { BusinessError } 13900020 - Invalid argument 3002 * @throws { BusinessError } 13900024 - File too large 3003 * @throws { BusinessError } 13900025 - No space left on device 3004 * @throws { BusinessError } 13900034 - Operation would block 3005 * @throws { BusinessError } 13900041 - Quota exceeded 3006 * @throws { BusinessError } 13900042 - Unknown error 3007 * @syscap SystemCapability.FileManagement.File.FileIO 3008 * @since 9 3009 */ 3010/** 3011 * Read text with sync interface. 3012 * 3013 * @param { string } filePath - file path. 3014 * @param { object } [options] - options. 3015 * @returns { string } Returns the contents of the read file. 3016 * @throws { BusinessError } 13900001 - Operation not permitted 3017 * @throws { BusinessError } 13900004 - Interrupted system call 3018 * @throws { BusinessError } 13900005 - I/O error 3019 * @throws { BusinessError } 13900008 - Bad file descriptor 3020 * @throws { BusinessError } 13900010 - Try again 3021 * @throws { BusinessError } 13900013 - Bad address 3022 * @throws { BusinessError } 13900019 - Is a directory 3023 * @throws { BusinessError } 13900020 - Invalid argument 3024 * @throws { BusinessError } 13900024 - File too large 3025 * @throws { BusinessError } 13900025 - No space left on device 3026 * @throws { BusinessError } 13900034 - Operation would block 3027 * @throws { BusinessError } 13900041 - Quota exceeded 3028 * @throws { BusinessError } 13900042 - Unknown error 3029 * @syscap SystemCapability.FileManagement.File.FileIO 3030 * @crossplatform 3031 * @since 10 3032 */ 3033declare function readTextSync( 3034 filePath: string, 3035 options?: { 3036 offset?: number; 3037 length?: number; 3038 encoding?: string; 3039 } 3040): string; 3041 3042/** 3043 * Rename file. 3044 * 3045 * @param { string } oldPath - oldPath. 3046 * @param { string } newPath - newPath. 3047 * @returns { Promise<void> } The promise returned by the function. 3048 * @throws { BusinessError } 13900001 - Operation not permitted 3049 * @throws { BusinessError } 13900002 - No such file or directory 3050 * @throws { BusinessError } 13900008 - Bad file descriptor 3051 * @throws { BusinessError } 13900011 - Out of memory 3052 * @throws { BusinessError } 13900012 - Permission denied 3053 * @throws { BusinessError } 13900013 - Bad address 3054 * @throws { BusinessError } 13900014 - Device or resource busy 3055 * @throws { BusinessError } 13900015 - File exists 3056 * @throws { BusinessError } 13900016 - Cross-device link 3057 * @throws { BusinessError } 13900018 - Not a directory 3058 * @throws { BusinessError } 13900019 - Is a directory 3059 * @throws { BusinessError } 13900020 - Invalid argument 3060 * @throws { BusinessError } 13900025 - No space left on device 3061 * @throws { BusinessError } 13900027 - Read-only file system 3062 * @throws { BusinessError } 13900028 - Too many links 3063 * @throws { BusinessError } 13900032 - Directory not empty 3064 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 3065 * @throws { BusinessError } 13900041 - Quota exceeded 3066 * @throws { BusinessError } 13900042 - Unknown error 3067 * @syscap SystemCapability.FileManagement.File.FileIO 3068 * @since 9 3069 */ 3070/** 3071 * Rename file. 3072 * 3073 * @param { string } oldPath - oldPath. 3074 * @param { string } newPath - newPath. 3075 * @returns { Promise<void> } The promise returned by the function. 3076 * @throws { BusinessError } 13900001 - Operation not permitted 3077 * @throws { BusinessError } 13900002 - No such file or directory 3078 * @throws { BusinessError } 13900008 - Bad file descriptor 3079 * @throws { BusinessError } 13900011 - Out of memory 3080 * @throws { BusinessError } 13900012 - Permission denied 3081 * @throws { BusinessError } 13900013 - Bad address 3082 * @throws { BusinessError } 13900014 - Device or resource busy 3083 * @throws { BusinessError } 13900015 - File exists 3084 * @throws { BusinessError } 13900016 - Cross-device link 3085 * @throws { BusinessError } 13900018 - Not a directory 3086 * @throws { BusinessError } 13900019 - Is a directory 3087 * @throws { BusinessError } 13900020 - Invalid argument 3088 * @throws { BusinessError } 13900025 - No space left on device 3089 * @throws { BusinessError } 13900027 - Read-only file system 3090 * @throws { BusinessError } 13900028 - Too many links 3091 * @throws { BusinessError } 13900032 - Directory not empty 3092 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 3093 * @throws { BusinessError } 13900041 - Quota exceeded 3094 * @throws { BusinessError } 13900042 - Unknown error 3095 * @syscap SystemCapability.FileManagement.File.FileIO 3096 * @crossplatform 3097 * @since 10 3098 */ 3099declare function rename(oldPath: string, newPath: string): Promise<void>; 3100 3101/** 3102 * Rename file. 3103 * 3104 * @param { string } oldPath - oldPath. 3105 * @param { string } newPath - newPath. 3106 * @param { AsyncCallback<void> } callback - Returns the callback function. 3107 * @throws { BusinessError } 13900001 - Operation not permitted 3108 * @throws { BusinessError } 13900002 - No such file or directory 3109 * @throws { BusinessError } 13900008 - Bad file descriptor 3110 * @throws { BusinessError } 13900011 - Out of memory 3111 * @throws { BusinessError } 13900012 - Permission denied 3112 * @throws { BusinessError } 13900013 - Bad address 3113 * @throws { BusinessError } 13900014 - Device or resource busy 3114 * @throws { BusinessError } 13900015 - File exists 3115 * @throws { BusinessError } 13900016 - Cross-device link 3116 * @throws { BusinessError } 13900018 - Not a directory 3117 * @throws { BusinessError } 13900019 - Is a directory 3118 * @throws { BusinessError } 13900020 - Invalid argument 3119 * @throws { BusinessError } 13900025 - No space left on device 3120 * @throws { BusinessError } 13900027 - Read-only file system 3121 * @throws { BusinessError } 13900028 - Too many links 3122 * @throws { BusinessError } 13900032 - Directory not empty 3123 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 3124 * @throws { BusinessError } 13900041 - Quota exceeded 3125 * @throws { BusinessError } 13900042 - Unknown error 3126 * @syscap SystemCapability.FileManagement.File.FileIO 3127 * @since 9 3128 */ 3129/** 3130 * Rename file. 3131 * 3132 * @param { string } oldPath - oldPath. 3133 * @param { string } newPath - newPath. 3134 * @param { AsyncCallback<void> } callback - Returns the callback function. 3135 * @throws { BusinessError } 13900001 - Operation not permitted 3136 * @throws { BusinessError } 13900002 - No such file or directory 3137 * @throws { BusinessError } 13900008 - Bad file descriptor 3138 * @throws { BusinessError } 13900011 - Out of memory 3139 * @throws { BusinessError } 13900012 - Permission denied 3140 * @throws { BusinessError } 13900013 - Bad address 3141 * @throws { BusinessError } 13900014 - Device or resource busy 3142 * @throws { BusinessError } 13900015 - File exists 3143 * @throws { BusinessError } 13900016 - Cross-device link 3144 * @throws { BusinessError } 13900018 - Not a directory 3145 * @throws { BusinessError } 13900019 - Is a directory 3146 * @throws { BusinessError } 13900020 - Invalid argument 3147 * @throws { BusinessError } 13900025 - No space left on device 3148 * @throws { BusinessError } 13900027 - Read-only file system 3149 * @throws { BusinessError } 13900028 - Too many links 3150 * @throws { BusinessError } 13900032 - Directory not empty 3151 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 3152 * @throws { BusinessError } 13900041 - Quota exceeded 3153 * @throws { BusinessError } 13900042 - Unknown error 3154 * @syscap SystemCapability.FileManagement.File.FileIO 3155 * @crossplatform 3156 * @since 10 3157 */ 3158declare function rename(oldPath: string, newPath: string, callback: AsyncCallback<void>): void; 3159 3160/** 3161 * Rename file with sync interface. 3162 * 3163 * @param { string } oldPath - oldPath. 3164 * @param { string } newPath - newPath. 3165 * @throws { BusinessError } 13900001 - Operation not permitted 3166 * @throws { BusinessError } 13900002 - No such file or directory 3167 * @throws { BusinessError } 13900008 - Bad file descriptor 3168 * @throws { BusinessError } 13900011 - Out of memory 3169 * @throws { BusinessError } 13900012 - Permission denied 3170 * @throws { BusinessError } 13900013 - Bad address 3171 * @throws { BusinessError } 13900014 - Device or resource busy 3172 * @throws { BusinessError } 13900015 - File exists 3173 * @throws { BusinessError } 13900016 - Cross-device link 3174 * @throws { BusinessError } 13900018 - Not a directory 3175 * @throws { BusinessError } 13900019 - Is a directory 3176 * @throws { BusinessError } 13900020 - Invalid argument 3177 * @throws { BusinessError } 13900025 - No space left on device 3178 * @throws { BusinessError } 13900027 - Read-only file system 3179 * @throws { BusinessError } 13900028 - Too many links 3180 * @throws { BusinessError } 13900032 - Directory not empty 3181 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 3182 * @throws { BusinessError } 13900041 - Quota exceeded 3183 * @throws { BusinessError } 13900042 - Unknown error 3184 * @syscap SystemCapability.FileManagement.File.FileIO 3185 * @since 9 3186 */ 3187/** 3188 * Rename file with sync interface. 3189 * 3190 * @param { string } oldPath - oldPath. 3191 * @param { string } newPath - newPath. 3192 * @throws { BusinessError } 13900001 - Operation not permitted 3193 * @throws { BusinessError } 13900002 - No such file or directory 3194 * @throws { BusinessError } 13900008 - Bad file descriptor 3195 * @throws { BusinessError } 13900011 - Out of memory 3196 * @throws { BusinessError } 13900012 - Permission denied 3197 * @throws { BusinessError } 13900013 - Bad address 3198 * @throws { BusinessError } 13900014 - Device or resource busy 3199 * @throws { BusinessError } 13900015 - File exists 3200 * @throws { BusinessError } 13900016 - Cross-device link 3201 * @throws { BusinessError } 13900018 - Not a directory 3202 * @throws { BusinessError } 13900019 - Is a directory 3203 * @throws { BusinessError } 13900020 - Invalid argument 3204 * @throws { BusinessError } 13900025 - No space left on device 3205 * @throws { BusinessError } 13900027 - Read-only file system 3206 * @throws { BusinessError } 13900028 - Too many links 3207 * @throws { BusinessError } 13900032 - Directory not empty 3208 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 3209 * @throws { BusinessError } 13900041 - Quota exceeded 3210 * @throws { BusinessError } 13900042 - Unknown error 3211 * @syscap SystemCapability.FileManagement.File.FileIO 3212 * @crossplatform 3213 * @since 10 3214 */ 3215declare function renameSync(oldPath: string, newPath: string): void; 3216 3217/** 3218 * Delete dir. 3219 * 3220 * @param { string } path - path. 3221 * @returns { Promise<void> } The promise returned by the function. 3222 * @throws { BusinessError } 13900001 - Operation not permitted 3223 * @throws { BusinessError } 13900002 - No such file or directory 3224 * @throws { BusinessError } 13900011 - Out of memory 3225 * @throws { BusinessError } 13900012 - Permission denied 3226 * @throws { BusinessError } 13900013 - Bad address 3227 * @throws { BusinessError } 13900014 - Device or resource busy 3228 * @throws { BusinessError } 13900018 - Not a directory 3229 * @throws { BusinessError } 13900020 - Invalid argument 3230 * @throws { BusinessError } 13900027 - Read-only file system1 3231 * @throws { BusinessError } 13900030 - File name too long 3232 * @throws { BusinessError } 13900032 - Directory not empty 3233 * @throws { BusinessError } 13900042 - Unknown error 3234 * @syscap SystemCapability.FileManagement.File.FileIO 3235 * @since 9 3236 */ 3237/** 3238 * Delete dir. 3239 * 3240 * @param { string } path - path. 3241 * @returns { Promise<void> } The promise returned by the function. 3242 * @throws { BusinessError } 13900001 - Operation not permitted 3243 * @throws { BusinessError } 13900002 - No such file or directory 3244 * @throws { BusinessError } 13900011 - Out of memory 3245 * @throws { BusinessError } 13900012 - Permission denied 3246 * @throws { BusinessError } 13900013 - Bad address 3247 * @throws { BusinessError } 13900014 - Device or resource busy 3248 * @throws { BusinessError } 13900018 - Not a directory 3249 * @throws { BusinessError } 13900020 - Invalid argument 3250 * @throws { BusinessError } 13900027 - Read-only file system1 3251 * @throws { BusinessError } 13900030 - File name too long 3252 * @throws { BusinessError } 13900032 - Directory not empty 3253 * @throws { BusinessError } 13900042 - Unknown error 3254 * @syscap SystemCapability.FileManagement.File.FileIO 3255 * @crossplatform 3256 * @since 10 3257 */ 3258declare function rmdir(path: string): Promise<void>; 3259 3260/** 3261 * Delete dir. 3262 * 3263 * @param { string } path - path. 3264 * @param { AsyncCallback<void> } callback - Return the callback function. 3265 * @throws { BusinessError } 13900001 - Operation not permitted 3266 * @throws { BusinessError } 13900002 - No such file or directory 3267 * @throws { BusinessError } 13900011 - Out of memory 3268 * @throws { BusinessError } 13900012 - Permission denied 3269 * @throws { BusinessError } 13900013 - Bad address 3270 * @throws { BusinessError } 13900014 - Device or resource busy 3271 * @throws { BusinessError } 13900018 - Not a directory 3272 * @throws { BusinessError } 13900020 - Invalid argument 3273 * @throws { BusinessError } 13900027 - Read-only file system1 3274 * @throws { BusinessError } 13900030 - File name too long 3275 * @throws { BusinessError } 13900032 - Directory not empty 3276 * @throws { BusinessError } 13900042 - Unknown error 3277 * @syscap SystemCapability.FileManagement.File.FileIO 3278 * @since 9 3279 */ 3280/** 3281 * Delete dir. 3282 * 3283 * @param { string } path - path. 3284 * @param { AsyncCallback<void> } callback - Return the callback function. 3285 * @throws { BusinessError } 13900001 - Operation not permitted 3286 * @throws { BusinessError } 13900002 - No such file or directory 3287 * @throws { BusinessError } 13900011 - Out of memory 3288 * @throws { BusinessError } 13900012 - Permission denied 3289 * @throws { BusinessError } 13900013 - Bad address 3290 * @throws { BusinessError } 13900014 - Device or resource busy 3291 * @throws { BusinessError } 13900018 - Not a directory 3292 * @throws { BusinessError } 13900020 - Invalid argument 3293 * @throws { BusinessError } 13900027 - Read-only file system1 3294 * @throws { BusinessError } 13900030 - File name too long 3295 * @throws { BusinessError } 13900032 - Directory not empty 3296 * @throws { BusinessError } 13900042 - Unknown error 3297 * @syscap SystemCapability.FileManagement.File.FileIO 3298 * @crossplatform 3299 * @since 10 3300 */ 3301declare function rmdir(path: string, callback: AsyncCallback<void>): void; 3302 3303/** 3304 * Delete dir with sync interface. 3305 * 3306 * @param { string } path - path. 3307 * @throws { BusinessError } 13900001 - Operation not permitted 3308 * @throws { BusinessError } 13900002 - No such file or directory 3309 * @throws { BusinessError } 13900011 - Out of memory 3310 * @throws { BusinessError } 13900012 - Permission denied 3311 * @throws { BusinessError } 13900013 - Bad address 3312 * @throws { BusinessError } 13900014 - Device or resource busy 3313 * @throws { BusinessError } 13900018 - Not a directory 3314 * @throws { BusinessError } 13900020 - Invalid argument 3315 * @throws { BusinessError } 13900027 - Read-only file system1 3316 * @throws { BusinessError } 13900030 - File name too long 3317 * @throws { BusinessError } 13900032 - Directory not empty 3318 * @throws { BusinessError } 13900042 - Unknown error 3319 * @syscap SystemCapability.FileManagement.File.FileIO 3320 * @since 9 3321 */ 3322/** 3323 * Delete dir with sync interface. 3324 * 3325 * @param { string } path - path. 3326 * @throws { BusinessError } 13900001 - Operation not permitted 3327 * @throws { BusinessError } 13900002 - No such file or directory 3328 * @throws { BusinessError } 13900011 - Out of memory 3329 * @throws { BusinessError } 13900012 - Permission denied 3330 * @throws { BusinessError } 13900013 - Bad address 3331 * @throws { BusinessError } 13900014 - Device or resource busy 3332 * @throws { BusinessError } 13900018 - Not a directory 3333 * @throws { BusinessError } 13900020 - Invalid argument 3334 * @throws { BusinessError } 13900027 - Read-only file system1 3335 * @throws { BusinessError } 13900030 - File name too long 3336 * @throws { BusinessError } 13900032 - Directory not empty 3337 * @throws { BusinessError } 13900042 - Unknown error 3338 * @syscap SystemCapability.FileManagement.File.FileIO 3339 * @crossplatform 3340 * @since 10 3341 */ 3342declare function rmdirSync(path: string): void; 3343 3344/** 3345 * Get file information. 3346 * 3347 * @param { string | number } file - path or file descriptor. 3348 * @returns { Promise<Stat> } Returns the Stat object in promise mode. 3349 * @throws { BusinessError } 13900002 - No such file or directory 3350 * @throws { BusinessError } 13900004 - Interrupted system call 3351 * @throws { BusinessError } 13900005 - I/O error 3352 * @throws { BusinessError } 13900008 - Bad file descriptor 3353 * @throws { BusinessError } 13900011 - Out of memory 3354 * @throws { BusinessError } 13900012 - Permission denied 3355 * @throws { BusinessError } 13900013 - Bad address 3356 * @throws { BusinessError } 13900018 - Not a directory 3357 * @throws { BusinessError } 13900030 - File name too long 3358 * @throws { BusinessError } 13900031 - Function not implemented 3359 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 3360 * @throws { BusinessError } 13900038 - Value too large for defined data type 3361 * @throws { BusinessError } 13900042 - Unknown error 3362 * @syscap SystemCapability.FileManagement.File.FileIO 3363 * @since 9 3364 */ 3365/** 3366 * Get file information. 3367 * 3368 * @param { string | number } file - path or file descriptor. 3369 * @returns { Promise<Stat> } Returns the Stat object in promise mode. 3370 * @throws { BusinessError } 13900002 - No such file or directory 3371 * @throws { BusinessError } 13900004 - Interrupted system call 3372 * @throws { BusinessError } 13900005 - I/O error 3373 * @throws { BusinessError } 13900008 - Bad file descriptor 3374 * @throws { BusinessError } 13900011 - Out of memory 3375 * @throws { BusinessError } 13900012 - Permission denied 3376 * @throws { BusinessError } 13900013 - Bad address 3377 * @throws { BusinessError } 13900018 - Not a directory 3378 * @throws { BusinessError } 13900030 - File name too long 3379 * @throws { BusinessError } 13900031 - Function not implemented 3380 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 3381 * @throws { BusinessError } 13900038 - Value too large for defined data type 3382 * @throws { BusinessError } 13900042 - Unknown error 3383 * @syscap SystemCapability.FileManagement.File.FileIO 3384 * @crossplatform 3385 * @since 10 3386 */ 3387declare function stat(file: string | number): Promise<Stat>; 3388 3389/** 3390 * Get file information. 3391 * 3392 * @param { string | number } file - path or file descriptor. 3393 * @param { AsyncCallback<Stat> } callback - The callback is used to return the Stat object. 3394 * @throws { BusinessError } 13900002 - No such file or directory 3395 * @throws { BusinessError } 13900004 - Interrupted system call 3396 * @throws { BusinessError } 13900005 - I/O error 3397 * @throws { BusinessError } 13900008 - Bad file descriptor 3398 * @throws { BusinessError } 13900011 - Out of memory 3399 * @throws { BusinessError } 13900012 - Permission denied 3400 * @throws { BusinessError } 13900013 - Bad address 3401 * @throws { BusinessError } 13900018 - Not a directory 3402 * @throws { BusinessError } 13900030 - File name too long 3403 * @throws { BusinessError } 13900031 - Function not implemented 3404 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 3405 * @throws { BusinessError } 13900038 - Value too large for defined data type 3406 * @throws { BusinessError } 13900042 - Unknown error 3407 * @syscap SystemCapability.FileManagement.File.FileIO 3408 * @since 9 3409 */ 3410/** 3411 * Get file information. 3412 * 3413 * @param { string | number } file - path or file descriptor. 3414 * @param { AsyncCallback<Stat> } callback - The callback is used to return the Stat object. 3415 * @throws { BusinessError } 13900002 - No such file or directory 3416 * @throws { BusinessError } 13900004 - Interrupted system call 3417 * @throws { BusinessError } 13900005 - I/O error 3418 * @throws { BusinessError } 13900008 - Bad file descriptor 3419 * @throws { BusinessError } 13900011 - Out of memory 3420 * @throws { BusinessError } 13900012 - Permission denied 3421 * @throws { BusinessError } 13900013 - Bad address 3422 * @throws { BusinessError } 13900018 - Not a directory 3423 * @throws { BusinessError } 13900030 - File name too long 3424 * @throws { BusinessError } 13900031 - Function not implemented 3425 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 3426 * @throws { BusinessError } 13900038 - Value too large for defined data type 3427 * @throws { BusinessError } 13900042 - Unknown error 3428 * @syscap SystemCapability.FileManagement.File.FileIO 3429 * @crossplatform 3430 * @since 10 3431 */ 3432declare function stat(file: string | number, callback: AsyncCallback<Stat>): void; 3433 3434/** 3435 * Get file information with sync interface. 3436 * 3437 * @param { string | number } file - path or file descriptor. 3438 * @returns { Stat } Returns the Stat object. 3439 * @throws { BusinessError } 13900002 - No such file or directory 3440 * @throws { BusinessError } 13900004 - Interrupted system call 3441 * @throws { BusinessError } 13900005 - I/O error 3442 * @throws { BusinessError } 13900008 - Bad file descriptor 3443 * @throws { BusinessError } 13900011 - Out of memory 3444 * @throws { BusinessError } 13900012 - Permission denied 3445 * @throws { BusinessError } 13900013 - Bad address 3446 * @throws { BusinessError } 13900018 - Not a directory 3447 * @throws { BusinessError } 13900030 - File name too long 3448 * @throws { BusinessError } 13900031 - Function not implemented 3449 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 3450 * @throws { BusinessError } 13900038 - Value too large for defined data type 3451 * @throws { BusinessError } 13900042 - Unknown error 3452 * @syscap SystemCapability.FileManagement.File.FileIO 3453 * @since 9 3454 */ 3455/** 3456 * Get file information with sync interface. 3457 * 3458 * @param { string | number } file - path or file descriptor. 3459 * @returns { Stat } Returns the Stat object. 3460 * @throws { BusinessError } 13900002 - No such file or directory 3461 * @throws { BusinessError } 13900004 - Interrupted system call 3462 * @throws { BusinessError } 13900005 - I/O error 3463 * @throws { BusinessError } 13900008 - Bad file descriptor 3464 * @throws { BusinessError } 13900011 - Out of memory 3465 * @throws { BusinessError } 13900012 - Permission denied 3466 * @throws { BusinessError } 13900013 - Bad address 3467 * @throws { BusinessError } 13900018 - Not a directory 3468 * @throws { BusinessError } 13900030 - File name too long 3469 * @throws { BusinessError } 13900031 - Function not implemented 3470 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 3471 * @throws { BusinessError } 13900038 - Value too large for defined data type 3472 * @throws { BusinessError } 13900042 - Unknown error 3473 * @syscap SystemCapability.FileManagement.File.FileIO 3474 * @crossplatform 3475 * @since 10 3476 */ 3477declare function statSync(file: string | number): Stat; 3478 3479/** 3480 * Link file. 3481 * 3482 * @param { string } target - target. 3483 * @param { string } srcPath - srcPath. 3484 * @returns { Promise<void> } The promise returned by the function. 3485 * @throws { BusinessError } 13900001 - Operation not permitted 3486 * @throws { BusinessError } 13900002 - No such file or directory 3487 * @throws { BusinessError } 13900005 - I/O error 3488 * @throws { BusinessError } 13900008 - Bad file descriptor 3489 * @throws { BusinessError } 13900011 - Out of memory 3490 * @throws { BusinessError } 13900012 - Permission denied 3491 * @throws { BusinessError } 13900013 - Bad address 3492 * @throws { BusinessError } 13900015 - File exists 3493 * @throws { BusinessError } 13900018 - Not a directory 3494 * @throws { BusinessError } 13900025 - No space left on device 3495 * @throws { BusinessError } 13900027 - Read-only file system 3496 * @throws { BusinessError } 13900030 - File name too long 3497 * @throws { BusinessError } 13900041 - Quota exceeded 3498 * @throws { BusinessError } 13900042 - Unknown error 3499 * @syscap SystemCapability.FileManagement.File.FileIO 3500 * @since 9 3501 */ 3502declare function symlink(target: string, srcPath: string): Promise<void>; 3503 3504/** 3505 * Link file. 3506 * 3507 * @param { string } target - target. 3508 * @param { string } srcPath - srcPath. 3509 * @param { AsyncCallback<void> } callback - Return the callback function. 3510 * @throws { BusinessError } 13900001 - Operation not permitted 3511 * @throws { BusinessError } 13900002 - No such file or directory 3512 * @throws { BusinessError } 13900005 - I/O error 3513 * @throws { BusinessError } 13900008 - Bad file descriptor 3514 * @throws { BusinessError } 13900011 - Out of memory 3515 * @throws { BusinessError } 13900012 - Permission denied 3516 * @throws { BusinessError } 13900013 - Bad address 3517 * @throws { BusinessError } 13900015 - File exists 3518 * @throws { BusinessError } 13900018 - Not a directory 3519 * @throws { BusinessError } 13900025 - No space left on device 3520 * @throws { BusinessError } 13900027 - Read-only file system 3521 * @throws { BusinessError } 13900030 - File name too long 3522 * @throws { BusinessError } 13900041 - Quota exceeded 3523 * @throws { BusinessError } 13900042 - Unknown error 3524 * @syscap SystemCapability.FileManagement.File.FileIO 3525 * @since 9 3526 */ 3527declare function symlink(target: string, srcPath: string, callback: AsyncCallback<void>): void; 3528 3529/** 3530 * Link file with sync interface. 3531 * 3532 * @param { string } target - target. 3533 * @param { string } srcPath - srcPath. 3534 * @throws { BusinessError } 13900001 - Operation not permitted 3535 * @throws { BusinessError } 13900002 - No such file or directory 3536 * @throws { BusinessError } 13900005 - I/O error 3537 * @throws { BusinessError } 13900008 - Bad file descriptor 3538 * @throws { BusinessError } 13900011 - Out of memory 3539 * @throws { BusinessError } 13900012 - Permission denied 3540 * @throws { BusinessError } 13900013 - Bad address 3541 * @throws { BusinessError } 13900015 - File exists 3542 * @throws { BusinessError } 13900018 - Not a directory 3543 * @throws { BusinessError } 13900025 - No space left on device 3544 * @throws { BusinessError } 13900027 - Read-only file system 3545 * @throws { BusinessError } 13900030 - File name too long 3546 * @throws { BusinessError } 13900041 - Quota exceeded 3547 * @throws { BusinessError } 13900042 - Unknown error 3548 * @syscap SystemCapability.FileManagement.File.FileIO 3549 * @since 9 3550 */ 3551declare function symlinkSync(target: string, srcPath: string): void; 3552 3553/** 3554 * Truncate file. 3555 * 3556 * @param { string | number } file - path or file descriptor. 3557 * @param { number } [len = 0] - len. 3558 * @returns { Promise<void> } The promise returned by the function. 3559 * @throws { BusinessError } 13900001 - Operation not permitted 3560 * @throws { BusinessError } 13900002 - No such file or directory 3561 * @throws { BusinessError } 13900004 - Interrupted system call 3562 * @throws { BusinessError } 13900005 - I/O error 3563 * @throws { BusinessError } 13900008 - Bad file descriptor 3564 * @throws { BusinessError } 13900012 - Permission denied 3565 * @throws { BusinessError } 13900013 - Bad address 3566 * @throws { BusinessError } 13900018 - Not a directory 3567 * @throws { BusinessError } 13900019 - Is a directory 3568 * @throws { BusinessError } 13900020 - Invalid argument 3569 * @throws { BusinessError } 13900023 - Text file busy 3570 * @throws { BusinessError } 13900024 - File too large 3571 * @throws { BusinessError } 13900027 - Read-only file system 3572 * @throws { BusinessError } 13900030 - File name too long 3573 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 3574 * @throws { BusinessError } 13900042 - Unknown error 3575 * @syscap SystemCapability.FileManagement.File.FileIO 3576 * @since 9 3577 */ 3578/** 3579 * Truncate file. 3580 * 3581 * @param { string | number } file - path or file descriptor. 3582 * @param { number } [len = 0] - len. 3583 * @returns { Promise<void> } The promise returned by the function. 3584 * @throws { BusinessError } 13900001 - Operation not permitted 3585 * @throws { BusinessError } 13900002 - No such file or directory 3586 * @throws { BusinessError } 13900004 - Interrupted system call 3587 * @throws { BusinessError } 13900005 - I/O error 3588 * @throws { BusinessError } 13900008 - Bad file descriptor 3589 * @throws { BusinessError } 13900012 - Permission denied 3590 * @throws { BusinessError } 13900013 - Bad address 3591 * @throws { BusinessError } 13900018 - Not a directory 3592 * @throws { BusinessError } 13900019 - Is a directory 3593 * @throws { BusinessError } 13900020 - Invalid argument 3594 * @throws { BusinessError } 13900023 - Text file busy 3595 * @throws { BusinessError } 13900024 - File too large 3596 * @throws { BusinessError } 13900027 - Read-only file system 3597 * @throws { BusinessError } 13900030 - File name too long 3598 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 3599 * @throws { BusinessError } 13900042 - Unknown error 3600 * @syscap SystemCapability.FileManagement.File.FileIO 3601 * @crossplatform 3602 * @since 10 3603 */ 3604declare function truncate(file: string | number, len?: number): Promise<void>; 3605 3606/** 3607 * Truncate file. 3608 * 3609 * @param { string | number } file - path or file descriptor. 3610 * @param { AsyncCallback<void> } callback - Return the callback function. 3611 * @throws { BusinessError } 13900001 - Operation not permitted 3612 * @throws { BusinessError } 13900002 - No such file or directory 3613 * @throws { BusinessError } 13900004 - Interrupted system call 3614 * @throws { BusinessError } 13900005 - I/O error 3615 * @throws { BusinessError } 13900008 - Bad file descriptor 3616 * @throws { BusinessError } 13900012 - Permission denied 3617 * @throws { BusinessError } 13900013 - Bad address 3618 * @throws { BusinessError } 13900018 - Not a directory 3619 * @throws { BusinessError } 13900019 - Is a directory 3620 * @throws { BusinessError } 13900020 - Invalid argument 3621 * @throws { BusinessError } 13900023 - Text file busy 3622 * @throws { BusinessError } 13900024 - File too large 3623 * @throws { BusinessError } 13900027 - Read-only file system 3624 * @throws { BusinessError } 13900030 - File name too long 3625 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 3626 * @throws { BusinessError } 13900042 - Unknown error 3627 * @syscap SystemCapability.FileManagement.File.FileIO 3628 * @since 9 3629 */ 3630/** 3631 * Truncate file. 3632 * 3633 * @param { string | number } file - path or file descriptor. 3634 * @param { AsyncCallback<void> } callback - Return the callback function. 3635 * @throws { BusinessError } 13900001 - Operation not permitted 3636 * @throws { BusinessError } 13900002 - No such file or directory 3637 * @throws { BusinessError } 13900004 - Interrupted system call 3638 * @throws { BusinessError } 13900005 - I/O error 3639 * @throws { BusinessError } 13900008 - Bad file descriptor 3640 * @throws { BusinessError } 13900012 - Permission denied 3641 * @throws { BusinessError } 13900013 - Bad address 3642 * @throws { BusinessError } 13900018 - Not a directory 3643 * @throws { BusinessError } 13900019 - Is a directory 3644 * @throws { BusinessError } 13900020 - Invalid argument 3645 * @throws { BusinessError } 13900023 - Text file busy 3646 * @throws { BusinessError } 13900024 - File too large 3647 * @throws { BusinessError } 13900027 - Read-only file system 3648 * @throws { BusinessError } 13900030 - File name too long 3649 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 3650 * @throws { BusinessError } 13900042 - Unknown error 3651 * @syscap SystemCapability.FileManagement.File.FileIO 3652 * @crossplatform 3653 * @since 10 3654 */ 3655declare function truncate(file: string | number, callback: AsyncCallback<void>): void; 3656 3657/** 3658 * Truncate file. 3659 * 3660 * @param { string | number } file - path or file descriptor. 3661 * @param { number } [len = 0] - len. 3662 * @param { AsyncCallback<void> } callback - Return the callback function. 3663 * @throws { BusinessError } 13900001 - Operation not permitted 3664 * @throws { BusinessError } 13900002 - No such file or directory 3665 * @throws { BusinessError } 13900004 - Interrupted system call 3666 * @throws { BusinessError } 13900005 - I/O error 3667 * @throws { BusinessError } 13900008 - Bad file descriptor 3668 * @throws { BusinessError } 13900012 - Permission denied 3669 * @throws { BusinessError } 13900013 - Bad address 3670 * @throws { BusinessError } 13900018 - Not a directory 3671 * @throws { BusinessError } 13900019 - Is a directory 3672 * @throws { BusinessError } 13900020 - Invalid argument 3673 * @throws { BusinessError } 13900023 - Text file busy 3674 * @throws { BusinessError } 13900024 - File too large 3675 * @throws { BusinessError } 13900027 - Read-only file system 3676 * @throws { BusinessError } 13900030 - File name too long 3677 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 3678 * @throws { BusinessError } 13900042 - Unknown error 3679 * @syscap SystemCapability.FileManagement.File.FileIO 3680 * @since 9 3681 */ 3682/** 3683 * Truncate file. 3684 * 3685 * @param { string | number } file - path or file descriptor. 3686 * @param { number } [len = 0] - len. 3687 * @param { AsyncCallback<void> } callback - Return the callback function. 3688 * @throws { BusinessError } 13900001 - Operation not permitted 3689 * @throws { BusinessError } 13900002 - No such file or directory 3690 * @throws { BusinessError } 13900004 - Interrupted system call 3691 * @throws { BusinessError } 13900005 - I/O error 3692 * @throws { BusinessError } 13900008 - Bad file descriptor 3693 * @throws { BusinessError } 13900012 - Permission denied 3694 * @throws { BusinessError } 13900013 - Bad address 3695 * @throws { BusinessError } 13900018 - Not a directory 3696 * @throws { BusinessError } 13900019 - Is a directory 3697 * @throws { BusinessError } 13900020 - Invalid argument 3698 * @throws { BusinessError } 13900023 - Text file busy 3699 * @throws { BusinessError } 13900024 - File too large 3700 * @throws { BusinessError } 13900027 - Read-only file system 3701 * @throws { BusinessError } 13900030 - File name too long 3702 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 3703 * @throws { BusinessError } 13900042 - Unknown error 3704 * @syscap SystemCapability.FileManagement.File.FileIO 3705 * @crossplatform 3706 * @since 10 3707 */ 3708declare function truncate(file: string | number, len: number, callback: AsyncCallback<void>): void; 3709 3710/** 3711 * Truncate file with sync interface. 3712 * 3713 * @param { string | number } file - path or file descriptor. 3714 * @param { number } [len = 0] - len. 3715 * @throws { BusinessError } 13900001 - Operation not permitted 3716 * @throws { BusinessError } 13900002 - No such file or directory 3717 * @throws { BusinessError } 13900004 - Interrupted system call 3718 * @throws { BusinessError } 13900005 - I/O error 3719 * @throws { BusinessError } 13900008 - Bad file descriptor 3720 * @throws { BusinessError } 13900012 - Permission denied 3721 * @throws { BusinessError } 13900013 - Bad address 3722 * @throws { BusinessError } 13900018 - Not a directory 3723 * @throws { BusinessError } 13900019 - Is a directory 3724 * @throws { BusinessError } 13900020 - Invalid argument 3725 * @throws { BusinessError } 13900023 - Text file busy 3726 * @throws { BusinessError } 13900024 - File too large 3727 * @throws { BusinessError } 13900027 - Read-only file system 3728 * @throws { BusinessError } 13900030 - File name too long 3729 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 3730 * @throws { BusinessError } 13900042 - Unknown error 3731 * @syscap SystemCapability.FileManagement.File.FileIO 3732 * @since 9 3733 */ 3734/** 3735 * Truncate file with sync interface. 3736 * 3737 * @param { string | number } file - path or file descriptor. 3738 * @param { number } [len = 0] - len. 3739 * @throws { BusinessError } 13900001 - Operation not permitted 3740 * @throws { BusinessError } 13900002 - No such file or directory 3741 * @throws { BusinessError } 13900004 - Interrupted system call 3742 * @throws { BusinessError } 13900005 - I/O error 3743 * @throws { BusinessError } 13900008 - Bad file descriptor 3744 * @throws { BusinessError } 13900012 - Permission denied 3745 * @throws { BusinessError } 13900013 - Bad address 3746 * @throws { BusinessError } 13900018 - Not a directory 3747 * @throws { BusinessError } 13900019 - Is a directory 3748 * @throws { BusinessError } 13900020 - Invalid argument 3749 * @throws { BusinessError } 13900023 - Text file busy 3750 * @throws { BusinessError } 13900024 - File too large 3751 * @throws { BusinessError } 13900027 - Read-only file system 3752 * @throws { BusinessError } 13900030 - File name too long 3753 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 3754 * @throws { BusinessError } 13900042 - Unknown error 3755 * @syscap SystemCapability.FileManagement.File.FileIO 3756 * @crossplatform 3757 * @since 10 3758 */ 3759declare function truncateSync(file: string | number, len?: number): void; 3760 3761/** 3762 * Delete file. 3763 * 3764 * @param { string } path - path. 3765 * @returns { Promise<void> } The promise returned by the function. 3766 * @throws { BusinessError } 13900001 - Operation not permitted 3767 * @throws { BusinessError } 13900002 - No such file or directory 3768 * @throws { BusinessError } 13900005 - I/O error 3769 * @throws { BusinessError } 13900008 - Bad file descriptor 3770 * @throws { BusinessError } 13900011 - Out of memory 3771 * @throws { BusinessError } 13900012 - Permission denied 3772 * @throws { BusinessError } 13900013 - Bad address 3773 * @throws { BusinessError } 13900014 - Device or resource busy 3774 * @throws { BusinessError } 13900018 - Not a directory 3775 * @throws { BusinessError } 13900019 - Is a directory 3776 * @throws { BusinessError } 13900020 - Invalid argument 3777 * @throws { BusinessError } 13900027 - Read-only file system 3778 * @throws { BusinessError } 13900030 - File name too long 3779 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 3780 * @throws { BusinessError } 13900042 - Unknown error 3781 * @syscap SystemCapability.FileManagement.File.FileIO 3782 * @since 9 3783 */ 3784/** 3785 * Delete file. 3786 * 3787 * @param { string } path - path. 3788 * @returns { Promise<void> } The promise returned by the function. 3789 * @throws { BusinessError } 13900001 - Operation not permitted 3790 * @throws { BusinessError } 13900002 - No such file or directory 3791 * @throws { BusinessError } 13900005 - I/O error 3792 * @throws { BusinessError } 13900008 - Bad file descriptor 3793 * @throws { BusinessError } 13900011 - Out of memory 3794 * @throws { BusinessError } 13900012 - Permission denied 3795 * @throws { BusinessError } 13900013 - Bad address 3796 * @throws { BusinessError } 13900014 - Device or resource busy 3797 * @throws { BusinessError } 13900018 - Not a directory 3798 * @throws { BusinessError } 13900019 - Is a directory 3799 * @throws { BusinessError } 13900020 - Invalid argument 3800 * @throws { BusinessError } 13900027 - Read-only file system 3801 * @throws { BusinessError } 13900030 - File name too long 3802 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 3803 * @throws { BusinessError } 13900042 - Unknown error 3804 * @syscap SystemCapability.FileManagement.File.FileIO 3805 * @crossplatform 3806 * @since 10 3807 */ 3808declare function unlink(path: string): Promise<void>; 3809 3810/** 3811 * Delete file. 3812 * 3813 * @param { string } path - path. 3814 * @param { AsyncCallback<void> } callback - Return the callback function. 3815 * @throws { BusinessError } 13900001 - Operation not permitted 3816 * @throws { BusinessError } 13900002 - No such file or directory 3817 * @throws { BusinessError } 13900005 - I/O error 3818 * @throws { BusinessError } 13900008 - Bad file descriptor 3819 * @throws { BusinessError } 13900011 - Out of memory 3820 * @throws { BusinessError } 13900012 - Permission denied 3821 * @throws { BusinessError } 13900013 - Bad address 3822 * @throws { BusinessError } 13900014 - Device or resource busy 3823 * @throws { BusinessError } 13900018 - Not a directory 3824 * @throws { BusinessError } 13900019 - Is a directory 3825 * @throws { BusinessError } 13900020 - Invalid argument 3826 * @throws { BusinessError } 13900027 - Read-only file system 3827 * @throws { BusinessError } 13900030 - File name too long 3828 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 3829 * @throws { BusinessError } 13900042 - Unknown error 3830 * @syscap SystemCapability.FileManagement.File.FileIO 3831 * @since 9 3832 */ 3833/** 3834 * Delete file. 3835 * 3836 * @param { string } path - path. 3837 * @param { AsyncCallback<void> } callback - Return the callback function. 3838 * @throws { BusinessError } 13900001 - Operation not permitted 3839 * @throws { BusinessError } 13900002 - No such file or directory 3840 * @throws { BusinessError } 13900005 - I/O error 3841 * @throws { BusinessError } 13900008 - Bad file descriptor 3842 * @throws { BusinessError } 13900011 - Out of memory 3843 * @throws { BusinessError } 13900012 - Permission denied 3844 * @throws { BusinessError } 13900013 - Bad address 3845 * @throws { BusinessError } 13900014 - Device or resource busy 3846 * @throws { BusinessError } 13900018 - Not a directory 3847 * @throws { BusinessError } 13900019 - Is a directory 3848 * @throws { BusinessError } 13900020 - Invalid argument 3849 * @throws { BusinessError } 13900027 - Read-only file system 3850 * @throws { BusinessError } 13900030 - File name too long 3851 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 3852 * @throws { BusinessError } 13900042 - Unknown error 3853 * @syscap SystemCapability.FileManagement.File.FileIO 3854 * @crossplatform 3855 * @since 10 3856 */ 3857declare function unlink(path: string, callback: AsyncCallback<void>): void; 3858 3859/** 3860 * Delete file with sync interface. 3861 * 3862 * @param { string } path - path. 3863 * @throws { BusinessError } 13900001 - Operation not permitted 3864 * @throws { BusinessError } 13900002 - No such file or directory 3865 * @throws { BusinessError } 13900005 - I/O error 3866 * @throws { BusinessError } 13900008 - Bad file descriptor 3867 * @throws { BusinessError } 13900011 - Out of memory 3868 * @throws { BusinessError } 13900012 - Permission denied 3869 * @throws { BusinessError } 13900013 - Bad address 3870 * @throws { BusinessError } 13900014 - Device or resource busy 3871 * @throws { BusinessError } 13900018 - Not a directory 3872 * @throws { BusinessError } 13900019 - Is a directory 3873 * @throws { BusinessError } 13900020 - Invalid argument 3874 * @throws { BusinessError } 13900027 - Read-only file system 3875 * @throws { BusinessError } 13900030 - File name too long 3876 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 3877 * @throws { BusinessError } 13900042 - Unknown error 3878 * @syscap SystemCapability.FileManagement.File.FileIO 3879 * @since 9 3880 */ 3881/** 3882 * Delete file with sync interface. 3883 * 3884 * @param { string } path - path. 3885 * @throws { BusinessError } 13900001 - Operation not permitted 3886 * @throws { BusinessError } 13900002 - No such file or directory 3887 * @throws { BusinessError } 13900005 - I/O error 3888 * @throws { BusinessError } 13900008 - Bad file descriptor 3889 * @throws { BusinessError } 13900011 - Out of memory 3890 * @throws { BusinessError } 13900012 - Permission denied 3891 * @throws { BusinessError } 13900013 - Bad address 3892 * @throws { BusinessError } 13900014 - Device or resource busy 3893 * @throws { BusinessError } 13900018 - Not a directory 3894 * @throws { BusinessError } 13900019 - Is a directory 3895 * @throws { BusinessError } 13900020 - Invalid argument 3896 * @throws { BusinessError } 13900027 - Read-only file system 3897 * @throws { BusinessError } 13900030 - File name too long 3898 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 3899 * @throws { BusinessError } 13900042 - Unknown error 3900 * @syscap SystemCapability.FileManagement.File.FileIO 3901 * @crossplatform 3902 * @since 10 3903 */ 3904declare function unlinkSync(path: string): void; 3905 3906/** 3907 * Write file. 3908 * 3909 * @param { number } fd - file descriptor. 3910 * @param { ArrayBuffer | string } buffer - buffer. 3911 * @param { object } [options] - options. 3912 * @returns { Promise<number> } Returns the number of bytes written to the file in promise mode. 3913 * @throws { BusinessError } 13900001 - Operation not permitted 3914 * @throws { BusinessError } 13900004 - Interrupted system call 3915 * @throws { BusinessError } 13900005 - I/O error 3916 * @throws { BusinessError } 13900008 - Bad file descriptor 3917 * @throws { BusinessError } 13900010 - Try again 3918 * @throws { BusinessError } 13900013 - Bad address 3919 * @throws { BusinessError } 13900020 - Invalid argument 3920 * @throws { BusinessError } 13900024 - File too large 3921 * @throws { BusinessError } 13900025 - No space left on device 3922 * @throws { BusinessError } 13900034 - Operation would block 3923 * @throws { BusinessError } 13900041 - Quota exceeded 3924 * @throws { BusinessError } 13900042 - Unknown error 3925 * @syscap SystemCapability.FileManagement.File.FileIO 3926 * @since 9 3927 */ 3928/** 3929 * Write file. 3930 * 3931 * @param { number } fd - file descriptor. 3932 * @param { ArrayBuffer | string } buffer - buffer. 3933 * @param { object } [options] - options. 3934 * @returns { Promise<number> } Returns the number of bytes written to the file in promise mode. 3935 * @throws { BusinessError } 13900001 - Operation not permitted 3936 * @throws { BusinessError } 13900004 - Interrupted system call 3937 * @throws { BusinessError } 13900005 - I/O error 3938 * @throws { BusinessError } 13900008 - Bad file descriptor 3939 * @throws { BusinessError } 13900010 - Try again 3940 * @throws { BusinessError } 13900013 - Bad address 3941 * @throws { BusinessError } 13900020 - Invalid argument 3942 * @throws { BusinessError } 13900024 - File too large 3943 * @throws { BusinessError } 13900025 - No space left on device 3944 * @throws { BusinessError } 13900034 - Operation would block 3945 * @throws { BusinessError } 13900041 - Quota exceeded 3946 * @throws { BusinessError } 13900042 - Unknown error 3947 * @syscap SystemCapability.FileManagement.File.FileIO 3948 * @crossplatform 3949 * @since 10 3950 */ 3951declare function write( 3952 fd: number, 3953 buffer: ArrayBuffer | string, 3954 options?: { 3955 offset?: number; 3956 length?: number; 3957 encoding?: string; 3958 } 3959): Promise<number>; 3960 3961/** 3962 * Write file. 3963 * 3964 * @param { number } fd - file descriptor. 3965 * @param { ArrayBuffer | string } buffer - buffer. 3966 * @param { AsyncCallback<number> } callback - The callback is used to return the number of bytes written to the file. 3967 * @throws { BusinessError } 13900001 - Operation not permitted 3968 * @throws { BusinessError } 13900004 - Interrupted system call 3969 * @throws { BusinessError } 13900005 - I/O error 3970 * @throws { BusinessError } 13900008 - Bad file descriptor 3971 * @throws { BusinessError } 13900010 - Try again 3972 * @throws { BusinessError } 13900013 - Bad address 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 * @since 9 3981 */ 3982/** 3983 * Write file. 3984 * 3985 * @param { number } fd - file descriptor. 3986 * @param { ArrayBuffer | string } buffer - buffer. 3987 * @param { AsyncCallback<number> } callback - The callback is used to return the number of bytes written to the 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 } 13900020 - Invalid argument 3995 * @throws { BusinessError } 13900024 - File too large 3996 * @throws { BusinessError } 13900025 - No space left on device 3997 * @throws { BusinessError } 13900034 - Operation would block 3998 * @throws { BusinessError } 13900041 - Quota exceeded 3999 * @throws { BusinessError } 13900042 - Unknown error 4000 * @syscap SystemCapability.FileManagement.File.FileIO 4001 * @crossplatform 4002 * @since 10 4003 */ 4004declare function write(fd: number, buffer: ArrayBuffer | string, callback: AsyncCallback<number>): void; 4005 4006/** 4007 * Write file. 4008 * 4009 * @param { number } fd - file descriptor. 4010 * @param { ArrayBuffer | string } buffer - buffer. 4011 * @param { object } [options] - options. 4012 * @param { AsyncCallback<number> } callback - The callback is used to return the number of bytes written to the file. 4013 * @throws { BusinessError } 13900001 - Operation not permitted 4014 * @throws { BusinessError } 13900004 - Interrupted system call 4015 * @throws { BusinessError } 13900005 - I/O error 4016 * @throws { BusinessError } 13900008 - Bad file descriptor 4017 * @throws { BusinessError } 13900010 - Try again 4018 * @throws { BusinessError } 13900013 - Bad address 4019 * @throws { BusinessError } 13900020 - Invalid argument 4020 * @throws { BusinessError } 13900024 - File too large 4021 * @throws { BusinessError } 13900025 - No space left on device 4022 * @throws { BusinessError } 13900034 - Operation would block 4023 * @throws { BusinessError } 13900041 - Quota exceeded 4024 * @throws { BusinessError } 13900042 - Unknown error 4025 * @syscap SystemCapability.FileManagement.File.FileIO 4026 * @since 9 4027 */ 4028/** 4029 * Write file. 4030 * 4031 * @param { number } fd - file descriptor. 4032 * @param { ArrayBuffer | string } buffer - buffer. 4033 * @param { object } [options] - options. 4034 * @param { AsyncCallback<number> } callback - The callback is used to return the number of bytes written to the file. 4035 * @throws { BusinessError } 13900001 - Operation not permitted 4036 * @throws { BusinessError } 13900004 - Interrupted system call 4037 * @throws { BusinessError } 13900005 - I/O error 4038 * @throws { BusinessError } 13900008 - Bad file descriptor 4039 * @throws { BusinessError } 13900010 - Try again 4040 * @throws { BusinessError } 13900013 - Bad address 4041 * @throws { BusinessError } 13900020 - Invalid argument 4042 * @throws { BusinessError } 13900024 - File too large 4043 * @throws { BusinessError } 13900025 - No space left on device 4044 * @throws { BusinessError } 13900034 - Operation would block 4045 * @throws { BusinessError } 13900041 - Quota exceeded 4046 * @throws { BusinessError } 13900042 - Unknown error 4047 * @syscap SystemCapability.FileManagement.File.FileIO 4048 * @crossplatform 4049 * @since 10 4050 */ 4051declare function write( 4052 fd: number, 4053 buffer: ArrayBuffer | string, 4054 options: { 4055 offset?: number; 4056 length?: number; 4057 encoding?: string; 4058 }, 4059 callback: AsyncCallback<number> 4060): void; 4061 4062/** 4063 * Write file with sync interface. 4064 * 4065 * @param { number } fd - file descriptor. 4066 * @param { ArrayBuffer | string } buffer - buffer. 4067 * @param { object } [options] - options. 4068 * @returns { number } Returns the number of bytes written to the file. 4069 * @throws { BusinessError } 13900001 - Operation not permitted 4070 * @throws { BusinessError } 13900004 - Interrupted system call 4071 * @throws { BusinessError } 13900005 - I/O error 4072 * @throws { BusinessError } 13900008 - Bad file descriptor 4073 * @throws { BusinessError } 13900010 - Try again 4074 * @throws { BusinessError } 13900013 - Bad address 4075 * @throws { BusinessError } 13900020 - Invalid argument 4076 * @throws { BusinessError } 13900024 - File too large 4077 * @throws { BusinessError } 13900025 - No space left on device 4078 * @throws { BusinessError } 13900034 - Operation would block 4079 * @throws { BusinessError } 13900041 - Quota exceeded 4080 * @throws { BusinessError } 13900042 - Unknown error 4081 * @syscap SystemCapability.FileManagement.File.FileIO 4082 * @since 9 4083 */ 4084/** 4085 * Write file with sync interface. 4086 * 4087 * @param { number } fd - file descriptor. 4088 * @param { ArrayBuffer | string } buffer - buffer. 4089 * @param { object } [options] - options. 4090 * @returns { number } Returns the number of bytes written to the file. 4091 * @throws { BusinessError } 13900001 - Operation not permitted 4092 * @throws { BusinessError } 13900004 - Interrupted system call 4093 * @throws { BusinessError } 13900005 - I/O error 4094 * @throws { BusinessError } 13900008 - Bad file descriptor 4095 * @throws { BusinessError } 13900010 - Try again 4096 * @throws { BusinessError } 13900013 - Bad address 4097 * @throws { BusinessError } 13900020 - Invalid argument 4098 * @throws { BusinessError } 13900024 - File too large 4099 * @throws { BusinessError } 13900025 - No space left on device 4100 * @throws { BusinessError } 13900034 - Operation would block 4101 * @throws { BusinessError } 13900041 - Quota exceeded 4102 * @throws { BusinessError } 13900042 - Unknown error 4103 * @syscap SystemCapability.FileManagement.File.FileIO 4104 * @crossplatform 4105 * @since 10 4106 */ 4107declare function writeSync( 4108 fd: number, 4109 buffer: ArrayBuffer | string, 4110 options?: { 4111 offset?: number; 4112 length?: number; 4113 encoding?: string; 4114 } 4115): number; 4116 4117/** 4118 * File object. 4119 * 4120 * @interface File 4121 * @syscap SystemCapability.FileManagement.File.FileIO 4122 * @since 9 4123 */ 4124/** 4125 * File object. 4126 * 4127 * @interface File 4128 * @syscap SystemCapability.FileManagement.File.FileIO 4129 * @crossplatform 4130 * @since 10 4131 */ 4132declare interface File { 4133 /** 4134 * @type { number } 4135 * @readonly 4136 * @syscap SystemCapability.FileManagement.File.FileIO 4137 * @since 9 4138 */ 4139 /** 4140 * @type { number } 4141 * @readonly 4142 * @syscap SystemCapability.FileManagement.File.FileIO 4143 * @crossplatform 4144 * @since 10 4145 */ 4146 readonly fd: number; 4147 4148 /** 4149 * File path 4150 * 4151 * @type { string } 4152 * @readonly 4153 * @throws { BusinessError } 13900005 - I/O error 4154 * @throws { BusinessError } 13900042 - Unknown error 4155 * @throws { BusinessError } 14300002 - Invalid uri 4156 * @syscap SystemCapability.FileManagement.File.FileIO 4157 * @since 10 4158 */ 4159 readonly path: string; 4160 4161 /** 4162 * File name 4163 * 4164 * @type { string } 4165 * @readonly 4166 * @throws { BusinessError } 13900005 - I/O error 4167 * @throws { BusinessError } 13900042 - Unknown error 4168 * @syscap SystemCapability.FileManagement.File.FileIO 4169 * @since 10 4170 */ 4171 readonly name: string; 4172 4173 /** 4174 * Lock file with blocking method. 4175 * 4176 * @param { boolean } exclusive - whether lock is exclusive. 4177 * @returns { Promise<void> } The promise returned by the function. 4178 * @throws { BusinessError } 13900004 - Interrupted system call 4179 * @throws { BusinessError } 13900008 - Bad file descriptor 4180 * @throws { BusinessError } 13900020 - Invalid argument 4181 * @throws { BusinessError } 13900034 - Operation would block 4182 * @throws { BusinessError } 13900042 - Unknown error 4183 * @throws { BusinessError } 13900043 - No record locks available 4184 * @syscap SystemCapability.FileManagement.File.FileIO 4185 * @since 9 4186 */ 4187 lock(exclusive?: boolean): Promise<void>; 4188 4189 /** 4190 * Lock file with blocking method. 4191 * 4192 * @param { AsyncCallback<void> } callback - Return the callback function. 4193 * @throws { BusinessError } 13900004 - Interrupted system call 4194 * @throws { BusinessError } 13900008 - Bad file descriptor 4195 * @throws { BusinessError } 13900020 - Invalid argument 4196 * @throws { BusinessError } 13900034 - Operation would block 4197 * @throws { BusinessError } 13900042 - Unknown error 4198 * @throws { BusinessError } 13900043 - No record locks available 4199 * @syscap SystemCapability.FileManagement.File.FileIO 4200 * @since 9 4201 */ 4202 lock(callback: AsyncCallback<void>): void; 4203 4204 /** 4205 * Lock file with blocking method. 4206 * 4207 * @param { boolean } exclusive - whether lock is exclusive. 4208 * @param { AsyncCallback<void> } callback - Return the callback function. 4209 * @throws { BusinessError } 13900004 - Interrupted system call 4210 * @throws { BusinessError } 13900008 - Bad file descriptor 4211 * @throws { BusinessError } 13900020 - Invalid argument 4212 * @throws { BusinessError } 13900034 - Operation would block 4213 * @throws { BusinessError } 13900042 - Unknown error 4214 * @throws { BusinessError } 13900043 - No record locks available 4215 * @syscap SystemCapability.FileManagement.File.FileIO 4216 * @since 9 4217 */ 4218 lock(exclusive: boolean, callback: AsyncCallback<void>): void; 4219 4220 /** 4221 * Try to lock file with returning results immediately. 4222 * 4223 * @param { boolean } exclusive - whether lock is exclusive. 4224 * @throws { BusinessError } 13900004 - Interrupted system call 4225 * @throws { BusinessError } 13900008 - Bad file descriptor 4226 * @throws { BusinessError } 13900020 - Invalid argument 4227 * @throws { BusinessError } 13900034 - Operation would block 4228 * @throws { BusinessError } 13900042 - Unknown error 4229 * @throws { BusinessError } 13900043 - No record locks available 4230 * @syscap SystemCapability.FileManagement.File.FileIO 4231 * @since 9 4232 */ 4233 tryLock(exclusive?: boolean): void; 4234 4235 /** 4236 * Unlock file. 4237 * 4238 * @throws { BusinessError } 13900004 - Interrupted system call 4239 * @throws { BusinessError } 13900008 - Bad file descriptor 4240 * @throws { BusinessError } 13900020 - Invalid argument 4241 * @throws { BusinessError } 13900034 - Operation would block 4242 * @throws { BusinessError } 13900042 - Unknown error 4243 * @throws { BusinessError } 13900043 - No record locks available 4244 * @syscap SystemCapability.FileManagement.File.FileIO 4245 * @since 9 4246 */ 4247 unlock(): void; 4248} 4249 4250/** 4251 * RandomAccessFile object. 4252 * 4253 * @interface RandomAccessFile 4254 * @syscap SystemCapability.FileManagement.File.FileIO 4255 * @since 10 4256 */ 4257declare interface RandomAccessFile { 4258 4259 /** 4260 * File descriptor 4261 * 4262 * @type { number } 4263 * @readonly 4264 * @syscap SystemCapability.FileManagement.File.FileIO 4265 * @since 10 4266 */ 4267 readonly fd: number; 4268 4269 /** 4270 * File pointer 4271 * 4272 * @type { number } 4273 * @readonly 4274 * @syscap SystemCapability.FileManagement.File.FileIO 4275 * @since 10 4276 */ 4277 readonly filePointer: number; 4278 4279 /** 4280 * Set file pointer. 4281 * 4282 * @param { number } filePointer - filePointer. 4283 * @throws { BusinessError } 13900004 - Interrupted system call 4284 * @throws { BusinessError } 13900005 - I/O error 4285 * @throws { BusinessError } 13900008 - Bad file descriptor 4286 * @throws { BusinessError } 13900020 - Invalid argument 4287 * @throws { BusinessError } 13900042 - Unknown error 4288 * @syscap SystemCapability.FileManagement.File.FileIO 4289 * @since 10 4290 */ 4291 setFilePointer(filePointer: number): void; 4292 4293 /** 4294 * Close randomAccessFile with sync interface. 4295 * 4296 * @throws { BusinessError } 13900004 - Interrupted system call 4297 * @throws { BusinessError } 13900005 - I/O error 4298 * @throws { BusinessError } 13900008 - Bad file descriptor 4299 * @throws { BusinessError } 13900025 - No space left on device 4300 * @throws { BusinessError } 13900041 - Quota exceeded 4301 * @throws { BusinessError } 13900042 - Unknown error 4302 * @syscap SystemCapability.FileManagement.File.FileIO 4303 * @since 10 4304 */ 4305 close(): void; 4306 4307 /** 4308 * Write randomAccessFile. 4309 * 4310 * @param { ArrayBuffer | string } buffer - buffer. 4311 * @param { object } [options] - options. 4312 * @returns { Promise<number> } Returns the number of bytes written to the file in promise mode. 4313 * @throws { BusinessError } 13900001 - Operation not permitted 4314 * @throws { BusinessError } 13900004 - Interrupted system call 4315 * @throws { BusinessError } 13900005 - I/O error 4316 * @throws { BusinessError } 13900008 - Bad file descriptor 4317 * @throws { BusinessError } 13900010 - Try again 4318 * @throws { BusinessError } 13900013 - Bad address 4319 * @throws { BusinessError } 13900020 - Invalid argument 4320 * @throws { BusinessError } 13900024 - File too large 4321 * @throws { BusinessError } 13900025 - No space left on device 4322 * @throws { BusinessError } 13900034 - Operation would block 4323 * @throws { BusinessError } 13900041 - Quota exceeded 4324 * @throws { BusinessError } 13900042 - Unknown error 4325 * @syscap SystemCapability.FileManagement.File.FileIO 4326 * @since 10 4327 */ 4328 write( 4329 buffer: ArrayBuffer | string, 4330 options?: { 4331 offset?: number; 4332 length?: number; 4333 encoding?: string; 4334 } 4335 ): Promise<number>; 4336 4337 /** 4338 * Write randomAccessFile. 4339 * 4340 * @param { ArrayBuffer | string } buffer - buffer. 4341 * @param { AsyncCallback<number> } callback - The callback is used to return the number of bytes written to the file. 4342 * @throws { BusinessError } 13900001 - Operation not permitted 4343 * @throws { BusinessError } 13900004 - Interrupted system call 4344 * @throws { BusinessError } 13900005 - I/O error 4345 * @throws { BusinessError } 13900008 - Bad file descriptor 4346 * @throws { BusinessError } 13900010 - Try again 4347 * @throws { BusinessError } 13900013 - Bad address 4348 * @throws { BusinessError } 13900020 - Invalid argument 4349 * @throws { BusinessError } 13900024 - File too large 4350 * @throws { BusinessError } 13900025 - No space left on device 4351 * @throws { BusinessError } 13900034 - Operation would block 4352 * @throws { BusinessError } 13900041 - Quota exceeded 4353 * @throws { BusinessError } 13900042 - Unknown error 4354 * @syscap SystemCapability.FileManagement.File.FileIO 4355 * @since 10 4356 */ 4357 write(buffer: ArrayBuffer | string, callback: AsyncCallback<number>): void; 4358 4359 /** 4360 * Write randomAccessFile. 4361 * 4362 * @param { ArrayBuffer | string } buffer - buffer. 4363 * @param { object } [options] - options. 4364 * @param { AsyncCallback<number> } callback - The callback is used to return the number of bytes written to the file. 4365 * @throws { BusinessError } 13900001 - Operation not permitted 4366 * @throws { BusinessError } 13900004 - Interrupted system call 4367 * @throws { BusinessError } 13900005 - I/O error 4368 * @throws { BusinessError } 13900008 - Bad file descriptor 4369 * @throws { BusinessError } 13900010 - Try again 4370 * @throws { BusinessError } 13900013 - Bad address 4371 * @throws { BusinessError } 13900020 - Invalid argument 4372 * @throws { BusinessError } 13900024 - File too large 4373 * @throws { BusinessError } 13900025 - No space left on device 4374 * @throws { BusinessError } 13900034 - Operation would block 4375 * @throws { BusinessError } 13900041 - Quota exceeded 4376 * @throws { BusinessError } 13900042 - Unknown error 4377 * @syscap SystemCapability.FileManagement.File.FileIO 4378 * @since 10 4379 */ 4380 write( 4381 buffer: ArrayBuffer | string, 4382 options: { 4383 offset?: number; 4384 length?: number; 4385 encoding?: string; 4386 }, 4387 callback: AsyncCallback<number> 4388 ): void; 4389 4390 /** 4391 * Write randomAccessFile with sync interface. 4392 * 4393 * @param { ArrayBuffer | string } buffer - buffer. 4394 * @param { object } [options] - options. 4395 * @returns { number } Returns the number of bytes written to the file. 4396 * @throws { BusinessError } 13900001 - Operation not permitted 4397 * @throws { BusinessError } 13900004 - Interrupted system call 4398 * @throws { BusinessError } 13900005 - I/O error 4399 * @throws { BusinessError } 13900008 - Bad file descriptor 4400 * @throws { BusinessError } 13900010 - Try again 4401 * @throws { BusinessError } 13900013 - Bad address 4402 * @throws { BusinessError } 13900020 - Invalid argument 4403 * @throws { BusinessError } 13900024 - File too large 4404 * @throws { BusinessError } 13900025 - No space left on device 4405 * @throws { BusinessError } 13900034 - Operation would block 4406 * @throws { BusinessError } 13900041 - Quota exceeded 4407 * @throws { BusinessError } 13900042 - Unknown error 4408 * @syscap SystemCapability.FileManagement.File.FileIO 4409 * @since 10 4410 */ 4411 writeSync( 4412 buffer: ArrayBuffer | string, 4413 options?: { 4414 offset?: number; 4415 length?: number; 4416 encoding?: string; 4417 } 4418 ): number; 4419 /** 4420 * Read randomAccessFile. 4421 * 4422 * @param { ArrayBuffer } buffer - buffer. 4423 * @param { object } [options] - options. 4424 * @returns { Promise<number> } Returns the number of file bytes read to buffer in promise mode. 4425 * @throws { BusinessError } 13900004 - Interrupted system call 4426 * @throws { BusinessError } 13900005 - I/O error 4427 * @throws { BusinessError } 13900008 - Bad file descriptor 4428 * @throws { BusinessError } 13900010 - Try again 4429 * @throws { BusinessError } 13900013 - Bad address 4430 * @throws { BusinessError } 13900019 - Is a directory 4431 * @throws { BusinessError } 13900020 - Invalid argument 4432 * @throws { BusinessError } 13900034 - Operation would block 4433 * @throws { BusinessError } 13900042 - Unknown error 4434 * @syscap SystemCapability.FileManagement.File.FileIO 4435 * @since 10 4436 */ 4437 read( 4438 buffer: ArrayBuffer, 4439 options?: { 4440 offset?: number; 4441 length?: number; 4442 } 4443 ): Promise<number>; 4444 4445 /** 4446 * Read randomAccessFile. 4447 * 4448 * @param { ArrayBuffer } buffer - buffer. 4449 * @param { AsyncCallback<number> } callback - The callback is used to return the number of file bytes read to buffer. 4450 * @throws { BusinessError } 13900004 - Interrupted system call 4451 * @throws { BusinessError } 13900005 - I/O error 4452 * @throws { BusinessError } 13900008 - Bad file descriptor 4453 * @throws { BusinessError } 13900010 - Try again 4454 * @throws { BusinessError } 13900013 - Bad address 4455 * @throws { BusinessError } 13900019 - Is a directory 4456 * @throws { BusinessError } 13900020 - Invalid argument 4457 * @throws { BusinessError } 13900034 - Operation would block 4458 * @throws { BusinessError } 13900042 - Unknown error 4459 * @syscap SystemCapability.FileManagement.File.FileIO 4460 * @since 10 4461 */ 4462 read(buffer: ArrayBuffer, callback: AsyncCallback<number>): void; 4463 4464 /** 4465 * Read randomAccessFile. 4466 * 4467 * @param { ArrayBuffer } buffer - buffer. 4468 * @param { object } [options] - options. 4469 * @param { AsyncCallback<number> } callback - The callback is used to return the number of file bytes read to buffer. 4470 * @throws { BusinessError } 13900004 - Interrupted system call 4471 * @throws { BusinessError } 13900005 - I/O error 4472 * @throws { BusinessError } 13900008 - Bad file descriptor 4473 * @throws { BusinessError } 13900010 - Try again 4474 * @throws { BusinessError } 13900013 - Bad address 4475 * @throws { BusinessError } 13900019 - Is a directory 4476 * @throws { BusinessError } 13900020 - Invalid argument 4477 * @throws { BusinessError } 13900034 - Operation would block 4478 * @throws { BusinessError } 13900042 - Unknown error 4479 * @syscap SystemCapability.FileManagement.File.FileIO 4480 * @since 10 4481 */ 4482 read( 4483 buffer: ArrayBuffer, 4484 options: { 4485 offset?: number; 4486 length?: number; 4487 }, 4488 callback: AsyncCallback<number> 4489 ): void; 4490 4491 /** 4492 * Read randomAccessFile with sync interface. 4493 * 4494 * @param { ArrayBuffer } buffer - buffer. 4495 * @param { object } [options] - options. 4496 * @returns { number } Returns the number of file bytes read to buffer. 4497 * @throws { BusinessError } 13900004 - Interrupted system call 4498 * @throws { BusinessError } 13900005 - I/O error 4499 * @throws { BusinessError } 13900008 - Bad file descriptor 4500 * @throws { BusinessError } 13900010 - Try again 4501 * @throws { BusinessError } 13900013 - Bad address 4502 * @throws { BusinessError } 13900019 - Is a directory 4503 * @throws { BusinessError } 13900020 - Invalid argument 4504 * @throws { BusinessError } 13900034 - Operation would block 4505 * @throws { BusinessError } 13900042 - Unknown error 4506 * @syscap SystemCapability.FileManagement.File.FileIO 4507 * @since 10 4508 */ 4509 readSync( 4510 buffer: ArrayBuffer, 4511 options?: { 4512 offset?: number; 4513 length?: number; 4514 } 4515 ): number; 4516} 4517 4518/** 4519 * Stat object. 4520 * 4521 * @interface Stat 4522 * @syscap SystemCapability.FileManagement.File.FileIO 4523 * @since 9 4524 */ 4525/** 4526 * Stat object. 4527 * 4528 * @interface Stat 4529 * @syscap SystemCapability.FileManagement.File.FileIO 4530 * @crossplatform 4531 * @since 10 4532 */ 4533declare interface Stat { 4534 /** 4535 * @type { bigint } 4536 * @readonly 4537 * @throws { BusinessError } 13900005 - I/O error 4538 * @throws { BusinessError } 13900042 - Unknown error 4539 * @syscap SystemCapability.FileManagement.File.FileIO 4540 * @since 9 4541 */ 4542 /** 4543 * @type { bigint } 4544 * @readonly 4545 * @throws { BusinessError } 13900005 - I/O error 4546 * @throws { BusinessError } 13900042 - Unknown error 4547 * @syscap SystemCapability.FileManagement.File.FileIO 4548 * @crossplatform 4549 * @since 10 4550 */ 4551 readonly ino: bigint; 4552 /** 4553 * @type { number } 4554 * @readonly 4555 * @throws { BusinessError } 13900005 - I/O error 4556 * @throws { BusinessError } 13900042 - Unknown error 4557 * @syscap SystemCapability.FileManagement.File.FileIO 4558 * @since 9 4559 */ 4560 /** 4561 * @type { number } 4562 * @readonly 4563 * @throws { BusinessError } 13900005 - I/O error 4564 * @throws { BusinessError } 13900042 - Unknown error 4565 * @syscap SystemCapability.FileManagement.File.FileIO 4566 * @crossplatform 4567 * @since 10 4568 */ 4569 readonly mode: number; 4570 /** 4571 * @type { number } 4572 * @readonly 4573 * @throws { BusinessError } 13900005 - I/O error 4574 * @throws { BusinessError } 13900042 - Unknown error 4575 * @throws { BusinessError } 13900005 - I/O error 4576 * @throws { BusinessError } 13900042 - Unknown error 4577 * @syscap SystemCapability.FileManagement.File.FileIO 4578 * @since 9 4579 */ 4580 /** 4581 * @type { number } 4582 * @readonly 4583 * @throws { BusinessError } 13900005 - I/O error 4584 * @throws { BusinessError } 13900042 - Unknown error 4585 * @throws { BusinessError } 13900005 - I/O error 4586 * @throws { BusinessError } 13900042 - Unknown error 4587 * @syscap SystemCapability.FileManagement.File.FileIO 4588 * @crossplatform 4589 * @since 10 4590 */ 4591 readonly uid: number; 4592 /** 4593 * @type { number } 4594 * @readonly 4595 * @throws { BusinessError } 13900005 - I/O error 4596 * @throws { BusinessError } 13900042 - Unknown error 4597 * @syscap SystemCapability.FileManagement.File.FileIO 4598 * @since 9 4599 */ 4600 /** 4601 * @type { number } 4602 * @readonly 4603 * @throws { BusinessError } 13900005 - I/O error 4604 * @throws { BusinessError } 13900042 - Unknown error 4605 * @syscap SystemCapability.FileManagement.File.FileIO 4606 * @crossplatform 4607 * @since 10 4608 */ 4609 readonly gid: number; 4610 /** 4611 * @type { number } 4612 * @readonly 4613 * @throws { BusinessError } 13900005 - I/O error 4614 * @throws { BusinessError } 13900042 - Unknown error 4615 * @syscap SystemCapability.FileManagement.File.FileIO 4616 * @since 9 4617 */ 4618 /** 4619 * @type { number } 4620 * @readonly 4621 * @throws { BusinessError } 13900005 - I/O error 4622 * @throws { BusinessError } 13900042 - Unknown error 4623 * @syscap SystemCapability.FileManagement.File.FileIO 4624 * @crossplatform 4625 * @since 10 4626 */ 4627 readonly size: number; 4628 /** 4629 * @type { number } 4630 * @readonly 4631 * @throws { BusinessError } 13900005 - I/O error 4632 * @throws { BusinessError } 13900042 - Unknown error 4633 * @syscap SystemCapability.FileManagement.File.FileIO 4634 * @since 9 4635 */ 4636 /** 4637 * @type { number } 4638 * @readonly 4639 * @throws { BusinessError } 13900005 - I/O error 4640 * @throws { BusinessError } 13900042 - Unknown error 4641 * @syscap SystemCapability.FileManagement.File.FileIO 4642 * @crossplatform 4643 * @since 10 4644 */ 4645 readonly atime: number; 4646 /** 4647 * @type { number } 4648 * @readonly 4649 * @throws { BusinessError } 13900005 - I/O error 4650 * @throws { BusinessError } 13900042 - Unknown error 4651 * @syscap SystemCapability.FileManagement.File.FileIO 4652 * @since 9 4653 */ 4654 /** 4655 * @type { number } 4656 * @readonly 4657 * @throws { BusinessError } 13900005 - I/O error 4658 * @throws { BusinessError } 13900042 - Unknown error 4659 * @syscap SystemCapability.FileManagement.File.FileIO 4660 * @crossplatform 4661 * @since 10 4662 */ 4663 readonly mtime: number; 4664 /** 4665 * @type { number } 4666 * @readonly 4667 * @throws { BusinessError } 13900005 - I/O error 4668 * @throws { BusinessError } 13900042 - Unknown error 4669 * @syscap SystemCapability.FileManagement.File.FileIO 4670 * @since 9 4671 */ 4672 /** 4673 * @type { number } 4674 * @readonly 4675 * @throws { BusinessError } 13900005 - I/O error 4676 * @throws { BusinessError } 13900042 - Unknown error 4677 * @syscap SystemCapability.FileManagement.File.FileIO 4678 * @crossplatform 4679 * @since 10 4680 */ 4681 readonly ctime: number; 4682 /** 4683 * Whether path/fd is block device. 4684 * 4685 * @returns { boolean } Returns whether the path/fd point to a block device or not. 4686 * @throws { BusinessError } 13900005 - I/O error 4687 * @throws { BusinessError } 13900042 - Unknown error 4688 * @syscap SystemCapability.FileManagement.File.FileIO 4689 * @since 9 4690 */ 4691 /** 4692 * Whether path/fd is block device. 4693 * 4694 * @returns { boolean } Returns whether the path/fd point to a block device or not. 4695 * @throws { BusinessError } 13900005 - I/O error 4696 * @throws { BusinessError } 13900042 - Unknown error 4697 * @syscap SystemCapability.FileManagement.File.FileIO 4698 * @crossplatform 4699 * @since 10 4700 */ 4701 isBlockDevice(): boolean; 4702 /** 4703 * Whether path/fd is character device. 4704 * 4705 * @returns { boolean } Returns whether the path/fd point to a character device or not. 4706 * @throws { BusinessError } 13900005 - I/O error 4707 * @throws { BusinessError } 13900042 - Unknown error 4708 * @syscap SystemCapability.FileManagement.File.FileIO 4709 * @since 9 4710 */ 4711 /** 4712 * Whether path/fd is character device. 4713 * 4714 * @returns { boolean } Returns whether the path/fd point to a character device or not. 4715 * @throws { BusinessError } 13900005 - I/O error 4716 * @throws { BusinessError } 13900042 - Unknown error 4717 * @syscap SystemCapability.FileManagement.File.FileIO 4718 * @crossplatform 4719 * @since 10 4720 */ 4721 isCharacterDevice(): boolean; 4722 /** 4723 * Whether path/fd is directory. 4724 * 4725 * @returns { boolean } Returns whether the path/fd point to a directory or not. 4726 * @throws { BusinessError } 13900005 - I/O error 4727 * @throws { BusinessError } 13900042 - Unknown error 4728 * @syscap SystemCapability.FileManagement.File.FileIO 4729 * @since 9 4730 */ 4731 /** 4732 * Whether path/fd is directory. 4733 * 4734 * @returns { boolean } Returns whether the path/fd point to a directory or not. 4735 * @throws { BusinessError } 13900005 - I/O error 4736 * @throws { BusinessError } 13900042 - Unknown error 4737 * @syscap SystemCapability.FileManagement.File.FileIO 4738 * @crossplatform 4739 * @since 10 4740 */ 4741 isDirectory(): boolean; 4742 /** 4743 * Whether path/fd is fifo. 4744 * 4745 * @returns { boolean } Returns whether the path/fd point to a fifo file or not. 4746 * @throws { BusinessError } 13900005 - I/O error 4747 * @throws { BusinessError } 13900042 - Unknown error 4748 * @syscap SystemCapability.FileManagement.File.FileIO 4749 * @since 9 4750 */ 4751 /** 4752 * Whether path/fd is fifo. 4753 * 4754 * @returns { boolean } Returns whether the path/fd point to a fifo file or not. 4755 * @throws { BusinessError } 13900005 - I/O error 4756 * @throws { BusinessError } 13900042 - Unknown error 4757 * @syscap SystemCapability.FileManagement.File.FileIO 4758 * @crossplatform 4759 * @since 10 4760 */ 4761 isFIFO(): boolean; 4762 /** 4763 * Whether path/fd is file. 4764 * 4765 * @returns { boolean } Returns whether the path/fd point to a normal file or not. 4766 * @throws { BusinessError } 13900005 - I/O error 4767 * @throws { BusinessError } 13900042 - Unknown error 4768 * @syscap SystemCapability.FileManagement.File.FileIO 4769 * @since 9 4770 */ 4771 /** 4772 * Whether path/fd is file. 4773 * 4774 * @returns { boolean } Returns whether the path/fd point to a normal file or not. 4775 * @throws { BusinessError } 13900005 - I/O error 4776 * @throws { BusinessError } 13900042 - Unknown error 4777 * @syscap SystemCapability.FileManagement.File.FileIO 4778 * @crossplatform 4779 * @since 10 4780 */ 4781 isFile(): boolean; 4782 /** 4783 * Whether path/fd is socket. 4784 * 4785 * @returns { boolean } Returns whether the path/fd point to a socket file or not. 4786 * @throws { BusinessError } 13900005 - I/O error 4787 * @throws { BusinessError } 13900042 - Unknown error 4788 * @syscap SystemCapability.FileManagement.File.FileIO 4789 * @since 9 4790 */ 4791 /** 4792 * Whether path/fd is socket. 4793 * 4794 * @returns { boolean } Returns whether the path/fd point to a socket file or not. 4795 * @throws { BusinessError } 13900005 - I/O error 4796 * @throws { BusinessError } 13900042 - Unknown error 4797 * @syscap SystemCapability.FileManagement.File.FileIO 4798 * @crossplatform 4799 * @since 10 4800 */ 4801 isSocket(): boolean; 4802 /** 4803 * Whether path/fd is symbolic link. 4804 * 4805 * @returns { boolean } Returns whether the path/fd point to a symbolic link or not. 4806 * @throws { BusinessError } 13900005 - I/O error 4807 * @throws { BusinessError } 13900042 - Unknown error 4808 * @syscap SystemCapability.FileManagement.File.FileIO 4809 * @since 9 4810 */ 4811 /** 4812 * Whether path/fd is symbolic link. 4813 * 4814 * @returns { boolean } Returns whether the path/fd point to a symbolic link or not. 4815 * @throws { BusinessError } 13900005 - I/O error 4816 * @throws { BusinessError } 13900042 - Unknown error 4817 * @syscap SystemCapability.FileManagement.File.FileIO 4818 * @crossplatform 4819 * @since 10 4820 */ 4821 isSymbolicLink(): boolean; 4822} 4823 4824/** 4825 * Stream object 4826 * 4827 * @interface Stream 4828 * @syscap SystemCapability.FileManagement.File.FileIO 4829 * @since 9 4830 */ 4831declare interface Stream { 4832 /** 4833 * Close stream. 4834 * 4835 * @returns { Promise<void> } The promise returned by the function. 4836 * @throws { BusinessError } 13900004 - Interrupted system call 4837 * @throws { BusinessError } 13900005 - I/O error 4838 * @throws { BusinessError } 13900008 - Bad file descriptor 4839 * @throws { BusinessError } 13900025 - No space left on device 4840 * @throws { BusinessError } 13900041 - Quota exceeded 4841 * @throws { BusinessError } 13900042 - Unknown error 4842 * @syscap SystemCapability.FileManagement.File.FileIO 4843 * @since 9 4844 */ 4845 close(): Promise<void>; 4846 4847 /** 4848 * Close stream. 4849 * 4850 * @param { AsyncCallback<void> } callback - Return the callback function. 4851 * @throws { BusinessError } 13900004 - Interrupted system call 4852 * @throws { BusinessError } 13900005 - I/O error 4853 * @throws { BusinessError } 13900008 - Bad file descriptor 4854 * @throws { BusinessError } 13900025 - No space left on device 4855 * @throws { BusinessError } 13900041 - Quota exceeded 4856 * @throws { BusinessError } 13900042 - Unknown error 4857 * @syscap SystemCapability.FileManagement.File.FileIO 4858 * @since 9 4859 */ 4860 close(callback: AsyncCallback<void>): void; 4861 4862 /** 4863 * Close stream with sync interface. 4864 * 4865 * @throws { BusinessError } 13900004 - Interrupted system call 4866 * @throws { BusinessError } 13900005 - I/O error 4867 * @throws { BusinessError } 13900008 - Bad file descriptor 4868 * @throws { BusinessError } 13900025 - No space left on device 4869 * @throws { BusinessError } 13900041 - Quota exceeded 4870 * @throws { BusinessError } 13900042 - Unknown error 4871 * @syscap SystemCapability.FileManagement.File.FileIO 4872 * @since 9 4873 */ 4874 closeSync(): void; 4875 /** 4876 * Flush stream. 4877 * 4878 * @returns { Promise<void> } The promise returned by the function. 4879 * @throws { BusinessError } 13900001 - Operation not permitted 4880 * @throws { BusinessError } 13900004 - Interrupted system call 4881 * @throws { BusinessError } 13900005 - I/O error 4882 * @throws { BusinessError } 13900008 - Bad file descriptor 4883 * @throws { BusinessError } 13900010 - Try again 4884 * @throws { BusinessError } 13900013 - Bad address 4885 * @throws { BusinessError } 13900020 - Invalid argument 4886 * @throws { BusinessError } 13900024 - File too large 4887 * @throws { BusinessError } 13900025 - No space left on device 4888 * @throws { BusinessError } 13900034 - Operation would block 4889 * @throws { BusinessError } 13900041 - Quota exceeded 4890 * @throws { BusinessError } 13900042 - Unknown error 4891 * @syscap SystemCapability.FileManagement.File.FileIO 4892 * @since 9 4893 */ 4894 flush(): Promise<void>; 4895 4896 /** 4897 * Flush stream. 4898 * 4899 * @param { AsyncCallback<void> } callback - Return the callback function. 4900 * @throws { BusinessError } 13900001 - Operation not permitted 4901 * @throws { BusinessError } 13900004 - Interrupted system call 4902 * @throws { BusinessError } 13900005 - I/O error 4903 * @throws { BusinessError } 13900008 - Bad file descriptor 4904 * @throws { BusinessError } 13900010 - Try again 4905 * @throws { BusinessError } 13900013 - Bad address 4906 * @throws { BusinessError } 13900020 - Invalid argument 4907 * @throws { BusinessError } 13900024 - File too large 4908 * @throws { BusinessError } 13900025 - No space left on device 4909 * @throws { BusinessError } 13900034 - Operation would block 4910 * @throws { BusinessError } 13900041 - Quota exceeded 4911 * @throws { BusinessError } 13900042 - Unknown error 4912 * @syscap SystemCapability.FileManagement.File.FileIO 4913 * @since 9 4914 */ 4915 flush(callback: AsyncCallback<void>): void; 4916 /** 4917 * Flush stream with sync interface. 4918 * 4919 * @throws { BusinessError } 13900001 - Operation not permitted 4920 * @throws { BusinessError } 13900004 - Interrupted system call 4921 * @throws { BusinessError } 13900005 - I/O error 4922 * @throws { BusinessError } 13900008 - Bad file descriptor 4923 * @throws { BusinessError } 13900010 - Try again 4924 * @throws { BusinessError } 13900013 - Bad address 4925 * @throws { BusinessError } 13900020 - Invalid argument 4926 * @throws { BusinessError } 13900024 - File too large 4927 * @throws { BusinessError } 13900025 - No space left on device 4928 * @throws { BusinessError } 13900034 - Operation would block 4929 * @throws { BusinessError } 13900041 - Quota exceeded 4930 * @throws { BusinessError } 13900042 - Unknown error 4931 * @syscap SystemCapability.FileManagement.File.FileIO 4932 * @since 9 4933 */ 4934 flushSync(): void; 4935 /** 4936 * Write stream. 4937 * 4938 * @param { ArrayBuffer | string } buffer - buffer. 4939 * @param { object } [options] - options. 4940 * @returns { Promise<number> } Returns the number of file bytes written to file in promise mode. 4941 * @throws { BusinessError } 13900001 - Operation not permitted 4942 * @throws { BusinessError } 13900004 - Interrupted system call 4943 * @throws { BusinessError } 13900005 - I/O error 4944 * @throws { BusinessError } 13900008 - Bad file descriptor 4945 * @throws { BusinessError } 13900010 - Try again 4946 * @throws { BusinessError } 13900013 - Bad address 4947 * @throws { BusinessError } 13900020 - Invalid argument 4948 * @throws { BusinessError } 13900024 - File too large 4949 * @throws { BusinessError } 13900025 - No space left on device 4950 * @throws { BusinessError } 13900034 - Operation would block 4951 * @throws { BusinessError } 13900041 - Quota exceeded 4952 * @throws { BusinessError } 13900042 - Unknown error 4953 * @syscap SystemCapability.FileManagement.File.FileIO 4954 * @since 9 4955 */ 4956 write( 4957 buffer: ArrayBuffer | string, 4958 options?: { 4959 offset?: number; 4960 length?: number; 4961 encoding?: string; 4962 } 4963 ): Promise<number>; 4964 4965 /** 4966 * Write stream. 4967 * 4968 * @param { ArrayBuffer | string } buffer - buffer. 4969 * @param { AsyncCallback<number> } callback - The callback is used to return the number of file bytes written to file. 4970 * @throws { BusinessError } 13900001 - Operation not permitted 4971 * @throws { BusinessError } 13900004 - Interrupted system call 4972 * @throws { BusinessError } 13900005 - I/O error 4973 * @throws { BusinessError } 13900008 - Bad file descriptor 4974 * @throws { BusinessError } 13900010 - Try again 4975 * @throws { BusinessError } 13900013 - Bad address 4976 * @throws { BusinessError } 13900020 - Invalid argument 4977 * @throws { BusinessError } 13900024 - File too large 4978 * @throws { BusinessError } 13900025 - No space left on device 4979 * @throws { BusinessError } 13900034 - Operation would block 4980 * @throws { BusinessError } 13900041 - Quota exceeded 4981 * @throws { BusinessError } 13900042 - Unknown error 4982 * @syscap SystemCapability.FileManagement.File.FileIO 4983 * @since 9 4984 */ 4985 write(buffer: ArrayBuffer | string, callback: AsyncCallback<number>): void; 4986 4987 /** 4988 * Write stream. 4989 * 4990 * @param { ArrayBuffer | string } buffer - buffer. 4991 * @param { object } [options] - options. 4992 * @param { AsyncCallback<number> } callback - The callback is used to return the number of file bytes written to file. 4993 * @throws { BusinessError } 13900001 - Operation not permitted 4994 * @throws { BusinessError } 13900004 - Interrupted system call 4995 * @throws { BusinessError } 13900005 - I/O error 4996 * @throws { BusinessError } 13900008 - Bad file descriptor 4997 * @throws { BusinessError } 13900010 - Try again 4998 * @throws { BusinessError } 13900013 - Bad address 4999 * @throws { BusinessError } 13900020 - Invalid argument 5000 * @throws { BusinessError } 13900024 - File too large 5001 * @throws { BusinessError } 13900025 - No space left on device 5002 * @throws { BusinessError } 13900034 - Operation would block 5003 * @throws { BusinessError } 13900041 - Quota exceeded 5004 * @throws { BusinessError } 13900042 - Unknown error 5005 * @syscap SystemCapability.FileManagement.File.FileIO 5006 * @since 9 5007 */ 5008 write( 5009 buffer: ArrayBuffer | string, 5010 options: { 5011 offset?: number; 5012 length?: number; 5013 encoding?: string; 5014 }, 5015 callback: AsyncCallback<number> 5016 ): void; 5017 /** 5018 * Write stream with sync interface. 5019 * 5020 * @param { ArrayBuffer | string } buffer - buffer. 5021 * @param { object } [options] - options. 5022 * @returns { number } Returns the number of file bytes written to file. 5023 * @throws { BusinessError } 13900001 - Operation not permitted 5024 * @throws { BusinessError } 13900004 - Interrupted system call 5025 * @throws { BusinessError } 13900005 - I/O error 5026 * @throws { BusinessError } 13900008 - Bad file descriptor 5027 * @throws { BusinessError } 13900010 - Try again 5028 * @throws { BusinessError } 13900013 - Bad address 5029 * @throws { BusinessError } 13900020 - Invalid argument 5030 * @throws { BusinessError } 13900024 - File too large 5031 * @throws { BusinessError } 13900025 - No space left on device 5032 * @throws { BusinessError } 13900034 - Operation would block 5033 * @throws { BusinessError } 13900041 - Quota exceeded 5034 * @throws { BusinessError } 13900042 - Unknown error 5035 * @syscap SystemCapability.FileManagement.File.FileIO 5036 * @since 9 5037 */ 5038 writeSync( 5039 buffer: ArrayBuffer | string, 5040 options?: { 5041 offset?: number; 5042 length?: number; 5043 encoding?: string; 5044 } 5045 ): number; 5046 /** 5047 * Read stream. 5048 * 5049 * @param { ArrayBuffer } buffer - buffer. 5050 * @param { object } [options] - options. 5051 * @returns { Promise<number> } Returns the number of file bytes read to buffer in promise mode. 5052 * @throws { BusinessError } 13900004 - Interrupted system call 5053 * @throws { BusinessError } 13900005 - I/O error 5054 * @throws { BusinessError } 13900008 - Bad file descriptor 5055 * @throws { BusinessError } 13900010 - Try again 5056 * @throws { BusinessError } 13900013 - Bad address 5057 * @throws { BusinessError } 13900019 - Is a directory 5058 * @throws { BusinessError } 13900020 - Invalid argument 5059 * @throws { BusinessError } 13900034 - Operation would block 5060 * @throws { BusinessError } 13900042 - Unknown error 5061 * @syscap SystemCapability.FileManagement.File.FileIO 5062 * @since 9 5063 */ 5064 read( 5065 buffer: ArrayBuffer, 5066 options?: { 5067 offset?: number; 5068 length?: number; 5069 } 5070 ): Promise<number>; 5071 5072 /** 5073 * Read stream. 5074 * 5075 * @param { ArrayBuffer } buffer - buffer. 5076 * @param { AsyncCallback<number> } callback - The callback is used to return the number of file bytes read to buffer. 5077 * @throws { BusinessError } 13900004 - Interrupted system call 5078 * @throws { BusinessError } 13900005 - I/O error 5079 * @throws { BusinessError } 13900008 - Bad file descriptor 5080 * @throws { BusinessError } 13900010 - Try again 5081 * @throws { BusinessError } 13900013 - Bad address 5082 * @throws { BusinessError } 13900019 - Is a directory 5083 * @throws { BusinessError } 13900020 - Invalid argument 5084 * @throws { BusinessError } 13900034 - Operation would block 5085 * @throws { BusinessError } 13900042 - Unknown error 5086 * @syscap SystemCapability.FileManagement.File.FileIO 5087 * @since 9 5088 */ 5089 read(buffer: ArrayBuffer, callback: AsyncCallback<number>): void; 5090 5091 /** 5092 * Read stream. 5093 * 5094 * @param { ArrayBuffer } buffer - buffer. 5095 * @param { object } [options] - options. 5096 * @param { AsyncCallback<number> } callback - The callback is used to return the number of file bytes read to buffer. 5097 * @throws { BusinessError } 13900004 - Interrupted system call 5098 * @throws { BusinessError } 13900005 - I/O error 5099 * @throws { BusinessError } 13900008 - Bad file descriptor 5100 * @throws { BusinessError } 13900010 - Try again 5101 * @throws { BusinessError } 13900013 - Bad address 5102 * @throws { BusinessError } 13900019 - Is a directory 5103 * @throws { BusinessError } 13900020 - Invalid argument 5104 * @throws { BusinessError } 13900034 - Operation would block 5105 * @throws { BusinessError } 13900042 - Unknown error 5106 * @syscap SystemCapability.FileManagement.File.FileIO 5107 * @since 9 5108 */ 5109 read( 5110 buffer: ArrayBuffer, 5111 options: { 5112 offset?: number; 5113 length?: number; 5114 }, 5115 callback: AsyncCallback<number> 5116 ): void; 5117 5118 /** 5119 * Read stream with sync interface. 5120 * 5121 * @param { ArrayBuffer } buffer - buffer. 5122 * @param { object } [options] - options. 5123 * @returns { number } Returns the number of file bytes read to file. 5124 * @throws { BusinessError } 13900004 - Interrupted system call 5125 * @throws { BusinessError } 13900005 - I/O error 5126 * @throws { BusinessError } 13900008 - Bad file descriptor 5127 * @throws { BusinessError } 13900010 - Try again 5128 * @throws { BusinessError } 13900013 - Bad address 5129 * @throws { BusinessError } 13900019 - Is a directory 5130 * @throws { BusinessError } 13900020 - Invalid argument 5131 * @throws { BusinessError } 13900034 - Operation would block 5132 * @throws { BusinessError } 13900042 - Unknown error 5133 * @syscap SystemCapability.FileManagement.File.FileIO 5134 * @since 9 5135 */ 5136 readSync( 5137 buffer: ArrayBuffer, 5138 options?: { 5139 offset?: number; 5140 length?: number; 5141 } 5142 ): number; 5143} 5144 5145/** 5146 * Implements watcher event listening. 5147 * 5148 * @interface WatchEventListener 5149 * @syscap SystemCapability.FileManagement.File.FileIO 5150 * @since 10 5151 */ 5152export interface WatchEventListener { 5153 /** 5154 * Specifies the callback function to be invoked. 5155 * 5156 * @param { WatchEvent } event - Event type for the callback to invoke. 5157 * @syscap SystemCapability.FileManagement.File.FileIO 5158 * @since 10 5159 */ 5160 (event: WatchEvent): void; 5161} 5162 5163/** 5164 * Event Listening. 5165 * 5166 * @interface WatchEvent 5167 * @syscap SystemCapability.FileManagement.File.FileIO 5168 * @since 10 5169 */ 5170export interface WatchEvent { 5171 /** 5172 * File name. 5173 * 5174 * @type { string } 5175 * @readonly 5176 * @syscap SystemCapability.FileManagement.File.FileIO 5177 * @since 10 5178 */ 5179 readonly fileName: string; 5180 5181 /** 5182 * Event happened. 5183 * 5184 * @type { number } 5185 * @readonly 5186 * @syscap SystemCapability.FileManagement.File.FileIO 5187 * @since 10 5188 */ 5189 readonly event: number; 5190 5191 /** 5192 * Associated rename event. 5193 * 5194 * @type { number } 5195 * @readonly 5196 * @syscap SystemCapability.FileManagement.File.FileIO 5197 * @since 10 5198 */ 5199 readonly cookie: number; 5200} 5201 5202/** 5203 * Watcher object 5204 * 5205 * @interface Watcher 5206 * @syscap SystemCapability.FileManagement.File.FileIO 5207 * @since 10 5208 */ 5209export interface Watcher { 5210 /** 5211 * Start watcher. 5212 * 5213 * @throws { BusinessError } 13900002 - No such file or directory 5214 * @throws { BusinessError } 13900008 - Bad file descriptor 5215 * @throws { BusinessError } 13900011 - Out of memory 5216 * @throws { BusinessError } 13900012 - Permission denied 5217 * @throws { BusinessError } 13900013 - Bad address 5218 * @throws { BusinessError } 13900015 - File exists 5219 * @throws { BusinessError } 13900018 - Not a directory 5220 * @throws { BusinessError } 13900020 - Invalid argument 5221 * @throws { BusinessError } 13900021 - File table overflow 5222 * @throws { BusinessError } 13900022 - Too many open files 5223 * @throws { BusinessError } 13900025 - No space left on device 5224 * @throws { BusinessError } 13900030 - File name too long 5225 * @throws { BusinessError } 13900042 - Unknown error 5226 * @syscap SystemCapability.FileManagement.File.FileIO 5227 * @since 10 5228 */ 5229 start(): void; 5230 5231 /** 5232 * Stop watcher. 5233 * 5234 * @throws { BusinessError } 13900002 - No such file or directory 5235 * @throws { BusinessError } 13900008 - Bad file descriptor 5236 * @throws { BusinessError } 13900011 - Out of memory 5237 * @throws { BusinessError } 13900012 - Permission denied 5238 * @throws { BusinessError } 13900013 - Bad address 5239 * @throws { BusinessError } 13900015 - File exists 5240 * @throws { BusinessError } 13900018 - Not a directory 5241 * @throws { BusinessError } 13900020 - Invalid argument 5242 * @throws { BusinessError } 13900021 - File table overflow 5243 * @throws { BusinessError } 13900022 - Too many open files 5244 * @throws { BusinessError } 13900025 - No space left on device 5245 * @throws { BusinessError } 13900030 - File name too long 5246 * @throws { BusinessError } 13900042 - Unknown error 5247 * @syscap SystemCapability.FileManagement.File.FileIO 5248 * @since 10 5249 */ 5250 stop(): void; 5251} 5252 5253/** 5254 * File filter type 5255 * 5256 * @syscap SystemCapability.FileManagement.File.FileIO 5257 * @crossplatform 5258 * @since 10 5259 */ 5260export type Filter = { 5261 /** 5262 * @type { ?Array<string> } 5263 * @syscap SystemCapability.FileManagement.File.FileIO 5264 * @since 10 5265 */ 5266 suffix?: Array<string>; 5267 /** 5268 * @type { ?Array<string> } 5269 * @syscap SystemCapability.FileManagement.File.FileIO 5270 * @since 10 5271 */ 5272 displayName?: Array<string>; 5273 /** 5274 * @type { ?Array<string> } 5275 * @syscap SystemCapability.FileManagement.File.FileIO 5276 * @since 10 5277 */ 5278 mimeType?: Array<string>; 5279 /** 5280 * @type { ?number } 5281 * @syscap SystemCapability.FileManagement.File.FileIO 5282 * @since 10 5283 */ 5284 fileSizeOver?: number; 5285 /** 5286 * @type { ?number } 5287 * @syscap SystemCapability.FileManagement.File.FileIO 5288 * @since 10 5289 */ 5290 lastModifiedAfter?: number; 5291 /** 5292 * @type { ?boolean } 5293 * @syscap SystemCapability.FileManagement.File.FileIO 5294 * @since 10 5295 */ 5296 excludeMedia?: boolean; 5297}; 5298 5299/** 5300 * Conflict Files type 5301 * 5302 * @syscap SystemCapability.FileManagement.File.FileIO 5303 * @since 10 5304 */ 5305export type ConflictFiles = { 5306 /** 5307 * @type { string } 5308 * @syscap SystemCapability.FileManagement.File.FileIO 5309 * @since 10 5310 */ 5311 srcFile: string; 5312 5313 /** 5314 * @type { string } 5315 * @syscap SystemCapability.FileManagement.File.FileIO 5316 * @since 10 5317 */ 5318 destFile: string; 5319}; 5320