1/* 2 * Copyright (c) 2020-2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16/** 17 * @file 18 */ 19 20/** 21 * @interface FileResponse 22 * @syscap SystemCapability.FileManagement.File.FileIO.Lite 23 * @since 3 24 * @deprecated since 10 25 */ 26export interface FileResponse { 27 /** 28 * File URI. 29 * 30 * @syscap SystemCapability.FileManagement.File.FileIO.Lite 31 * @since 3 32 * @deprecated since 10 33 */ 34 uri: string; 35 36 /** 37 * File size, in bytes. 38 * If type is dir, the length value is fixed to 0. 39 * 40 * @syscap SystemCapability.FileManagement.File.FileIO.Lite 41 * @since 3 42 * @deprecated since 10 43 */ 44 length: number; 45 46 /** 47 * Timestamp when the file is stored, which is the number of milliseconds elapsed since 1970/01/01 00:00:00. 48 * For lite wearables, the value is fixed to 0, because this parameter is restricted by the underlying file system. 49 * 50 * @syscap SystemCapability.FileManagement.File.FileIO.Lite 51 * @since 3 52 * @deprecated since 10 53 */ 54 lastModifiedTime: number; 55 56 /** 57 * File type. The values are as follows: 58 * dir: directory 59 * file: file 60 * 61 * @syscap SystemCapability.FileManagement.File.FileIO.Lite 62 * @since 3 63 * @deprecated since 10 64 */ 65 type: 'dir' | 'file'; 66 67 /** 68 * File list. When the recursive value is true and the type is dir, the file information under the subdirectory will be returned. 69 * Otherwise, no value will be returned. 70 * 71 * @syscap SystemCapability.FileManagement.File.FileIO.Lite 72 * @since 3 73 * @deprecated since 10 74 */ 75 subFiles?: Array<FileResponse>; 76} 77 78/** 79 * @interface FileMoveOption 80 * @syscap SystemCapability.FileManagement.File.FileIO.Lite 81 * @since 3 82 * @deprecated since 10 83 */ 84export interface FileMoveOption { 85 /** 86 * URI of the file to move. 87 * Restricted by the underlying file system of lite wearables, the value must meet the following requirements: 88 * 1. The URI cannot contain special characters such as \/"*+,:;<=>?[]|\x7F. 89 * 2. The maximum number of characters allowed is 128. 90 * 91 * @syscap SystemCapability.FileManagement.File.FileIO.Lite 92 * @since 3 93 * @deprecated since 10 94 */ 95 srcUri: string; 96 97 /** 98 * URI of the file moved to the target location. 99 * Restricted by the underlying file system of lite wearables, the value must meet the following requirements: 100 * 1. The URI cannot contain special characters such as \/"*+,:;<=>?[]|\x7F. 101 * 2. The maximum number of characters allowed is 128. 102 * 103 * @syscap SystemCapability.FileManagement.File.FileIO.Lite 104 * @since 3 105 * @deprecated since 10 106 */ 107 dstUri: string; 108 109 /** 110 * Called when the source file is moved to the specified location successfully. 111 * This function returns the URI of the file moved to the target location. 112 * 113 * @syscap SystemCapability.FileManagement.File.FileIO.Lite 114 * @since 3 115 * @deprecated since 10 116 */ 117 success?: (uri: string) => void; 118 119 /** 120 * Called when moving fails. 121 * 122 * @syscap SystemCapability.FileManagement.File.FileIO.Lite 123 * @since 3 124 * @deprecated since 10 125 */ 126 fail?: (data: string, code: number) => void; 127 128 /** 129 * Called when the execution is completed. 130 * 131 * @syscap SystemCapability.FileManagement.File.FileIO.Lite 132 * @since 3 133 * @deprecated since 10 134 */ 135 complete?: () => void; 136} 137 138/** 139 * @interface FileListResponse 140 * @syscap SystemCapability.FileManagement.File.FileIO.Lite 141 * @since 3 142 * @deprecated since 10 143 */ 144export interface FileListResponse { 145 /** 146 * @syscap SystemCapability.FileManagement.File.FileIO.Lite 147 * @since 3 148 * @deprecated since 10 149 */ 150 fileList: Array<FileResponse>; 151} 152 153/** 154 * @interface FileListOption 155 * @syscap SystemCapability.FileManagement.File.FileIO.Lite 156 * @since 3 157 * @deprecated since 10 158 */ 159export interface FileListOption { 160 /** 161 * URI of the directory. 162 * Restricted by the underlying file system of lite wearables, the value must meet the following requirements: 163 * 1. The URI cannot contain special characters such as \/"*+,:;<=>?[]|\x7F. 164 * 2. The maximum number of characters allowed is 128. 165 * 166 * @syscap SystemCapability.FileManagement.File.FileIO.Lite 167 * @since 3 168 * @deprecated since 10 169 */ 170 uri: string; 171 172 /** 173 * Called when the list is obtained successfully. 174 * 175 * @syscap SystemCapability.FileManagement.File.FileIO.Lite 176 * @since 3 177 * @deprecated since 10 178 */ 179 success?: (data: FileListResponse) => void; 180 181 /** 182 * Called when the list fails to be obtained. 183 * 184 * @syscap SystemCapability.FileManagement.File.FileIO.Lite 185 * @since 3 186 * @deprecated since 10 187 */ 188 fail?: (data: string, code: number) => void; 189 190 /** 191 * Called when the execution is completed. 192 * 193 * @syscap SystemCapability.FileManagement.File.FileIO.Lite 194 * @since 3 195 * @deprecated since 10 196 */ 197 complete?: () => void; 198} 199 200/** 201 * @interface FileCopyOption 202 * @syscap SystemCapability.FileManagement.File.FileIO.Lite 203 * @since 3 204 * @deprecated since 10 205 */ 206export interface FileCopyOption { 207 /** 208 * URI of the file to copy. 209 * Restricted by the underlying file system of lite wearables, the value must meet the following requirements: 210 * 1. The URI cannot contain special characters such as \/"*+,:;<=>?[]|\x7F. 211 * 2. The maximum number of characters allowed is 128. 212 * 213 * @syscap SystemCapability.FileManagement.File.FileIO.Lite 214 * @since 3 215 * @deprecated since 10 216 */ 217 srcUri: string; 218 219 /** 220 * URI of the file moved to the target location. 221 * Restricted by the underlying file system of lite wearables, the value must meet the following requirements: 222 * 1. The URI cannot contain special characters such as \/"*+,:;<=>?[]|\x7F. 223 * 2. The maximum number of characters allowed is 128. 224 * 225 * @syscap SystemCapability.FileManagement.File.FileIO.Lite 226 * @since 3 227 * @deprecated since 10 228 */ 229 dstUri: string; 230 231 /** 232 * Called when the copy file is saved successful. 233 * This function returns the URI of the file saved to the target location. 234 * 235 * @syscap SystemCapability.FileManagement.File.FileIO.Lite 236 * @since 3 237 * @deprecated since 10 238 */ 239 success?: (uri: string) => void; 240 241 /** 242 * Called when the copy or save operation fails. 243 * 244 * @syscap SystemCapability.FileManagement.File.FileIO.Lite 245 * @since 3 246 * @deprecated since 10 247 */ 248 fail?: (data: string, code: number) => void; 249 250 /** 251 * Called when the execution is completed. 252 * 253 * @syscap SystemCapability.FileManagement.File.FileIO.Lite 254 * @since 3 255 * @deprecated since 10 256 */ 257 complete?: () => void; 258} 259 260/** 261 * @interface FileGetOption 262 * @syscap SystemCapability.FileManagement.File.FileIO.Lite 263 * @since 3 264 * @deprecated since 10 265 */ 266export interface FileGetOption { 267 /** 268 * File URI, which cannot be an application resource path. 269 * Restricted by the underlying file system of lite wearables, the value must meet the following requirements: 270 * 1. The URI cannot contain special characters such as \/"*+,:;<=>?[]|\x7F. 271 * 2. The maximum number of characters allowed is 128. 272 * 273 * @syscap SystemCapability.FileManagement.File.FileIO.Lite 274 * @since 3 275 * @deprecated since 10 276 */ 277 uri: string; 278 279 /** 280 * Whether to recursively obtain the file list under a subdirectory. 281 * The default value is false. 282 * 283 * @syscap SystemCapability.FileManagement.File.FileIO.Lite 284 * @since 3 285 * @deprecated since 10 286 */ 287 recursive?: boolean; 288 289 /** 290 * Called when file information is obtained successfully. 291 * 292 * @syscap SystemCapability.FileManagement.File.FileIO.Lite 293 * @since 3 294 * @deprecated since 10 295 */ 296 success?: (file: FileResponse) => void; 297 298 /** 299 * Called when file information fails to be obtained. 300 * 301 * @syscap SystemCapability.FileManagement.File.FileIO.Lite 302 * @since 3 303 * @deprecated since 10 304 */ 305 fail?: (data: string, code: number) => void; 306 307 /** 308 * Called when the execution is completed. 309 * 310 * @syscap SystemCapability.FileManagement.File.FileIO.Lite 311 * @since 3 312 * @deprecated since 10 313 */ 314 complete?: () => void; 315} 316 317/** 318 * @interface FileDeleteOption 319 * @syscap SystemCapability.FileManagement.File.FileIO.Lite 320 * @since 3 321 * @deprecated since 10 322 */ 323export interface FileDeleteOption { 324 /** 325 * URI of the file to be deleted, which cannot be an application resource path. 326 * Restricted by the underlying file system of lite wearables, the value must meet the following requirements: 327 * 1. The URI cannot contain special characters such as \/"*+,:;<=>?[]|\x7F. 328 * 2. The maximum number of characters allowed is 128. 329 * 330 * @syscap SystemCapability.FileManagement.File.FileIO.Lite 331 * @since 3 332 * @deprecated since 10 333 */ 334 uri: string; 335 336 /** 337 * Called when local files are deleted successfully. 338 * 339 * @syscap SystemCapability.FileManagement.File.FileIO.Lite 340 * @since 3 341 * @deprecated since 10 342 */ 343 success?: () => void; 344 345 /** 346 * Called when the deletion fails. 347 * 348 * @syscap SystemCapability.FileManagement.File.FileIO.Lite 349 * @since 3 350 * @deprecated since 10 351 */ 352 fail?: (data: string, code: number) => void; 353 354 /** 355 * Called when the execution is completed. 356 * 357 * @syscap SystemCapability.FileManagement.File.FileIO.Lite 358 * @since 3 359 * @deprecated since 10 360 */ 361 complete?: () => void; 362} 363 364/** 365 * @interface FileWriteTextOption 366 * @syscap SystemCapability.FileManagement.File.FileIO.Lite 367 * @since 3 368 * @deprecated since 10 369 */ 370export interface FileWriteTextOption { 371 /** 372 * URI of a local file. If it does not exist, a file will be created. 373 * Restricted by the underlying file system of lite wearables, the value must meet the following requirements: 374 * 1. The URI cannot contain special characters such as \/"*+,:;<=>?[]|\x7F. 375 * 2. The maximum number of characters allowed is 128. 376 * 377 * @syscap SystemCapability.FileManagement.File.FileIO.Lite 378 * @since 3 379 * @deprecated since 10 380 */ 381 uri: string; 382 383 /** 384 * Character string to write into the local file. 385 * 386 * @syscap SystemCapability.FileManagement.File.FileIO.Lite 387 * @since 3 388 * @deprecated since 10 389 */ 390 text: string; 391 392 /** 393 * Encoding format. The default format is UTF-8. 394 * 395 * @syscap SystemCapability.FileManagement.File.FileIO.Lite 396 * @since 3 397 * @deprecated since 10 398 */ 399 encoding?: string; 400 401 /** 402 * Whether to enable the append mode. The default value is false. 403 * 404 * @syscap SystemCapability.FileManagement.File.FileIO.Lite 405 * @since 3 406 * @deprecated since 10 407 */ 408 append?: boolean; 409 410 /** 411 * Called when texts are written into a file successfully. 412 * 413 * @syscap SystemCapability.FileManagement.File.FileIO.Lite 414 * @since 3 415 * @deprecated since 10 416 */ 417 success?: () => void; 418 419 /** 420 * Called when texts fail to be written into a file. 421 * 422 * @syscap SystemCapability.FileManagement.File.FileIO.Lite 423 * @since 3 424 * @deprecated since 10 425 */ 426 fail?: (data: string, code: number) => void; 427 428 /** 429 * Called when the execution is completed. 430 * 431 * @syscap SystemCapability.FileManagement.File.FileIO.Lite 432 * @since 3 433 * @deprecated since 10 434 */ 435 complete?: () => void; 436} 437 438/** 439 * @interface FileReadTextResponse 440 * @syscap SystemCapability.FileManagement.File.FileIO.Lite 441 * @since 3 442 * @deprecated since 10 443 */ 444export interface FileReadTextResponse { 445 /** 446 * @syscap SystemCapability.FileManagement.File.FileIO.Lite 447 * @since 3 448 * @deprecated since 10 449 */ 450 text: string; 451} 452 453/** 454 * @interface FileReadTextOption 455 * @syscap SystemCapability.FileManagement.File.FileIO.Lite 456 * @since 3 457 * @deprecated since 10 458 */ 459export interface FileReadTextOption { 460 /** 461 * URI of a local file. 462 * Restricted by the underlying file system of lite wearables, the value must meet the following requirements: 463 * 1. The URI cannot contain special characters such as \/"*+,:;<=>?[]|\x7F. 464 * 2. The maximum number of characters allowed is 128. 465 * 466 * @syscap SystemCapability.FileManagement.File.FileIO.Lite 467 * @since 3 468 * @deprecated since 10 469 */ 470 uri: string; 471 472 /** 473 * Encoding format. The default format is UTF-8. 474 * Currently, only UTF-8 is supported. 475 * 476 * @syscap SystemCapability.FileManagement.File.FileIO.Lite 477 * @since 3 478 * @deprecated since 10 479 */ 480 encoding?: string; 481 482 /** 483 * Position where the reading starts. 484 * The default value is the start position of the file. 485 * 486 * @syscap SystemCapability.FileManagement.File.FileIO.Lite 487 * @since 3 488 * @deprecated since 10 489 */ 490 position?: number; 491 492 /** 493 * Position where the reading starts. 494 * The default value is the start position of the file. 495 * 496 * @syscap SystemCapability.FileManagement.File.FileIO.Lite 497 * @since 3 498 * @deprecated since 10 499 */ 500 length?: number; 501 502 /** 503 * Called when texts are read successfully. 504 * 505 * @syscap SystemCapability.FileManagement.File.FileIO.Lite 506 * @since 3 507 * @deprecated since 10 508 */ 509 success?: (data: FileReadTextResponse) => void; 510 511 /** 512 * Called when texts fail to be read. 513 * 514 * @syscap SystemCapability.FileManagement.File.FileIO.Lite 515 * @since 3 516 * @deprecated since 10 517 */ 518 fail?: (data: string, code: number) => void; 519 520 /** 521 * Called when the execution is completed. 522 * 523 * @syscap SystemCapability.FileManagement.File.FileIO.Lite 524 * @since 3 525 * @deprecated since 10 526 */ 527 complete?: () => void; 528} 529 530/** 531 * @interface FileWriteArrayBufferOption 532 * @syscap SystemCapability.FileManagement.File.FileIO.Lite 533 * @since 3 534 * @deprecated since 10 535 */ 536export interface FileWriteArrayBufferOption { 537 /** 538 * URI of a local file. If it does not exist, a file will be created. 539 * Restricted by the underlying file system of lite wearables, the value must meet the following requirements: 540 * 1. The URI cannot contain special characters such as \/"*+,:;<=>?[]|\x7F. 541 * 2. The maximum number of characters allowed is 128. 542 * 543 * @syscap SystemCapability.FileManagement.File.FileIO.Lite 544 * @since 3 545 * @deprecated since 10 546 */ 547 uri: string; 548 549 /** 550 * Buffer from which the data is derived. 551 * 552 * @syscap SystemCapability.FileManagement.File.FileIO.Lite 553 * @since 3 554 * @deprecated since 10 555 */ 556 buffer: Uint8Array; 557 558 /** 559 * Offset to the position where the writing starts. The default value is 0. 560 * 561 * @syscap SystemCapability.FileManagement.File.FileIO.Lite 562 * @since 3 563 * @deprecated since 10 564 */ 565 position?: number; 566 567 /** 568 * Whether to enable the append mode. 569 * The default value is false. If the value is true, the position parameter will become invalid. 570 * 571 * @syscap SystemCapability.FileManagement.File.FileIO.Lite 572 * @since 3 573 * @deprecated since 10 574 */ 575 append?: boolean; 576 577 /** 578 * Called when data from a buffer is written into a file successfully. 579 * 580 * @syscap SystemCapability.FileManagement.File.FileIO.Lite 581 * @since 3 582 * @deprecated since 10 583 */ 584 success?: () => void; 585 586 /** 587 * Called when data from a buffer fails to be written into a file. 588 * 589 * @syscap SystemCapability.FileManagement.File.FileIO.Lite 590 * @since 3 591 * @deprecated since 10 592 */ 593 fail?: (data: string, code: number) => void; 594 595 /** 596 * Called when the execution is completed. 597 * 598 * @syscap SystemCapability.FileManagement.File.FileIO.Lite 599 * @since 3 600 * @deprecated since 10 601 */ 602 complete?: () => void; 603} 604 605/** 606 * @interface FileReadArrayBufferResponse 607 * @syscap SystemCapability.FileManagement.File.FileIO.Lite 608 * @since 3 609 * @deprecated since 10 610 */ 611export interface FileReadArrayBufferResponse { 612 /** 613 * @syscap SystemCapability.FileManagement.File.FileIO.Lite 614 * @since 3 615 * @deprecated since 10 616 */ 617 buffer: Uint8Array; 618} 619 620/** 621 * @interface FileReadArrayBufferOption 622 * @syscap SystemCapability.FileManagement.File.FileIO.Lite 623 * @since 3 624 * @deprecated since 10 625 */ 626export interface FileReadArrayBufferOption { 627 /** 628 * URI of a local file. 629 * Restricted by the underlying file system of lite wearables, the value must meet the following requirements: 630 * 1. The URI cannot contain special characters such as \/"*+,:;<=>?[]|\x7F. 631 * 2. The maximum number of characters allowed is 128. 632 * 633 * @syscap SystemCapability.FileManagement.File.FileIO.Lite 634 * @since 3 635 * @deprecated since 10 636 */ 637 uri: string; 638 639 /** 640 * Position where the reading starts. 641 * The default value is the start position of the file. 642 * 643 * @syscap SystemCapability.FileManagement.File.FileIO.Lite 644 * @since 3 645 * @deprecated since 10 646 */ 647 position?: number; 648 649 /** 650 * Length of the content to read. 651 * If this parameter is not set, all content of the file will be read. 652 * 653 * @syscap SystemCapability.FileManagement.File.FileIO.Lite 654 * @since 3 655 * @deprecated since 10 656 */ 657 length?: number; 658 659 /** 660 * Called when the buffer data is read successfully. 661 * 662 * @syscap SystemCapability.FileManagement.File.FileIO.Lite 663 * @since 3 664 * @deprecated since 10 665 */ 666 success?: (data: FileReadArrayBufferResponse) => void; 667 668 /** 669 * Called when the buffer data fails to be read. 670 * 671 * @syscap SystemCapability.FileManagement.File.FileIO.Lite 672 * @since 3 673 * @deprecated since 10 674 */ 675 fail?: (data: string, code: number) => void; 676 677 /** 678 * Called when the execution is completed. 679 * 680 * @syscap SystemCapability.FileManagement.File.FileIO.Lite 681 * @since 3 682 * @deprecated since 10 683 */ 684 complete?: () => void; 685} 686 687/** 688 * @interface FileAccessOption 689 * @syscap SystemCapability.FileManagement.File.FileIO.Lite 690 * @since 3 691 * @deprecated since 10 692 */ 693export interface FileAccessOption { 694 /** 695 * URI of the directory or file. 696 * Restricted by the underlying file system of lite wearables, the value must meet the following requirements: 697 * 1. The URI cannot contain special characters such as \/"*+,:;<=>?[]|\x7F. 698 * 2. The maximum number of characters allowed is 128. 699 * 700 * @syscap SystemCapability.FileManagement.File.FileIO.Lite 701 * @since 3 702 * @deprecated since 10 703 */ 704 uri: string; 705 706 /** 707 * Called when the check result is obtained successfully. 708 * 709 * @syscap SystemCapability.FileManagement.File.FileIO.Lite 710 * @since 3 711 * @deprecated since 10 712 */ 713 success?: () => void; 714 715 /** 716 * Called when the check fails. 717 * 718 * @syscap SystemCapability.FileManagement.File.FileIO.Lite 719 * @since 3 720 * @deprecated since 10 721 */ 722 fail?: (data: string, code: number) => void; 723 724 /** 725 * Called when the execution is completed. 726 * 727 * @syscap SystemCapability.FileManagement.File.FileIO.Lite 728 * @since 3 729 * @deprecated since 10 730 */ 731 complete?: () => void; 732} 733 734/** 735 * @interface FileMkdirOption 736 * @syscap SystemCapability.FileManagement.File.FileIO.Lite 737 * @since 3 738 * @deprecated since 10 739 */ 740export interface FileMkdirOption { 741 /** 742 * URI of the directory. 743 * Restricted by the underlying file system of lite wearables, the value must meet the following requirements: 744 * 1. The URI cannot contain special characters such as \/"*+,:;<=>?[]|\x7F. 745 * 2. The maximum number of characters allowed is 128. 746 * 3. A maximum of five recursions are allowed for creating the directory. 747 * 748 * @syscap SystemCapability.FileManagement.File.FileIO.Lite 749 * @since 3 750 * @deprecated since 10 751 */ 752 uri: string; 753 754 /** 755 * Whether to create the directory after creating its upper-level directory recursively. 756 * The default value is false. 757 * 758 * @syscap SystemCapability.FileManagement.File.FileIO.Lite 759 * @since 3 760 * @deprecated since 10 761 */ 762 recursive?: boolean; 763 764 /** 765 * Called when the directory is created successfully. 766 * 767 * @syscap SystemCapability.FileManagement.File.FileIO.Lite 768 * @since 3 769 * @deprecated since 10 770 */ 771 success?: () => void; 772 773 /** 774 * Called when the creation fails. 775 * 776 * @syscap SystemCapability.FileManagement.File.FileIO.Lite 777 * @since 3 778 * @deprecated since 10 779 */ 780 fail?: (data: string, code: number) => void; 781 782 /** 783 * Called when the execution is completed. 784 * 785 * @syscap SystemCapability.FileManagement.File.FileIO.Lite 786 * @since 3 787 * @deprecated since 10 788 */ 789 complete?: () => void; 790} 791 792/** 793 * @interface FileRmdirOption 794 * @syscap SystemCapability.FileManagement.File.FileIO.Lite 795 * @since 3 796 * @deprecated since 10 797 */ 798export interface FileRmdirOption { 799 /** 800 * URI of the directory. 801 * Restricted by the underlying file system of lite wearables, the value must meet the following requirements: 802 * 1. The URI cannot contain special characters such as \/"*+,:;<=>?[]|\x7F. 803 * 2. The maximum number of characters allowed is 128. 804 * 805 * @syscap SystemCapability.FileManagement.File.FileIO.Lite 806 * @since 3 807 * @deprecated since 10 808 */ 809 uri: string; 810 811 /** 812 * Whether to delete files and subdirectories recursively. 813 * The default value is false. 814 * 815 * @syscap SystemCapability.FileManagement.File.FileIO.Lite 816 * @since 3 817 * @deprecated since 10 818 */ 819 recursive?: boolean; 820 821 /** 822 * Called when the directory is deleted successfully. 823 * 824 * @syscap SystemCapability.FileManagement.File.FileIO.Lite 825 * @since 3 826 * @deprecated since 10 827 */ 828 success?: () => void; 829 830 /** 831 * Called when the deletion fails. 832 * 833 * @syscap SystemCapability.FileManagement.File.FileIO.Lite 834 * @since 3 835 * @deprecated since 10 836 */ 837 fail?: (data: string, code: number) => void; 838 839 /** 840 * Called when the execution is completed. 841 * 842 * @syscap SystemCapability.FileManagement.File.FileIO.Lite 843 * @since 3 844 * @deprecated since 10 845 */ 846 complete?: () => void; 847} 848 849/** 850 * @syscap SystemCapability.FileManagement.File.FileIO.Lite 851 * @since 3 852 * @deprecated since 10 853 */ 854export default class File { 855 /** 856 * Moves the source file to a specified location. 857 * 858 * @param { FileMoveOption } options - Options. 859 * @syscap SystemCapability.FileManagement.File.FileIO.Lite 860 * @since 3 861 * @deprecated since 10 862 * @useinstead ohos.file.fs.moveFile 863 */ 864 static move(options: FileMoveOption): void; 865 866 /** 867 * Copies a source file and save the copy to a specified location. 868 * 869 * @param { FileCopyOption } options - Options. 870 * @syscap SystemCapability.FileManagement.File.FileIO.Lite 871 * @since 3 872 * @deprecated since 10 873 * @useinstead ohos.file.fs.copyFile 874 */ 875 static copy(options: FileCopyOption): void; 876 877 /** 878 * Obtains the list of files in a specified directory. 879 * 880 * @param { FileListOption } options - Options. 881 * @syscap SystemCapability.FileManagement.File.FileIO.Lite 882 * @since 3 883 * @deprecated since 10 884 * @useinstead ohos.file.fs.listFile 885 */ 886 static list(options: FileListOption): void; 887 888 /** 889 * Obtains information about a local file. 890 * 891 * @param { FileGetOption } options - Options. 892 * @syscap SystemCapability.FileManagement.File.FileIO.Lite 893 * @since 3 894 * @deprecated since 10 895 * @useinstead ohos.file.fs.stat 896 */ 897 static get(options: FileGetOption): void; 898 899 /** 900 * Deletes local files. 901 * 902 * @param { FileDeleteOption } options - Options. 903 * @syscap SystemCapability.FileManagement.File.FileIO.Lite 904 * @since 3 905 * @deprecated since 10 906 * @useinstead ohos.file.fs.unlink 907 */ 908 static delete(options: FileDeleteOption): void; 909 910 /** 911 * Writes texts into a file. 912 * 913 * @param { FileWriteTextOption } options - Options. 914 * @syscap SystemCapability.FileManagement.File.FileIO.Lite 915 * @since 3 916 * @deprecated since 10 917 * @useinstead ohos.file.fs.write 918 */ 919 static writeText(options: FileWriteTextOption): void; 920 921 /** 922 * Reads texts from a file. 923 * 924 * @param { FileReadTextOption } options - Options. 925 * @syscap SystemCapability.FileManagement.File.FileIO.Lite 926 * @since 3 927 * @deprecated since 10 928 * @useinstead ohos.file.fs.readText 929 */ 930 static readText(options: FileReadTextOption): void; 931 932 /** 933 * Writes data from a buffer into a file. 934 * 935 * @param { FileWriteArrayBufferOption } options - Options. 936 * @syscap SystemCapability.FileManagement.File.FileIO.Lite 937 * @since 3 938 * @deprecated since 10 939 * @useinstead ohos.file.fs.write 940 */ 941 static writeArrayBuffer(options: FileWriteArrayBufferOption): void; 942 943 /** 944 * Reads buffer data from a file. 945 * 946 * @param { FileReadArrayBufferOption } options - Options. 947 * @syscap SystemCapability.FileManagement.File.FileIO.Lite 948 * @since 3 949 * @deprecated since 10 950 * @useinstead ohos.file.fs.read 951 */ 952 static readArrayBuffer(options: FileReadArrayBufferOption): void; 953 954 /** 955 * Checks whether a file or directory exists. 956 * 957 * @param { FileAccessOption } options - Options. 958 * @syscap SystemCapability.FileManagement.File.FileIO.Lite 959 * @since 3 960 * @deprecated since 10 961 * @useinstead ohos.file.fs.access 962 */ 963 static access(options: FileAccessOption): void; 964 965 /** 966 * Creates a directory. 967 * 968 * @param { FileMkdirOption } options - Options. 969 * @syscap SystemCapability.FileManagement.File.FileIO.Lite 970 * @since 3 971 * @deprecated since 10 972 * @useinstead ohos.file.fs.mkdir 973 */ 974 static mkdir(options: FileMkdirOption): void; 975 976 /** 977 * Deletes a directory. 978 * 979 * @param { FileRmdirOption } options - Options. 980 * @syscap SystemCapability.FileManagement.File.FileIO.Lite 981 * @since 3 982 * @deprecated since 10 983 * @useinstead ohos.file.fs.rmdir 984 */ 985 static rmdir(options: FileRmdirOption): void; 986} 987