1/* 2 * Copyright (c) 2021-2024 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"), 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16/** 17 * @file 18 * @kit BasicServicesKit 19 */ 20 21import { AsyncCallback } from './@ohos.base'; 22 23/** 24 * @namespace zlib 25 * @syscap SystemCapability.BundleManager.Zlib 26 * @since 7 27 */ 28/** 29 * @namespace zlib 30 * @syscap SystemCapability.BundleManager.Zlib 31 * @atomicservice 32 * @since 11 33 */ 34/** 35 * @namespace zlib 36 * @syscap SystemCapability.BundleManager.Zlib 37 * @crossplatform 38 * @atomicservice 39 * @since 12 40 */ 41declare namespace zlib { 42 /** 43 * ErrorCode 44 * 45 * @enum { number } 46 * @syscap SystemCapability.BundleManager.Zlib 47 * @since 7 48 * @deprecated since 9 49 */ 50 export enum ErrorCode { 51 /** 52 * @syscap SystemCapability.BundleManager.Zlib 53 * @since 7 54 * @deprecated since 9 55 */ 56 ERROR_CODE_OK = 0, 57 /** 58 * @syscap SystemCapability.BundleManager.Zlib 59 * @since 7 60 * @deprecated since 9 61 */ 62 ERROR_CODE_ERRNO = -1 63 } 64 65 /** 66 * CompressLevel 67 * 68 * @enum { number } 69 * @syscap SystemCapability.BundleManager.Zlib 70 * @since 7 71 */ 72 /** 73 * CompressLevel 74 * 75 * @enum { number } 76 * @syscap SystemCapability.BundleManager.Zlib 77 * @crossplatform 78 * @atomicservice 79 * @since 11 80 */ 81 export enum CompressLevel { 82 /** 83 * Indicates the no compression mode. 84 * 85 * @syscap SystemCapability.BundleManager.Zlib 86 * @since 7 87 */ 88 /** 89 * Indicates the no compression mode. 90 * 91 * @syscap SystemCapability.BundleManager.Zlib 92 * @crossplatform 93 * @atomicservice 94 * @since 11 95 */ 96 COMPRESS_LEVEL_NO_COMPRESSION = 0, 97 /** 98 * Indicates the best speed mode. 99 * 100 * @syscap SystemCapability.BundleManager.Zlib 101 * @since 7 102 */ 103 /** 104 * Indicates the best speed mode. 105 * 106 * @syscap SystemCapability.BundleManager.Zlib 107 * @crossplatform 108 * @atomicservice 109 * @since 11 110 */ 111 COMPRESS_LEVEL_BEST_SPEED = 1, 112 /** 113 * Indicates the best compression mode. 114 * 115 * @syscap SystemCapability.BundleManager.Zlib 116 * @since 7 117 */ 118 /** 119 * Indicates the best compression mode. 120 * 121 * @syscap SystemCapability.BundleManager.Zlib 122 * @crossplatform 123 * @atomicservice 124 * @since 11 125 */ 126 COMPRESS_LEVEL_BEST_COMPRESSION = 9, 127 /** 128 * Indicates the default compression mode. 129 * 130 * @syscap SystemCapability.BundleManager.Zlib 131 * @since 7 132 */ 133 /** 134 * Indicates the default compression mode. 135 * 136 * @syscap SystemCapability.BundleManager.Zlib 137 * @crossplatform 138 * @atomicservice 139 * @since 11 140 */ 141 COMPRESS_LEVEL_DEFAULT_COMPRESSION = -1 142 } 143 144 /** 145 * CompressStrategy 146 * 147 * @enum { number } 148 * @syscap SystemCapability.BundleManager.Zlib 149 * @since 7 150 */ 151 /** 152 * CompressStrategy 153 * 154 * @enum { number } 155 * @syscap SystemCapability.BundleManager.Zlib 156 * @crossplatform 157 * @atomicservice 158 * @since 11 159 */ 160 export enum CompressStrategy { 161 /** 162 * Indicates the default strategy. 163 * 164 * @syscap SystemCapability.BundleManager.Zlib 165 * @since 7 166 */ 167 /** 168 * Indicates the default strategy. 169 * 170 * @syscap SystemCapability.BundleManager.Zlib 171 * @crossplatform 172 * @atomicservice 173 * @since 11 174 */ 175 COMPRESS_STRATEGY_DEFAULT_STRATEGY = 0, 176 /** 177 * Indicates the filtered strategy. 178 * 179 * @syscap SystemCapability.BundleManager.Zlib 180 * @since 7 181 */ 182 /** 183 * Indicates the filtered strategy. 184 * 185 * @syscap SystemCapability.BundleManager.Zlib 186 * @crossplatform 187 * @atomicservice 188 * @since 11 189 */ 190 COMPRESS_STRATEGY_FILTERED = 1, 191 /** 192 * Indicates the huffman-only strategy. 193 * 194 * @syscap SystemCapability.BundleManager.Zlib 195 * @since 7 196 */ 197 /** 198 * Indicates the huffman-only strategy. 199 * 200 * @syscap SystemCapability.BundleManager.Zlib 201 * @crossplatform 202 * @atomicservice 203 * @since 11 204 */ 205 COMPRESS_STRATEGY_HUFFMAN_ONLY = 2, 206 /** 207 * Indicates the RLE strategy. 208 * 209 * @syscap SystemCapability.BundleManager.Zlib 210 * @since 7 211 */ 212 /** 213 * Indicates the RLE strategy. 214 * 215 * @syscap SystemCapability.BundleManager.Zlib 216 * @crossplatform 217 * @atomicservice 218 * @since 11 219 */ 220 COMPRESS_STRATEGY_RLE = 3, 221 /** 222 * Indicates the fixed strategy. 223 * 224 * @syscap SystemCapability.BundleManager.Zlib 225 * @since 7 226 */ 227 /** 228 * Indicates the fixed strategy. 229 * 230 * @syscap SystemCapability.BundleManager.Zlib 231 * @crossplatform 232 * @atomicservice 233 * @since 11 234 */ 235 COMPRESS_STRATEGY_FIXED = 4 236 } 237 238 /** 239 * ParallelStrategy 240 * 241 * @enum { number } 242 * @syscap SystemCapability.BundleManager.Zlib 243 * @crossplatform 244 * @atomicservice 245 * @since 18 246 */ 247 export enum ParallelStrategy { 248 /** 249 * Indicates the sequential strategy, compress and decompress sequentially. 250 * 251 * @syscap SystemCapability.BundleManager.Zlib 252 * @crossplatform 253 * @atomicservice 254 * @since 18 255 */ 256 PARALLEL_STRATEGY_SEQUENTIAL = 0, 257 /** 258 * Indicates the parallel decompression strategy. 259 * 260 * @syscap SystemCapability.BundleManager.Zlib 261 * @crossplatform 262 * @atomicservice 263 * @since 18 264 */ 265 PARALLEL_STRATEGY_PARALLEL_DECOMPRESSION = 1 266 } 267 268 /** 269 * MemLevel 270 * 271 * @enum { number } 272 * @syscap SystemCapability.BundleManager.Zlib 273 * @since 7 274 */ 275 /** 276 * MemLevel 277 * 278 * @enum { number } 279 * @syscap SystemCapability.BundleManager.Zlib 280 * @crossplatform 281 * @atomicservice 282 * @since 11 283 */ 284 export enum MemLevel { 285 /** 286 * Uses the least amount of memory. 287 * 288 * @syscap SystemCapability.BundleManager.Zlib 289 * @since 7 290 */ 291 /** 292 * Uses the least amount of memory. 293 * 294 * @syscap SystemCapability.BundleManager.Zlib 295 * @crossplatform 296 * @atomicservice 297 * @since 11 298 */ 299 MEM_LEVEL_MIN = 1, 300 /** 301 * Uses the maximum amount of memory. 302 * 303 * @syscap SystemCapability.BundleManager.Zlib 304 * @since 7 305 */ 306 /** 307 * Uses the maximum amount of memory. 308 * 309 * @syscap SystemCapability.BundleManager.Zlib 310 * @crossplatform 311 * @atomicservice 312 * @since 11 313 */ 314 MEM_LEVEL_MAX = 9, 315 /** 316 * Uses the default amount of memory. 317 * 318 * @syscap SystemCapability.BundleManager.Zlib 319 * @since 7 320 */ 321 /** 322 * Uses the default amount of memory. 323 * 324 * @syscap SystemCapability.BundleManager.Zlib 325 * @crossplatform 326 * @atomicservice 327 * @since 11 328 */ 329 MEM_LEVEL_DEFAULT = 8 330 } 331 332 /** 333 * CompressFlushMode 334 * 335 * @enum { number } 336 * @syscap SystemCapability.BundleManager.Zlib 337 * @atomicservice 338 * @since 12 339 */ 340 export enum CompressFlushMode { 341 /** 342 * Default value, indicating normal operation. 343 * 344 * @syscap SystemCapability.BundleManager.Zlib 345 * @atomicservice 346 * @since 12 347 */ 348 NO_FLUSH = 0, 349 /** 350 * Generate partial refresh points in compressed streams. 351 * 352 * @syscap SystemCapability.BundleManager.Zlib 353 * @atomicservice 354 * @since 12 355 */ 356 PARTIAL_FLUSH = 1, 357 /** 358 * Force output of all compressed data while maintaining the compressed stream state. 359 * 360 * @syscap SystemCapability.BundleManager.Zlib 361 * @atomicservice 362 * @since 12 363 */ 364 SYNC_FLUSH = 2, 365 /** 366 * the compression state is reset. 367 * 368 * @syscap SystemCapability.BundleManager.Zlib 369 * @atomicservice 370 * @since 12 371 */ 372 FULL_FLUSH = 3, 373 /** 374 * The compression or decompression process ends. 375 * 376 * @syscap SystemCapability.BundleManager.Zlib 377 * @atomicservice 378 * @since 12 379 */ 380 FINISH = 4, 381 /** 382 * Allow for finer grained control. 383 * 384 * @syscap SystemCapability.BundleManager.Zlib 385 * @atomicservice 386 * @since 12 387 */ 388 BLOCK = 5, 389 /** 390 * There are special purposes in implementation. 391 * 392 * @syscap SystemCapability.BundleManager.Zlib 393 * @atomicservice 394 * @since 12 395 */ 396 TREES = 6 397 } 398 399 /** 400 * Return codes for the compression/decompression functions. 401 * 402 * @enum { number } 403 * @syscap SystemCapability.BundleManager.Zlib 404 * @atomicservice 405 * @since 12 406 */ 407 export enum ReturnStatus { 408 /** 409 * Indicates success. 410 * 411 * @syscap SystemCapability.BundleManager.Zlib 412 * @atomicservice 413 * @since 12 414 */ 415 OK = 0, 416 /** 417 * Indicates that the entire data has been processed. 418 * 419 * @syscap SystemCapability.BundleManager.Zlib 420 * @atomicservice 421 * @since 12 422 */ 423 STREAM_END = 1, 424 /** 425 * Indicates preset dictionary is required to continue decompression. 426 * 427 * @syscap SystemCapability.BundleManager.Zlib 428 * @atomicservice 429 * @since 12 430 */ 431 NEED_DICT = 2, 432 } 433 434 /** 435 * The deflate compression method (the only one supported in this version). 436 * 437 * @enum { number } 438 * @syscap SystemCapability.BundleManager.Zlib 439 * @atomicservice 440 * @since 12 441 */ 442 export enum CompressMethod { 443 /** 444 * Compression method. 445 * 446 * @syscap SystemCapability.BundleManager.Zlib 447 * @atomicservice 448 * @since 12 449 */ 450 DEFLATED = 8, 451 } 452 453 /** 454 * Define the reference point for offset. 455 * 456 * @enum { number } 457 * @syscap SystemCapability.BundleManager.Zlib 458 * @atomicservice 459 * @since 12 460 */ 461 export enum OffsetReferencePoint { 462 /** 463 * Seek from beginning of file. 464 * 465 * @syscap SystemCapability.BundleManager.Zlib 466 * @atomicservice 467 * @since 12 468 */ 469 SEEK_SET = 0, 470 471 /** 472 * Seek from current position. 473 * 474 * @syscap SystemCapability.BundleManager.Zlib 475 * @atomicservice 476 * @since 12 477 */ 478 SEEK_CUR = 1, 479 } 480 481 /** 482 * Defines compress or decompress options. 483 * 484 * @typedef Options 485 * @syscap SystemCapability.BundleManager.Zlib 486 * @since 7 487 */ 488 /** 489 * Defines compress or decompress options. 490 * 491 * @typedef Options 492 * @syscap SystemCapability.BundleManager.Zlib 493 * @crossplatform 494 * @atomicservice 495 * @since 11 496 */ 497 interface Options { 498 /** 499 * Indicates the compress level. 500 * 501 * @syscap SystemCapability.BundleManager.Zlib 502 * @since 7 503 */ 504 /** 505 * Indicates the compress level. 506 * 507 * @type { ?CompressLevel } 508 * @syscap SystemCapability.BundleManager.Zlib 509 * @crossplatform 510 * @atomicservice 511 * @since 11 512 */ 513 level?: CompressLevel; 514 /** 515 * Indicates the memory level. 516 * 517 * @syscap SystemCapability.BundleManager.Zlib 518 * @since 7 519 */ 520 /** 521 * Indicates the memory level. 522 * 523 * @type { ?MemLevel } 524 * @syscap SystemCapability.BundleManager.Zlib 525 * @crossplatform 526 * @atomicservice 527 * @since 11 528 */ 529 memLevel?: MemLevel; 530 /** 531 * Indicates the compress strategy. 532 * 533 * @syscap SystemCapability.BundleManager.Zlib 534 * @since 7 535 */ 536 /** 537 * Indicates the compress strategy. 538 * 539 * @type { ?CompressStrategy } 540 * @syscap SystemCapability.BundleManager.Zlib 541 * @crossplatform 542 * @atomicservice 543 * @since 11 544 */ 545 strategy?: CompressStrategy; 546 /** 547 * Indicates the parallel strategy. 548 * 549 * @type { ?ParallelStrategy } 550 * @syscap SystemCapability.BundleManager.Zlib 551 * @crossplatform 552 * @atomicservice 553 * @since 18 554 */ 555 parallel?: ParallelStrategy; 556 } 557 558 /** 559 * Process all the information required for compression and decompression. 560 * 561 * @typedef ZStream 562 * @syscap SystemCapability.BundleManager.Zlib 563 * @atomicservice 564 * @since 12 565 */ 566 interface ZStream { 567 /** 568 * Next input byte. 569 * 570 * @type { ?ArrayBuffer } 571 * @syscap SystemCapability.BundleManager.Zlib 572 * @atomicservice 573 * @since 12 574 */ 575 nextIn?: ArrayBuffer; 576 577 /** 578 * Number of bytes available at nextIn. 579 * 580 * @type { ?number } 581 * @syscap SystemCapability.BundleManager.Zlib 582 * @atomicservice 583 * @since 12 584 */ 585 availableIn?: number; 586 587 /** 588 * Total number of input bytes read so far. 589 * 590 * @type { ?number } 591 * @syscap SystemCapability.BundleManager.Zlib 592 * @atomicservice 593 * @since 12 594 */ 595 totalIn?: number; 596 597 /** 598 * Next output byte will go here. 599 * 600 * @type { ?ArrayBuffer } 601 * @syscap SystemCapability.BundleManager.Zlib 602 * @atomicservice 603 * @since 12 604 */ 605 nextOut?: ArrayBuffer; 606 607 /** 608 * Remaining free space at nextOut. 609 * 610 * @type { ?number } 611 * @syscap SystemCapability.BundleManager.Zlib 612 * @atomicservice 613 * @since 12 614 */ 615 availableOut?: number; 616 617 /** 618 * Total number of bytes output so far. 619 * 620 * @type { ?number } 621 * @syscap SystemCapability.BundleManager.Zlib 622 * @atomicservice 623 * @since 12 624 */ 625 totalOut?: number; 626 627 /** 628 * Best guess about the data type. 629 * 630 * @type { ?number } 631 * @syscap SystemCapability.BundleManager.Zlib 632 * @atomicservice 633 * @since 12 634 */ 635 dataType?: number; 636 637 /** 638 * Adler-32 or CRC-32 value of the uncompressed data. 639 * 640 * @type { ?number } 641 * @syscap SystemCapability.BundleManager.Zlib 642 * @atomicservice 643 * @since 12 644 */ 645 adler?: number; 646 } 647 648 /** 649 * Gzip header information passed to and from zlib routines. 650 * 651 * @typedef GzHeader 652 * @syscap SystemCapability.BundleManager.Zlib 653 * @atomicservice 654 * @since 12 655 */ 656 interface GzHeader { 657 /** 658 * True if compressed data believed to be text. 659 * 660 * @type { ?boolean } 661 * @syscap SystemCapability.BundleManager.Zlib 662 * @atomicservice 663 * @since 12 664 */ 665 isText?: boolean; 666 667 /** 668 * Operating system. 669 * 670 * @type { ?number } 671 * @syscap SystemCapability.BundleManager.Zlib 672 * @atomicservice 673 * @since 12 674 */ 675 os?: number; 676 677 /** 678 * Modification time. 679 * 680 * @type { ?number } 681 * @syscap SystemCapability.BundleManager.Zlib 682 * @atomicservice 683 * @since 12 684 */ 685 time?: number; 686 687 /** 688 * Extra flags. 689 * 690 * @type { ?number } 691 * @syscap SystemCapability.BundleManager.Zlib 692 * @atomicservice 693 * @since 12 694 */ 695 xflags?: number; 696 697 /** 698 * Extra field. 699 * 700 * @type { ?ArrayBuffer } 701 * @syscap SystemCapability.BundleManager.Zlib 702 * @atomicservice 703 * @since 12 704 */ 705 extra?: ArrayBuffer; 706 707 /** 708 * Extra field length. 709 * 710 * @type { ?number } 711 * @syscap SystemCapability.BundleManager.Zlib 712 * @atomicservice 713 * @since 12 714 */ 715 extraLen?: number; 716 717 /** 718 * Zero-terminated file name. 719 * 720 * @type { ?ArrayBuffer } 721 * @syscap SystemCapability.BundleManager.Zlib 722 * @atomicservice 723 * @since 12 724 */ 725 name?: ArrayBuffer; 726 727 /** 728 * Zero-terminated comment. 729 * 730 * @type { ?ArrayBuffer } 731 * @syscap SystemCapability.BundleManager.Zlib 732 * @atomicservice 733 * @since 12 734 */ 735 comment?: ArrayBuffer; 736 737 /** 738 * True if there was or will be a header crc 739 * 740 * @type { ?boolean } 741 * @syscap SystemCapability.BundleManager.Zlib 742 * @atomicservice 743 * @since 12 744 */ 745 hcrc?: boolean; 746 747 /** 748 * True when done reading gzip header. 749 * 750 * @type { ?boolean } 751 * @syscap SystemCapability.BundleManager.Zlib 752 * @atomicservice 753 * @since 12 754 */ 755 done?: boolean; 756 } 757 758 /** 759 * Compression and decompression return value information. 760 * 761 * @typedef ZipOutputInfo 762 * @syscap SystemCapability.BundleManager.Zlib 763 * @atomicservice 764 * @since 12 765 */ 766 interface ZipOutputInfo { 767 /** 768 * ReturnStatus the specific meaning is defined as enum. 769 * 770 * @type { ReturnStatus } 771 * @syscap SystemCapability.BundleManager.Zlib 772 * @atomicservice 773 * @since 12 774 */ 775 status: ReturnStatus 776 777 /** 778 * Total sizeof the destination buffer. 779 * 780 * @type { number } 781 * @syscap SystemCapability.BundleManager.Zlib 782 * @atomicservice 783 * @since 12 784 */ 785 destLen: number 786 } 787 788 /** 789 * InflateGetDictionary and deflateGetDictionary return value information. 790 * 791 * @typedef DictionaryOutputInfo 792 * @syscap SystemCapability.BundleManager.Zlib 793 * @atomicservice 794 * @since 12 795 */ 796 interface DictionaryOutputInfo { 797 /** 798 * ReturnStatus the specific meaning is defined as enum. 799 * 800 * @type { ReturnStatus } 801 * @syscap SystemCapability.BundleManager.Zlib 802 * @atomicservice 803 * @since 12 804 */ 805 status: ReturnStatus 806 807 /** 808 * Return dictionary length. 809 * 810 * @type { number } 811 * @syscap SystemCapability.BundleManager.Zlib 812 * @atomicservice 813 * @since 12 814 */ 815 dictionaryLength: number 816 } 817 818 /** 819 * Uncompress2 return value information. 820 * 821 * @typedef DecompressionOutputInfo 822 * @syscap SystemCapability.BundleManager.Zlib 823 * @atomicservice 824 * @since 12 825 */ 826 interface DecompressionOutputInfo { 827 /** 828 * ReturnStatus the specific meaning is defined as enum. 829 * 830 * @type { ReturnStatus } 831 * @syscap SystemCapability.BundleManager.Zlib 832 * @atomicservice 833 * @since 12 834 */ 835 status: ReturnStatus 836 837 /** 838 * Total sizeof the destination buffer. 839 * 840 * @type { number } 841 * @syscap SystemCapability.BundleManager.Zlib 842 * @atomicservice 843 * @since 12 844 */ 845 destLength: number 846 847 /** 848 * Total sizeof the sourceLen. 849 * 850 * @type { number } 851 * @syscap SystemCapability.BundleManager.Zlib 852 * @atomicservice 853 * @since 12 854 */ 855 sourceLength: number 856 } 857 858 /** 859 * DeflatePending return value information. 860 * 861 * @typedef DeflatePendingOutputInfo 862 * @syscap SystemCapability.BundleManager.Zlib 863 * @atomicservice 864 * @since 12 865 */ 866 interface DeflatePendingOutputInfo { 867 /** 868 * ReturnStatus the specific meaning is defined as enum. 869 * 870 * @type { ReturnStatus } 871 * @syscap SystemCapability.BundleManager.Zlib 872 * @atomicservice 873 * @since 12 874 */ 875 status: ReturnStatus 876 877 /** 878 * The number of bytes of output that have been generated. 879 * 880 * @type { number } 881 * @syscap SystemCapability.BundleManager.Zlib 882 * @atomicservice 883 * @since 12 884 */ 885 pending: number 886 887 /** 888 * The number of bits of output that have been generated. 889 * 890 * @type { number } 891 * @syscap SystemCapability.BundleManager.Zlib 892 * @atomicservice 893 * @since 12 894 */ 895 bits: number 896 } 897 898 /** 899 * GzError return value information. 900 * 901 * @typedef GzErrorOutputInfo 902 * @syscap SystemCapability.BundleManager.Zlib 903 * @atomicservice 904 * @since 12 905 */ 906 interface GzErrorOutputInfo { 907 /** 908 * Return Zlib status ReturnStatus the specific meaning is defined as enum. 909 * 910 * @type { ReturnStatus } 911 * @syscap SystemCapability.BundleManager.Zlib 912 * @atomicservice 913 * @since 12 914 */ 915 status: ReturnStatus 916 917 /** 918 * The status message for the last status which occurred on file. 919 * 920 * @type { string } 921 * @syscap SystemCapability.BundleManager.Zlib 922 * @atomicservice 923 * @since 12 924 */ 925 statusMsg: string 926 } 927 928 /** 929 * A callback function for reading input data provided by a user. When the decompression process requires more input data, 930 * zlib will call this function. This function should read data from the data source to the buffer. 931 * 932 * @typedef { function } 933 * @param { object } inDesc - A universal user-defined data object. 934 * The specific type and content depend on the actual application scenario, which can include configuration data, file handles, etc. 935 * @returns { ArrayBuffer } Return the buffer successfully read by the data source through the input descriptor. 936 * @syscap SystemCapability.BundleManager.Zlib 937 * @atomicservice 938 * @since 12 939 */ 940 type InflateBackInputCallback = (inDesc: object) => ArrayBuffer; 941 942 /** 943 * The output data provided by the user is written into the callback function. Whenever decompressed data is ready for output, 944 * zlib calls this function to write the data from the buffer to the target location. 945 * 946 * @typedef { function } 947 * @param { object } outDesc - Object passed to output function. Object dependency requirement implementation. 948 * @param { ArrayBuffer } buf - Used to store data to be written. 949 * @param { number } length - Write the length of the output buffer. 950 * @returns { number } Return the number of bytes output. 951 * @syscap SystemCapability.BundleManager.Zlib 952 * @atomicservice 953 * @since 12 954 */ 955 type InflateBackOutputCallback = (outDesc: object, buf: ArrayBuffer, length: number) => number; 956 957 /** 958 * Compress the specified file. 959 * 960 * @param { string } inFile Indicates the path of the file to be compressed. 961 * @param { string } outFile Indicates the path of the output compressed file. 962 * @param { Options } options 963 * @returns { Promise<void> } 964 * @syscap SystemCapability.BundleManager.Zlib 965 * @since 7 966 * @deprecated since 9 967 * @useinstead ohos.zlib#compressFile 968 */ 969 function zipFile(inFile: string, outFile: string, options: Options): Promise<void>; 970 971 /** 972 * Decompress the specified file. 973 * 974 * @param { string } inFile Indicates the path of the file to be decompressed. 975 * @param { string } outFile Indicates the path of the decompressed file. 976 * @param { Options } options 977 * @returns { Promise<void> } 978 * @syscap SystemCapability.BundleManager.Zlib 979 * @since 7 980 * @deprecated since 9 981 * @useinstead ohos.zlib#decompressFile 982 */ 983 function unzipFile(inFile: string, outFile: string, options: Options): Promise<void>; 984 985 /** 986 * Compress the specified file. 987 * 988 * @param { string } inFile - Indicates the path of the file to be compressed. 989 * @param { string } outFile - Indicates the path of the output compressed file. 990 * @param { Options } options - Indicates the options of compressing file. 991 * @param { AsyncCallback<void> } callback - The callback of compressing file result. 992 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. 993 * @throws { BusinessError } 900001 - The input source file is invalid. 994 * @throws { BusinessError } 900002 - The input destination file is invalid. 995 * @syscap SystemCapability.BundleManager.Zlib 996 * @since 9 997 */ 998 /** 999 * Compress the specified file. 1000 * 1001 * @param { string } inFile - Indicates the path of the file to be compressed. 1002 * @param { string } outFile - Indicates the path of the output compressed file. 1003 * @param { Options } options - Indicates the options of compressing file. 1004 * @param { AsyncCallback<void> } callback - The callback of compressing file result. 1005 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. 1006 * @throws { BusinessError } 900001 - The input source file is invalid. 1007 * @throws { BusinessError } 900002 - The input destination file is invalid. 1008 * @syscap SystemCapability.BundleManager.Zlib 1009 * @crossplatform 1010 * @atomicservice 1011 * @since 11 1012 */ 1013 function compressFile(inFile: string, outFile: string, options: Options, callback: AsyncCallback<void>): void; 1014 1015 /** 1016 * Compress the specified file. 1017 * 1018 * @param { string } inFile - Indicates the path of the file to be compressed. 1019 * @param { string } outFile - Indicates the path of the output compressed file. 1020 * @param { Options } options - Indicates the options of compressing file. 1021 * @returns { Promise<void> } Returns the result of compressFile file. 1022 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. 1023 * @throws { BusinessError } 900001 - The input source file is invalid. 1024 * @throws { BusinessError } 900002 - The input destination file is invalid. 1025 * @syscap SystemCapability.BundleManager.Zlib 1026 * @since 9 1027 */ 1028 /** 1029 * Compress the specified file. 1030 * 1031 * @param { string } inFile - Indicates the path of the file to be compressed. 1032 * @param { string } outFile - Indicates the path of the output compressed file. 1033 * @param { Options } options - Indicates the options of compressing file. 1034 * @returns { Promise<void> } Returns the result of compressFile file. 1035 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. 1036 * @throws { BusinessError } 900001 - The input source file is invalid. 1037 * @throws { BusinessError } 900002 - The input destination file is invalid. 1038 * @syscap SystemCapability.BundleManager.Zlib 1039 * @crossplatform 1040 * @atomicservice 1041 * @since 11 1042 */ 1043 function compressFile(inFile: string, outFile: string, options: Options): Promise<void>; 1044 1045 /** 1046 * Compress the specified multiple files. 1047 * 1048 * @param { Array<string> } inFiles - Indicates the files to be compressed. 1049 * @param { string } outFile - Indicates the path of the output compressed file. 1050 * @param { Options } options - Indicates the options of compressing file. 1051 * @returns { Promise<void> } Returns the result of compressFile file. 1052 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. 1053 * @throws { BusinessError } 900001 - The input source file is invalid. 1054 * @throws { BusinessError } 900002 - The input destination file is invalid. 1055 * @syscap SystemCapability.BundleManager.Zlib 1056 * @atomicservice 1057 * @since 12 1058 */ 1059 function compressFiles(inFiles: Array<string>, outFile: string, options: Options): Promise<void>; 1060 1061 /** 1062 * Decompress the specified file. 1063 * 1064 * @param { string } inFile - Indicates the path of the file to be decompressed. 1065 * @param { string } outFile - Indicates the path of the output decompressed file. 1066 * @param { Options } options - Indicates the options of decompressing file. 1067 * @param { AsyncCallback<void> } callback - The callback of decompressing file result. 1068 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. 1069 * @throws { BusinessError } 900001 - The input source file is invalid. 1070 * @throws { BusinessError } 900002 - The input destination file is invalid. 1071 * @syscap SystemCapability.BundleManager.Zlib 1072 * @since 9 1073 */ 1074 /** 1075 * Decompress the specified file. 1076 * 1077 * @param { string } inFile - Indicates the path of the file to be decompressed. 1078 * @param { string } outFile - Indicates the path of the output decompressed file. 1079 * @param { Options } options - Indicates the options of decompressing file. 1080 * @param { AsyncCallback<void> } callback - The callback of decompressing file result. 1081 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. 1082 * @throws { BusinessError } 900001 - The input source file is invalid. 1083 * @throws { BusinessError } 900002 - The input destination file is invalid. 1084 * @throws { BusinessError } 900003 - The input source file is not in ZIP format or is damaged. 1085 * @syscap SystemCapability.BundleManager.Zlib 1086 * @since 10 1087 */ 1088 /** 1089 * Decompress the specified file. 1090 * 1091 * @param { string } inFile - Indicates the path of the file to be decompressed. 1092 * @param { string } outFile - Indicates the path of the output decompressed file. 1093 * @param { Options } options - Indicates the options of decompressing file. 1094 * @param { AsyncCallback<void> } callback - The callback of decompressing file result. 1095 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. 1096 * @throws { BusinessError } 900001 - The input source file is invalid. 1097 * @throws { BusinessError } 900002 - The input destination file is invalid. 1098 * @throws { BusinessError } 900003 - The input source file is not in ZIP format or is damaged. 1099 * @syscap SystemCapability.BundleManager.Zlib 1100 * @crossplatform 1101 * @atomicservice 1102 * @since 11 1103 */ 1104 function decompressFile(inFile: string, outFile: string, options: Options, callback: AsyncCallback<void>): void; 1105 1106 /** 1107 * Decompress the specified file. 1108 * 1109 * @param { string } inFile - Indicates the path of the file to be decompressed. 1110 * @param { string } outFile - Indicates the path of the output decompressed file. 1111 * @param { AsyncCallback<void> } callback - The callback of decompressing file result. 1112 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. 1113 * @throws { BusinessError } 900001 - The input source file is invalid. 1114 * @throws { BusinessError } 900002 - The input destination file is invalid. 1115 * @throws { BusinessError } 900003 - The input source file is not in ZIP format or is damaged. 1116 * @syscap SystemCapability.BundleManager.Zlib 1117 * @since 10 1118 */ 1119 /** 1120 * Decompress the specified file. 1121 * 1122 * @param { string } inFile - Indicates the path of the file to be decompressed. 1123 * @param { string } outFile - Indicates the path of the output decompressed file. 1124 * @param { AsyncCallback<void> } callback - The callback of decompressing file result. 1125 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. 1126 * @throws { BusinessError } 900001 - The input source file is invalid. 1127 * @throws { BusinessError } 900002 - The input destination file is invalid. 1128 * @throws { BusinessError } 900003 - The input source file is not in ZIP format or is damaged. 1129 * @syscap SystemCapability.BundleManager.Zlib 1130 * @crossplatform 1131 * @atomicservice 1132 * @since 11 1133 */ 1134 function decompressFile(inFile: string, outFile: string, callback: AsyncCallback<void>): void; 1135 1136 /** 1137 * Decompress the specified file. 1138 * 1139 * @param { string } inFile - Indicates the path of the file to be decompressed. 1140 * @param { string } outFile - Indicates the path of the output decompressing file. 1141 * @param { Options } options - Indicates the options of decompressing file. 1142 * @returns { Promise<void> } Returns the result of decompressing file. 1143 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. 1144 * @throws { BusinessError } 900001 - The input source file is invalid. 1145 * @throws { BusinessError } 900002 - The input destination file is invalid. 1146 * @syscap SystemCapability.BundleManager.Zlib 1147 * @since 9 1148 */ 1149 /** 1150 * Decompress the specified file. 1151 * 1152 * @param { string } inFile - Indicates the path of the file to be decompressed. 1153 * @param { string } outFile - Indicates the path of the output decompressing file. 1154 * @param { Options } options - Indicates the options of decompressing file. 1155 * @returns { Promise<void> } Returns the result of decompressing file. 1156 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. 1157 * @throws { BusinessError } 900001 - The input source file is invalid. 1158 * @throws { BusinessError } 900002 - The input destination file is invalid. 1159 * @throws { BusinessError } 900003 - The input source file is not in ZIP format or is damaged. 1160 * @syscap SystemCapability.BundleManager.Zlib 1161 * @since 10 1162 */ 1163 /** 1164 * Decompress the specified file. 1165 * 1166 * @param { string } inFile - Indicates the path of the file to be decompressed. 1167 * @param { string } outFile - Indicates the path of the output decompressing file. 1168 * @param { Options } options - Indicates the options of decompressing file. 1169 * @returns { Promise<void> } Returns the result of decompressing file. 1170 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. 1171 * @throws { BusinessError } 900001 - The input source file is invalid. 1172 * @throws { BusinessError } 900002 - The input destination file is invalid. 1173 * @throws { BusinessError } 900003 - The input source file is not in ZIP format or is damaged. 1174 * @syscap SystemCapability.BundleManager.Zlib 1175 * @crossplatform 1176 * @atomicservice 1177 * @since 11 1178 */ 1179 function decompressFile(inFile: string, outFile: string, options?: Options): Promise<void>; 1180 1181 /** 1182 * Get the original size of the compressed zip file, the size is the meta data stored in zip file. 1183 * 1184 * @param { string } compressedFile - Indicates the path of the compressed file. 1185 * @returns { Promise<number> } Returns the original size of the compressed file. 1186 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. 1187 * @throws { BusinessError } 900001 - The input source file is invalid. 1188 * @throws { BusinessError } 900003 - The input source file is not in ZIP format or is damaged. 1189 * @syscap SystemCapability.BundleManager.Zlib 1190 * @crossplatform 1191 * @atomicservice 1192 * @since 12 1193 */ 1194 function getOriginalSize(compressedFile: string): Promise<number>; 1195 1196 /** 1197 * Asynchronous creation of verification objects. 1198 * 1199 * @returns { Promise<Checksum> } Returns verification objects. 1200 * @syscap SystemCapability.BundleManager.Zlib 1201 * @atomicservice 1202 * @since 12 1203 */ 1204 function createChecksum(): Promise<Checksum>; 1205 1206 /** 1207 * Synchronize creation of verification objects. 1208 * 1209 * @returns { Checksum } Returns verification objects. 1210 * @syscap SystemCapability.BundleManager.Zlib 1211 * @atomicservice 1212 * @since 12 1213 */ 1214 function createChecksumSync(): Checksum; 1215 1216 /** 1217 * Asynchronous creation of zip objects. 1218 * 1219 * @returns { Promise<Zip> } Returns zip objects. 1220 * @syscap SystemCapability.BundleManager.Zlib 1221 * @atomicservice 1222 * @since 12 1223 */ 1224 function createZip(): Promise<Zip>; 1225 1226 /** 1227 * Synchronize creation of zip objects. 1228 * 1229 * @returns { Zip } Returns zip objects. 1230 * @syscap SystemCapability.BundleManager.Zlib 1231 * @atomicservice 1232 * @since 12 1233 */ 1234 function createZipSync(): Zip; 1235 1236 /** 1237 * Synchronize creation of gzip objects. 1238 * 1239 * @returns { Promise<GZip> } Returns zip objects. 1240 * @syscap SystemCapability.BundleManager.Zlib 1241 * @atomicservice 1242 * @since 12 1243 */ 1244 function createGZip(): Promise<GZip>; 1245 1246 /** 1247 * Synchronize creation of gzip objects. 1248 * 1249 * @returns { GZip } Returns zip objects. 1250 * @syscap SystemCapability.BundleManager.Zlib 1251 * @atomicservice 1252 * @since 12 1253 */ 1254 function createGZipSync(): GZip; 1255 1256 /** 1257 * Calculate Adler-32 and CRC-32 checksum. 1258 * 1259 * @typedef Checksum 1260 * @syscap SystemCapability.BundleManager.Zlib 1261 * @atomicservice 1262 * @since 12 1263 */ 1264 interface Checksum { 1265 /** 1266 * Update a running Adler-32 checksum with the bytes buf. 1267 * 1268 * @param { number } adler - Initial value of Adler32 checksum. 1269 * @param { ArrayBuffer } buf - Calculate checksum data buffer. 1270 * @returns { Promise<number> } Return the updated checksum. 1271 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1272 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 1273 * @syscap SystemCapability.BundleManager.Zlib 1274 * @atomicservice 1275 * @since 12 1276 */ 1277 adler32(adler: number, buf: ArrayBuffer): Promise<number>; 1278 1279 /** 1280 * Combine two Adler-32 checksum into one. 1281 * 1282 * @param { number } adler1 - The first Adler32 checksum. 1283 * @param { number } adler2 - The second Adler32 checksum. 1284 * @param { number } len2 - The length of the data block associated with the second Adler32 checksum. 1285 * @returns { Promise<number> } Returns the Adler-32 checksum. 1286 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1287 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 1288 * @syscap SystemCapability.BundleManager.Zlib 1289 * @atomicservice 1290 * @since 12 1291 */ 1292 adler32Combine(adler1: number, adler2: number, len2: number): Promise<number>; 1293 1294 /** 1295 * Update a running CRC-32 with the bytes buf. 1296 * 1297 * @param { number } crc - Initial value of CRC-32 checksum. 1298 * @param { ArrayBuffer } buf - Calculate checksum data buffer. 1299 * @returns { Promise<number> } Return the updated CRC-32. 1300 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1301 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 1302 * @syscap SystemCapability.BundleManager.Zlib 1303 * @atomicservice 1304 * @since 12 1305 */ 1306 crc32(crc: number, buf: ArrayBuffer): Promise<number>; 1307 1308 /** 1309 * Combine two CRC-32 check values into one. 1310 * 1311 * @param { number } crc1 - The first CRC-32 checksum. 1312 * @param { number } crc2 - The second CRC-32 checksum. 1313 * @param { number } len2 - The length of the data block associated with the second CRC-32 checksum. 1314 * @returns { Promise<number> } Returns the CRC-32 check value. 1315 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1316 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 1317 * @syscap SystemCapability.BundleManager.Zlib 1318 * @atomicservice 1319 * @since 12 1320 */ 1321 crc32Combine(crc1: number, crc2: number, len2: number): Promise<number>; 1322 1323 /** 1324 * Update a running CRC-64 with the bytes buf. 1325 * 1326 * @param { number } crc - Initial value of CRC-64 checksum. 1327 * @param { ArrayBuffer } buf - Calculate checksum data buffer. 1328 * @returns { Promise<number> } Return the updated CRC-64. 1329 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1330 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 1331 * @syscap SystemCapability.BundleManager.Zlib 1332 * @atomicservice 1333 * @since 12 1334 */ 1335 crc64(crc: number, buf: ArrayBuffer): Promise<number>; 1336 1337 /** 1338 * Get CRC-32 table. 1339 * 1340 * @returns { Promise<Array<number>> } Return a array to the CRC-32 table. 1341 * @syscap SystemCapability.BundleManager.Zlib 1342 * @atomicservice 1343 * @since 12 1344 */ 1345 getCrcTable(): Promise<Array<number>>; 1346 1347 /** 1348 * Get CRC-64 table. 1349 * 1350 * @returns { Promise<Array<number>> } Return a array to the CRC-64 table. 1351 * @syscap SystemCapability.BundleManager.Zlib 1352 * @atomicservice 1353 * @since 12 1354 */ 1355 getCrc64Table(): Promise<Array<number>>; 1356 } 1357 1358 /** 1359 * Deflate and inflate interface. 1360 * 1361 * @typedef Zip 1362 * @syscap SystemCapability.BundleManager.Zlib 1363 * @atomicservice 1364 * @since 12 1365 */ 1366 interface Zip { 1367 /** 1368 * Get ZStream. 1369 * 1370 * @returns { Promise<ZStream> } Return the required ZStream for compression or decompression. 1371 * @syscap SystemCapability.BundleManager.Zlib 1372 * @atomicservice 1373 * @since 12 1374 */ 1375 getZStream(): Promise<ZStream>; 1376 1377 /** 1378 * Get the version information of the current linked zlib library. 1379 * 1380 * @returns { Promise<string> } Returns a specific version number string constant containing the zlib library. 1381 * @syscap SystemCapability.BundleManager.Zlib 1382 * @atomicservice 1383 * @since 12 1384 */ 1385 zlibVersion(): Promise<string>; 1386 1387 /** 1388 * Return flags indicating compile-time options. 1389 * 1390 * @returns { Promise<number> } Return flags indicating compile-time options. 1391 * Type sizes, two bits each, 00 = 16 bits, 01 = 32, 10 = 64, 11 = other: 1392 * 1.0: size of uInt. 1393 * 3.2: size of uLong. 1394 * 5.4: size of voidpf (pointer). 1395 * 7.6: size of z_off_t. 1396 * Compiler, assembler, and debug options: 1397 * 8: ZLIB_DEBUG. 1398 * 9: ASMV or ASMINF -- use ASM code. 1399 * 10: ZLIB_WINAPI -- exported functions use the WINAPI calling convention. 1400 * 11: 0 (reserved). 1401 * One-time table building (smaller code, but not thread-safe if true): 1402 * 12: BUILDFIXED -- build static block decoding tables when needed. 1403 * 13: DYNAMIC_CRC_TABLE -- build CRC calculation tables when needed. 1404 * 14,15: 0 (reserved). 1405 * Library content (indicates missing functionality): 1406 * 16: NO_GZCOMPRESS -- gz* functions cannot compress (to avoid linking deflate code when not needed). 1407 * 17: NO_GZIP -- deflate can't write gzip streams, and inflate can't detect and decode gzip streams (to avoid linking crc code). 1408 * 18-19: 0 (reserved). 1409 * Operation variations (changes in library functionality): 1410 * 20: PKZIP_BUG_WORKAROUND -- slightly more permissive inflate. 1411 * 21: FASTEST -- deflate algorithm with only one, lowest compression level. 1412 * 22,23: 0 (reserved). 1413 * The sprintf variant used by gzprintf (zero is best): 1414 * 24: 0 = vs*, 1 = s* -- 1 means limited to 20 arguments after the format. 1415 * 25: 0 = *nprintf, 1 = *printf -- 1 means gzprintf() not secure. 1416 * 26: 0 = returns value, 1 = void -- 1 means inferred string length returned. 1417 * Remainder: 1418 * 27-31: 0 (reserved). 1419 * @syscap SystemCapability.BundleManager.Zlib 1420 * @atomicservice 1421 * @since 12 1422 */ 1423 zlibCompileFlags(): Promise<number>; 1424 1425 /** 1426 * Compresses the source buffer into the destination buffer. 1427 * 1428 * @param { ArrayBuffer } dest - Destination buffer. 1429 * @param { ArrayBuffer } source - Source data buffer. 1430 * @param { number } sourceLen - Source data length. 1431 * @returns { Promise<ZipOutputInfo> } Return ReturnStatus and total sizeof the destination buffer. 1432 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1. Mandatory parameters are left unspecified; 1433 * 2. Incorrect parameter types; 3. Parameter verification failed. 1434 * @throws { BusinessError } 17800007 - The input buffer is incorrect, and the output buffer is too small to accommodate the compressed or decompressed data. 1435 * @syscap SystemCapability.BundleManager.Zlib 1436 * @atomicservice 1437 * @since 12 1438 */ 1439 compress(dest: ArrayBuffer, source: ArrayBuffer, sourceLen?: number): Promise<ZipOutputInfo>; 1440 1441 /** 1442 * Compresses the source buffer into the destination buffer. 1443 * 1444 * @param { ArrayBuffer } dest - Destination buffer. 1445 * @param { ArrayBuffer } source - Source data buffer. 1446 * @param { CompressLevel } level - Compression level. 1447 * @param { number } sourceLen - Source data length. 1448 * @returns { Promise<ZipOutputInfo> } Return ReturnStatus and total sizeof the destination buffer. 1449 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1. Mandatory parameters are left unspecified; 1450 * 2. Incorrect parameter types; 3. Parameter verification failed. 1451 * @throws { BusinessError } 17800004 - Compression or decompression stream error, which may be caused by an initialization error in the zlib stream structure or a modified structure. 1452 * @throws { BusinessError } 17800007 - The input buffer is incorrect, and the output buffer is too small to accommodate the compressed or decompressed data. 1453 * @syscap SystemCapability.BundleManager.Zlib 1454 * @atomicservice 1455 * @since 12 1456 */ 1457 compress2(dest: ArrayBuffer, source: ArrayBuffer, level: CompressLevel, sourceLen?: number,): Promise<ZipOutputInfo>; 1458 1459 /** 1460 * Calculate the upper limit of the return compression size. 1461 * 1462 * @param { number } sourceLen - The length of the source data. 1463 * @returns { Promise<number> } Returns an upper bound on the compressed size after. 1464 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1. Mandatory parameters are left unspecified; 1465 * 2. Incorrect parameter types; 3. Parameter verification failed. 1466 * @syscap SystemCapability.BundleManager.Zlib 1467 * @atomicservice 1468 * @since 12 1469 */ 1470 compressBound(sourceLen: number): Promise<number>; 1471 1472 /** 1473 * Decompress the compressed data into its original uncompressed form. 1474 * 1475 * @param { ArrayBuffer } dest - Destination buffer. 1476 * @param { ArrayBuffer } source - Source data buffer. 1477 * @param { number } sourceLen - Source data length. 1478 * @returns { Promise<ZipOutputInfo> } Return ReturnStatus and total sizeof the destination buffer. 1479 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1. Mandatory parameters are left unspecified; 1480 * 2. Incorrect parameter types; 3. Parameter verification failed. 1481 * @throws { BusinessError } 17800005 - The input data is incorrect. For example, the data does not conform to the zlib compression format, the compressed data is corrupted, or the data is not compressed. 1482 * @throws { BusinessError } 17800007 - The input buffer is incorrect, and the output buffer is too small to accommodate the compressed or decompressed data. 1483 * @syscap SystemCapability.BundleManager.Zlib 1484 * @atomicservice 1485 * @since 12 1486 */ 1487 uncompress(dest:ArrayBuffer, source: ArrayBuffer, sourceLen?: number): Promise<ZipOutputInfo>; 1488 1489 /** 1490 * Decompress the compressed data into its original uncompressed form. 1491 * 1492 * @param { ArrayBuffer } dest - Destination buffer. 1493 * @param { ArrayBuffer } source - Source data buffer. 1494 * @param { number } sourceLen - Source data length. 1495 * @returns { Promise<DecompressionOutputInfo> } Return ReturnStatus and total sizeof the destination buffer and total sizeof the sourceLen. 1496 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1. Mandatory parameters are left unspecified; 1497 * 2. Incorrect parameter types; 3. Parameter verification failed. 1498 * @throws { BusinessError } 17800005 - The input data is incorrect. For example, the data does not conform to the zlib compression format, the compressed data is corrupted, or the data is not compressed. 1499 * @throws { BusinessError } 17800007 - The input buffer is incorrect, and the output buffer is too small to accommodate the compressed or decompressed data. 1500 * @syscap SystemCapability.BundleManager.Zlib 1501 * @atomicservice 1502 * @since 12 1503 */ 1504 uncompress2(dest: ArrayBuffer, source: ArrayBuffer, sourceLen?: number): Promise<DecompressionOutputInfo>; 1505 1506 /** 1507 * Verify the checksum inside the structure of compressed stream z_stream. 1508 * 1509 * @param { ZStream } strm - Object to structure z_stream. 1510 * @param { number } check - Expected checksum. 1511 * @returns { Promise<ReturnStatus> } Return ReturnStatus the specific meaning is defined as enum. 1512 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1. Mandatory parameters are left unspecified; 1513 * 2. Incorrect parameter types; 3. Parameter verification failed. 1514 * @throws { BusinessError } 17800004 - Compression or decompression stream error, which may be caused by an initialization error in the zlib stream structure or a modified structure. 1515 * @syscap SystemCapability.BundleManager.Zlib 1516 * @atomicservice 1517 * @since 12 1518 */ 1519 inflateValidate(strm: ZStream, check: number): Promise<ReturnStatus>; 1520 1521 /** 1522 * Find a synchronization point for the current decompressed stream. 1523 * 1524 * @param { ZStream } strm - Object to structure z_stream. 1525 * @returns { Promise<ReturnStatus> } Return ReturnStatus the specific meaning is defined as enum. 1526 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1. Mandatory parameters are left unspecified; 1527 * 2. Incorrect parameter types; 3. Parameter verification failed. 1528 * @throws { BusinessError } 17800004 - Compression or decompression stream error, which may be caused by an initialization error in the zlib stream structure or a modified structure. 1529 * @syscap SystemCapability.BundleManager.Zlib 1530 * @atomicservice 1531 * @since 12 1532 */ 1533 inflateSyncPoint(strm: ZStream): Promise<ReturnStatus>; 1534 1535 /** 1536 * Skips invalid compressed data until a possible full flush point can be found. 1537 * 1538 * @param { ZStream } strm - Object to structure z_stream. 1539 * @returns { Promise<ReturnStatus> } Return ReturnStatus the specific meaning is defined as enum. 1540 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1. Mandatory parameters are left unspecified; 1541 * 2. Incorrect parameter types; 3. Parameter verification failed. 1542 * @throws { BusinessError } 17800004 - Compression or decompression stream error, which may be caused by an initialization error in the zlib stream structure or a modified structure. 1543 * @throws { BusinessError } 17800005 - The input data is incorrect. For example, the data does not conform to the zlib compression format, the compressed data is corrupted, or the data is not compressed. 1544 * @throws { BusinessError } 17800007 - The input buffer is incorrect, and the output buffer is too small to accommodate the compressed or decompressed data. 1545 * @syscap SystemCapability.BundleManager.Zlib 1546 * @atomicservice 1547 * @since 12 1548 */ 1549 inflateSync(strm: ZStream): Promise<ReturnStatus>; 1550 1551 /** 1552 * Initializes the decompression dictionary from the given uncompressed byte sequence. 1553 * 1554 * @param { ZStream } strm - Object to structure z_stream. 1555 * @param { ArrayBuffer } dictionary - Dictionary data. 1556 * @returns { Promise<ReturnStatus> } Return ReturnStatus the specific meaning is defined as enum. 1557 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1. Mandatory parameters are left unspecified; 1558 * 2. Incorrect parameter types; 3. Parameter verification failed. 1559 * @throws { BusinessError } 17800004 - Compression or decompression stream error, which may be caused by an initialization error in the zlib stream structure or a modified structure. 1560 * @throws { BusinessError } 17800005 - The input data is incorrect. For example, the data does not conform to the zlib compression format, the compressed data is corrupted, or the data is not compressed. 1561 * @syscap SystemCapability.BundleManager.Zlib 1562 * @atomicservice 1563 * @since 12 1564 */ 1565 inflateSetDictionary(strm: ZStream, dictionary: ArrayBuffer): Promise<ReturnStatus>; 1566 1567 /** 1568 * Reset the state of the decompressed stream to retain the allocated Huffman decoding tree and preset dictionary. 1569 * 1570 * @param { ZStream } strm - Object to structure z_stream. 1571 * @returns { Promise<ReturnStatus> } Return ReturnStatus the specific meaning is defined as enum. 1572 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1. Mandatory parameters are left unspecified; 1573 * 2. Incorrect parameter types; 3. Parameter verification failed. 1574 * @throws { BusinessError } 17800004 - Compression or decompression stream error, which may be caused by an initialization error in the zlib stream structure or a modified structure. 1575 * @syscap SystemCapability.BundleManager.Zlib 1576 * @atomicservice 1577 * @since 12 1578 */ 1579 inflateResetKeep(strm: ZStream): Promise<ReturnStatus>; 1580 1581 /** 1582 * This function is equivalent to inflateEnd followed by inflateInit, but does not free and reallocate the internal decompression state. 1583 * 1584 * @param { ZStream } strm - Object to structure z_stream. 1585 * @param { number } windowBits - Parameter is interpreted the same as it is for inflateInit2. 1586 * @returns { Promise<ReturnStatus> } Return ReturnStatus the specific meaning is defined as enum. 1587 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1. Mandatory parameters are left unspecified; 1588 * 2. Incorrect parameter types; 3. Parameter verification failed. 1589 * @throws { BusinessError } 17800004 - Compression or decompression stream error, which may be caused by an initialization error in the zlib stream structure or a modified structure. 1590 * @syscap SystemCapability.BundleManager.Zlib 1591 * @atomicservice 1592 * @since 12 1593 */ 1594 inflateReset2(strm: ZStream, windowBits: number): Promise<ReturnStatus>; 1595 1596 /** 1597 * This function is equivalent to inflateEnd followed by inflateInit, but does not free and reallocate the internal decompression state. 1598 * 1599 * @param { ZStream } strm - Object to structure z_stream. 1600 * @returns { Promise<ReturnStatus> } Return ReturnStatus the specific meaning is defined as enum. 1601 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1. Mandatory parameters are left unspecified; 1602 * 2. Incorrect parameter types; 3. Parameter verification failed. 1603 * @throws { BusinessError } 17800004 - Compression or decompression stream error, which may be caused by an initialization error in the zlib stream structure or a modified structure. 1604 * @syscap SystemCapability.BundleManager.Zlib 1605 * @atomicservice 1606 * @since 12 1607 */ 1608 inflateReset(strm: ZStream): Promise<ReturnStatus>; 1609 1610 /** 1611 * This function inserts bits in the inflate input stream. 1612 * 1613 * @param { ZStream } strm - Object to structure z_stream. 1614 * @param { number } bits - The provided bits. 1615 * @param { number } value - The provided value. 1616 * @returns { Promise<ReturnStatus> } Return ReturnStatus the specific meaning is defined as enum. 1617 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1. Mandatory parameters are left unspecified; 1618 * 2. Incorrect parameter types; 3. Parameter verification failed. 1619 * @throws { BusinessError } 17800004 - Compression or decompression stream error, which may be caused by an initialization error in the zlib stream structure or a modified structure. 1620 * @syscap SystemCapability.BundleManager.Zlib 1621 * @atomicservice 1622 * @since 12 1623 */ 1624 inflatePrime(strm: ZStream, bits: number, value: number): Promise<ReturnStatus>; 1625 1626 /** 1627 * Is used to mark locations in the input data for random access. 1628 * 1629 * @param { ZStream } strm - Object to structure z_stream. 1630 * @returns { Promise<number> } Return the internal marker position of the current decompressed stream. 1631 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1. Mandatory parameters are left unspecified; 1632 * 2. Incorrect parameter types; 3. Parameter verification failed. 1633 * @syscap SystemCapability.BundleManager.Zlib 1634 * @atomicservice 1635 * @since 12 1636 */ 1637 inflateMark(strm: ZStream): Promise<number>; 1638 1639 /** 1640 * Initializes the internal stream state for decompression. 1641 * 1642 * @param { ZStream } strm - Object to structure z_stream. 1643 * @param { number } windowBits - Is the base two logarithm of the maximum window size. 1644 * It should be in the range 8..15 for this version of the library. The default value is 15 if inflateInit is used instead. 1645 * windowBits must be greater than or equal to the windowBits value provided to deflateInit2() while compressing, 1646 * or it must be equal to 15 if deflateInit2() was not used. If a compressed stream with a larger window size is given as input, 1647 * inflate() will return with the error code Z_DATA_ERROR instead of trying to allocate a larger window. 1648 * WindowBits can also be zero to request that inflate use the window size in the zlib header of the compressed stream. 1649 * WindowBits can also be -8..-15 for raw inflate. In this case, -windowBits determines the window size. 1650 * inflate() will then process raw deflate data, not looking for a zlib or gzip header, 1651 * not generating a check value, and not looking for any check values for comparison at the end of the stream. 1652 * This is for use with other formats that use the deflate compressed data format such as zip. Those formats provide their own check values. 1653 * If a custom format is developed using the raw deflate format for compressed data, it is recommended that a check value such as an Adler-32 or 1654 * a CRC-32 be applied to the uncompressed data as is done in the zlib, gzip, and zip formats. For most applications, 1655 * the zlib format should be used as is. Note that comments above on the use in deflateInit2() applies to the magnitude of windowBits.WindowBits 1656 * can also be greater than 15 for optional gzip decoding. Add 32 to windowBits to enable zlib and gzip decoding with automatic header detection, 1657 * or add 16 to decode only the gzip format. If a gzip stream is being decoded, strm->adler is a CRC-32 instead of an Adler-32. 1658 * Unlike the gunzip utility and gzread(), inflate() will *not* automatically decode concatenated gzip members. Inflate() will return 1659 * Z_STREAM_END at the end of the gzip member. The state would need to be reset to continue decoding a subsequent gzip member. 1660 * This *must* be done if there is more data after a gzip member, in order for the decompression to be compliant with the gzip standard. 1661 * @returns { Promise<ReturnStatus> } Return ReturnStatus the specific meaning is defined as enum. 1662 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1. Mandatory parameters are left unspecified; 1663 * 2. Incorrect parameter types; 3. Parameter verification failed. 1664 * @throws { BusinessError } 17800004 - Compression or decompression stream error, which may be caused by an initialization error in the zlib stream structure or a modified structure. 1665 * @syscap SystemCapability.BundleManager.Zlib 1666 * @atomicservice 1667 * @since 12 1668 */ 1669 inflateInit2(strm: ZStream, windowBits: number): Promise<ReturnStatus>; 1670 1671 /** 1672 * Initializes the internal stream state for decompression. 1673 * 1674 * @param { ZStream } strm - Object to structure z_stream. 1675 * @returns { Promise<ReturnStatus> } Return ReturnStatus the specific meaning is defined as enum. 1676 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1. Mandatory parameters are left unspecified; 1677 * 2. Incorrect parameter types; 3. Parameter verification failed. 1678 * @syscap SystemCapability.BundleManager.Zlib 1679 * @atomicservice 1680 * @since 12 1681 */ 1682 inflateInit(strm: ZStream): Promise<ReturnStatus>; 1683 1684 /** 1685 * Requests that gzip header information be stored in the provided gz_header structure. 1686 * 1687 * @param { ZStream } strm - Object to structure z_stream. 1688 * @param { GzHeader } header - Receive gzip header information extracted from compressed data stream. 1689 * @returns { Promise<ReturnStatus> } Return ReturnStatus the specific meaning is defined as enum. 1690 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1. Mandatory parameters are left unspecified; 1691 * 2. Incorrect parameter types; 3. Parameter verification failed. 1692 * @throws { BusinessError } 17800004 - Compression or decompression stream error, which may be caused by an initialization error in the zlib stream structure or a modified structure. 1693 * @syscap SystemCapability.BundleManager.Zlib 1694 * @atomicservice 1695 * @since 12 1696 */ 1697 inflateGetHeader(strm: ZStream, header: GzHeader): Promise<ReturnStatus>; 1698 1699 /** 1700 * Obtain the current dictionary content of the decompressed stream. 1701 * 1702 * @param { ZStream } strm - Object to structure z_stream. 1703 * @param { ArrayBuffer } dictionary - The sliding dictionary being maintained by inflate. 1704 * @returns { Promise<DictionaryOutputInfo> } Return ReturnStatus and dictionary length. 1705 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1. Mandatory parameters are left unspecified; 1706 * 2. Incorrect parameter types; 3. Parameter verification failed. 1707 * @throws { BusinessError } 17800004 - Compression or decompression stream error, which may be caused by an initialization error in the zlib stream structure or a modified structure. 1708 * @syscap SystemCapability.BundleManager.Zlib 1709 * @atomicservice 1710 * @since 12 1711 */ 1712 inflateGetDictionary(strm: ZStream, dictionary: ArrayBuffer): Promise<DictionaryOutputInfo>; 1713 1714 /** 1715 * All dynamically allocated data structures for this stream are freed. 1716 * 1717 * @param { ZStream } strm - Object to structure z_stream. 1718 * @returns { Promise<ReturnStatus> } Return ReturnStatus the specific meaning is defined as enum. 1719 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1. Mandatory parameters are left unspecified; 1720 * 2. Incorrect parameter types; 3. Parameter verification failed. 1721 * @throws { BusinessError } 17800004 - Compression or decompression stream error, which may be caused by an initialization error in the zlib stream structure or a modified structure. 1722 * @syscap SystemCapability.BundleManager.Zlib 1723 * @atomicservice 1724 * @since 12 1725 */ 1726 inflateEnd(strm: ZStream): Promise<ReturnStatus>; 1727 1728 /** 1729 * Sets the destination stream as a complete copy of the source stream. 1730 * 1731 * @param { Zip } source - The status information of the current decompression process. 1732 * @returns { Promise<ReturnStatus> } Return ReturnStatus the specific meaning is defined as enum. 1733 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1. Mandatory parameters are left unspecified; 1734 * 2. Incorrect parameter types; 3. Parameter verification failed. 1735 * @throws { BusinessError } 17800004 - Compression or decompression stream error, which may be caused by an initialization error in the zlib stream structure or a modified structure. 1736 * @syscap SystemCapability.BundleManager.Zlib 1737 * @atomicservice 1738 * @since 12 1739 */ 1740 inflateCopy(source: Zip): Promise<ReturnStatus>; 1741 1742 /** 1743 * Obtain the number of Huffman encoding trees that have been used in the current decompression stream during the inflate process. 1744 * 1745 * @param { ZStream } strm - Object to structure z_stream. 1746 * @returns { Promise<number> } Return the number of used Huffman encoding trees. 1747 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1. Mandatory parameters are left unspecified; 1748 * 2. Incorrect parameter types; 3. Parameter verification failed. 1749 * @syscap SystemCapability.BundleManager.Zlib 1750 * @atomicservice 1751 * @since 12 1752 */ 1753 inflateCodesUsed(strm: ZStream): Promise<number>; 1754 1755 /** 1756 * Initialize the internal stream state for decompression using inflateBack() calls. 1757 * 1758 * @param { ZStream } strm - Object to structure z_stream. 1759 * @param { number } windowBits - Parameter is interpreted the same as it is for inflateInit2. The value range is between 8~15. 1760 * @param { ArrayBuffer } window - The preset sliding window buffer. 1761 * @returns { Promise<ReturnStatus> } Return ReturnStatus the specific meaning is defined as enum. 1762 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1. Mandatory parameters are left unspecified; 1763 * 2. Incorrect parameter types; 3. Parameter verification failed. 1764 * @throws { BusinessError } 17800004 - Compression or decompression stream error, which may be caused by an initialization error in the zlib stream structure or a modified structure. 1765 * @syscap SystemCapability.BundleManager.Zlib 1766 * @atomicservice 1767 * @since 12 1768 */ 1769 inflateBackInit(strm: ZStream, windowBits: number, window: ArrayBuffer): Promise<ReturnStatus>; 1770 1771 /** 1772 * All memory allocated by inflateBackInit() is freed. 1773 * 1774 * @param { ZStream } strm - Object to structure z_stream. 1775 * @returns { Promise<ReturnStatus> } Return ReturnStatus the specific meaning is defined as enum. 1776 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1. Mandatory parameters are left unspecified; 1777 * 2. Incorrect parameter types; 3. Parameter verification failed. 1778 * @throws { BusinessError } 17800004 - Compression or decompression stream error, which may be caused by an initialization error in the zlib stream structure or a modified structure. 1779 * @syscap SystemCapability.BundleManager.Zlib 1780 * @atomicservice 1781 * @since 12 1782 */ 1783 inflateBackEnd(strm: ZStream): Promise<ReturnStatus>; 1784 1785 /** 1786 * Does a raw inflate with a single call using a call-back interface for input and output. 1787 * 1788 * @param { ZStream } strm - Object to structure z_stream. 1789 * @param { InflateBackInputCallback } backIn - A function that decompresses data from the end to read the raw compressed data from the input source. 1790 * @param { object } inDesc - Universal object. 1791 * @param { InflateBackOutputCallback } backOut - Write the decompressed data to the target output. 1792 * @param { object } outDesc - Universal object. 1793 * @returns { Promise<ReturnStatus> } Return ReturnStatus the specific meaning is defined as enum. 1794 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1. Mandatory parameters are left unspecified; 1795 * 2. Incorrect parameter types; 3. Parameter verification failed. 1796 * @throws { BusinessError } 17800004 - Compression or decompression stream error, which may be caused by an initialization error in the zlib stream structure or a modified structure. 1797 * @syscap SystemCapability.BundleManager.Zlib 1798 * @atomicservice 1799 * @since 12 1800 */ 1801 inflateBack(strm: ZStream, backIn: InflateBackInputCallback, inDesc: object, backOut: InflateBackOutputCallback, outDesc: object): Promise<ReturnStatus>; 1802 1803 /** 1804 * Decompresses as much data as possible, and stops when the input buffer becomes empty or the output buffer becomes full. 1805 * 1806 * @param { ZStream } strm - Object to structure z_stream. 1807 * @param { CompressFlushMode } flush - The behavior pattern of compression operation. 1808 * @returns { Promise<ReturnStatus> } Return ReturnStatus the specific meaning is defined as enum. 1809 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1. Mandatory parameters are left unspecified; 1810 * 2. Incorrect parameter types; 3. Parameter verification failed. 1811 * @throws { BusinessError } 17800004 - Compression or decompression stream error, which may be caused by an initialization error in the zlib stream structure or a modified structure. 1812 * @throws { BusinessError } 17800005 - The input data is incorrect. For example, the data does not conform to the zlib compression format, the compressed data is corrupted, or the data is not compressed. 1813 * @syscap SystemCapability.BundleManager.Zlib 1814 * @atomicservice 1815 * @since 12 1816 */ 1817 inflate(strm: ZStream, flush: CompressFlushMode): Promise<ReturnStatus>; 1818 1819 /** 1820 * Initializes the internal stream state for compression. 1821 * 1822 * @param { ZStream } strm - Object to structure z_stream. 1823 * @param { CompressLevel } level - Compression level. 1824 * @returns { Promise<ReturnStatus> } Return ReturnStatus the specific meaning is defined as enum. 1825 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1. Mandatory parameters are left unspecified; 1826 * 2. Incorrect parameter types; 3. Parameter verification failed. 1827 * @throws { BusinessError } 17800004 - Compression or decompression stream error, which may be caused by an initialization error in the zlib stream structure or a modified structure. 1828 * @syscap SystemCapability.BundleManager.Zlib 1829 * @atomicservice 1830 * @since 12 1831 */ 1832 deflateInit(strm: ZStream, level: CompressLevel): Promise<ReturnStatus>; 1833 1834 /** 1835 * Initializes the internal stream state for compression. 1836 * 1837 * @param { ZStream } strm - Object to structure z_stream. 1838 * @param { CompressLevel } level - Compression level. 1839 * @param { CompressMethod } method - The compression method. 1840 * @param { number } windowBits - Parameter is interpreted the same as it is for inflateInit2. 1841 * @param { MemLevel } memLevel - The memory usage level. 1842 * @param { CompressStrategy } strategy - The compression strategy. 1843 * @returns { Promise<ReturnStatus> } Return ReturnStatus the specific meaning is defined as enum. 1844 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1. Mandatory parameters are left unspecified; 1845 * 2. Incorrect parameter types; 3. Parameter verification failed. 1846 * @throws { BusinessError } 17800004 - Compression or decompression stream error, which may be caused by an initialization error in the zlib stream structure or a modified structure. 1847 * @syscap SystemCapability.BundleManager.Zlib 1848 * @atomicservice 1849 * @since 12 1850 */ 1851 deflateInit2(strm: ZStream, level: CompressLevel, method: CompressMethod, windowBits: number, 1852 memLevel: MemLevel, strategy: CompressStrategy): Promise<ReturnStatus>; 1853 1854 /** 1855 * Compresses as much data as possible, and stops when the input buffer becomes empty or the output buffer becomes full. 1856 * 1857 * @param { ZStream } strm - Object to structure z_stream. 1858 * @param { CompressFlushMode } flush - The behavior pattern of compression operation. 1859 * @returns { Promise<ReturnStatus> } Return ReturnStatus the specific meaning is defined as enum. 1860 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1. Mandatory parameters are left unspecified; 1861 * 2. Incorrect parameter types; 3. Parameter verification failed. 1862 * @throws { BusinessError } 17800004 - Compression or decompression stream error, which may be caused by an initialization error in the zlib stream structure or a modified structure. 1863 * @throws { BusinessError } 17800007 - The input buffer is incorrect, and the output buffer is too small to accommodate the compressed or decompressed data. 1864 * @syscap SystemCapability.BundleManager.Zlib 1865 * @atomicservice 1866 * @since 12 1867 */ 1868 deflate(strm: ZStream, flush: CompressFlushMode): Promise<ReturnStatus>; 1869 1870 /** 1871 * All dynamically allocated data structures for this stream are freed. 1872 * 1873 * @param { ZStream } strm - Object to structure z_stream. 1874 * @returns { Promise<ReturnStatus> } Return ReturnStatus the specific meaning is defined as enum. 1875 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1. Mandatory parameters are left unspecified; 1876 * 2. Incorrect parameter types; 3. Parameter verification failed. 1877 * @throws { BusinessError } 17800004 - Compression or decompression stream error, which may be caused by an initialization error in the zlib stream structure or a modified structure. 1878 * @syscap SystemCapability.BundleManager.Zlib 1879 * @atomicservice 1880 * @since 12 1881 */ 1882 deflateEnd(strm: ZStream): Promise<ReturnStatus>; 1883 1884 /** 1885 * Calculate an upper bound on the compressed size. 1886 * 1887 * @param { ZStream } strm - Object to structure z_stream. 1888 * @param { number } sourceLength - The length of uncompressed data. 1889 * @returns { Promise<number> } Return an upper bound on the compressed size. 1890 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1. Mandatory parameters are left unspecified; 1891 * 2. Incorrect parameter types; 3. Parameter verification failed. 1892 * @syscap SystemCapability.BundleManager.Zlib 1893 * @atomicservice 1894 * @since 12 1895 */ 1896 deflateBound(strm: ZStream, sourceLength: number): Promise<number>; 1897 1898 /** 1899 * Provides gzip header information for when a gzip stream is requested by deflateInit2(). 1900 * 1901 * @param { ZStream } strm - Object to structure z_stream. 1902 * @param { GzHeader } head - Object a to gz_headerp that already has gzip header information. 1903 * @returns { Promise<ReturnStatus> } Return ReturnStatus the specific meaning is defined as enum. 1904 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1. Mandatory parameters are left unspecified; 1905 * 2. Incorrect parameter types; 3. Parameter verification failed. 1906 * @throws { BusinessError } 17800004 - Compression or decompression stream error, which may be caused by an initialization error in the zlib stream structure or a modified structure. 1907 * @syscap SystemCapability.BundleManager.Zlib 1908 * @atomicservice 1909 * @since 12 1910 */ 1911 deflateSetHeader(strm: ZStream, head: GzHeader): Promise<ReturnStatus>; 1912 1913 /** 1914 * Sets the destination stream as a complete copy of the source stream. 1915 * 1916 * @param { Zip } source - Object to source z_stream structure. 1917 * @returns { Promise<ReturnStatus> } Return ReturnStatus the specific meaning is defined as enum. 1918 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1. Mandatory parameters are left unspecified; 1919 * 2. Incorrect parameter types; 3. Parameter verification failed. 1920 * @throws { BusinessError } 17800004 - Compression or decompression stream error, which may be caused by an initialization error in the zlib stream structure or a modified structure. 1921 * @syscap SystemCapability.BundleManager.Zlib 1922 * @atomicservice 1923 * @since 12 1924 */ 1925 deflateCopy(source: Zip): Promise<ReturnStatus>; 1926 1927 /** 1928 * Initializes the compression dictionary from the given byte sequence without producing any compressed output. 1929 * 1930 * @param { ZStream } strm - Object to structure z_stream. 1931 * @param { ArrayBuffer } dictionary - Object a to gz_headerp that already has gzip header information. 1932 * @returns { Promise<ReturnStatus> } Return ReturnStatus the specific meaning is defined as enum. 1933 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1. Mandatory parameters are left unspecified; 1934 * 2. Incorrect parameter types; 3. Parameter verification failed. 1935 * @throws { BusinessError } 17800004 - Compression or decompression stream error, which may be caused by an initialization error in the zlib stream structure or a modified structure. 1936 * @syscap SystemCapability.BundleManager.Zlib 1937 * @atomicservice 1938 * @since 12 1939 */ 1940 deflateSetDictionary(strm: ZStream, dictionary: ArrayBuffer): Promise<ReturnStatus>; 1941 1942 /** 1943 * Returns the sliding dictionary being maintained by deflate. 1944 * 1945 * @param { ZStream } strm - Object to structure z_stream. 1946 * @param { ArrayBuffer } dictionary - The sliding dictionary being maintained by deflate. 1947 * @returns { Promise<DictionaryOutputInfo> } Return ReturnStatus and dictionary length 1948 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1. Mandatory parameters are left unspecified; 1949 * 2. Incorrect parameter types; 3. Parameter verification failed. 1950 * @throws { BusinessError } 17800004 - Compression or decompression stream error, which may be caused by an initialization error in the zlib stream structure or a modified structure. 1951 * @syscap SystemCapability.BundleManager.Zlib 1952 * @atomicservice 1953 * @since 12 1954 */ 1955 deflateGetDictionary(strm: ZStream, dictionary: ArrayBuffer): Promise<DictionaryOutputInfo>; 1956 1957 /** 1958 * Fine tune deflate's internal compression parameters. 1959 * 1960 * @param { ZStream } strm - Object to structure z_stream. 1961 * @param { number } goodLength - Good matching length threshold. 1962 * @param { number } maxLazy - Maximum lazy matching times. 1963 * @param { number } niceLength - Good Lazy Length Threshold. 1964 * @param { number } maxChain - Maximum chain length. 1965 * @returns { Promise<ReturnStatus> } Return ReturnStatus the specific meaning is defined as enum. 1966 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1. Mandatory parameters are left unspecified; 1967 * 2. Incorrect parameter types; 3. Parameter verification failed. 1968 * @throws { BusinessError } 17800004 - Compression or decompression stream error, which may be caused by an initialization error in the zlib stream structure or a modified structure. 1969 * @syscap SystemCapability.BundleManager.Zlib 1970 * @atomicservice 1971 * @since 12 1972 */ 1973 deflateTune(strm: ZStream, goodLength: number, maxLazy: number, niceLength: number, maxChain: number): Promise<ReturnStatus>; 1974 1975 /** 1976 * This function is equivalent to deflateEnd followed by deflateInit, but does not free and reallocate the internal compression state. 1977 * 1978 * @param { ZStream } strm - Object to structure z_stream. 1979 * @returns { Promise<ReturnStatus> } Return ReturnStatus the specific meaning is defined as enum. 1980 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1. Mandatory parameters are left unspecified; 1981 * 2. Incorrect parameter types; 3. Parameter verification failed. 1982 * @throws { BusinessError } 17800004 - Compression or decompression stream error, which may be caused by an initialization error in the zlib stream structure or a modified structure. 1983 * @syscap SystemCapability.BundleManager.Zlib 1984 * @atomicservice 1985 * @since 12 1986 */ 1987 deflateReset(strm: ZStream): Promise<ReturnStatus>; 1988 1989 /** 1990 * Reset the initialized deflate compressed stream, but retain its set compression parameters and dictionary. 1991 * 1992 * @param { ZStream } strm - Object to structure z_stream. 1993 * @returns { Promise<ReturnStatus> } Return ReturnStatus the specific meaning is defined as enum. 1994 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1. Mandatory parameters are left unspecified; 1995 * 2. Incorrect parameter types; 3. Parameter verification failed. 1996 * @throws { BusinessError } 17800004 - Compression or decompression stream error, which may be caused by an initialization error in the zlib stream structure or a modified structure. 1997 * @syscap SystemCapability.BundleManager.Zlib 1998 * @atomicservice 1999 * @since 12 2000 */ 2001 deflateResetKeep(strm: ZStream): Promise<ReturnStatus>; 2002 2003 /** 2004 * Returns the number of bytes and bits of output that have been generated, but not yet provided in the available output. 2005 * 2006 * @param { ZStream } strm - Object to structure z_stream. 2007 * @returns { Promise<DeflatePendingOutputInfo> } Return ReturnStatus along with the number of bytes and bits generated. 2008 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1. Mandatory parameters are left unspecified; 2009 * 2. Incorrect parameter types; 3. Parameter verification failed. 2010 * @throws { BusinessError } 17800004 - Compression or decompression stream error, which may be caused by an initialization error in the zlib stream structure or a modified structure. 2011 * @syscap SystemCapability.BundleManager.Zlib 2012 * @atomicservice 2013 * @since 12 2014 */ 2015 deflatePending(strm: ZStream): Promise<DeflatePendingOutputInfo>; 2016 2017 /** 2018 * Dynamically update the compression level and compression strategy. 2019 * 2020 * @param { ZStream } strm - Object to structure z_stream. 2021 * @param { CompressLevel } level - New compression level. 2022 * @param { CompressStrategy } strategy - New compression strategy. 2023 * @returns { Promise<ReturnStatus> } Return ReturnStatus the specific meaning is defined as enum. 2024 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1. Mandatory parameters are left unspecified; 2025 * 2. Incorrect parameter types; 3. Parameter verification failed. 2026 * @throws { BusinessError } 17800004 - Compression or decompression stream error, which may be caused by an initialization error in the zlib stream structure or a modified structure. 2027 * @syscap SystemCapability.BundleManager.Zlib 2028 * @atomicservice 2029 * @since 12 2030 */ 2031 deflateParams(strm: ZStream, level: CompressLevel, strategy: CompressStrategy): Promise<ReturnStatus>; 2032 2033 /** 2034 * Inserts bits in the deflate output stream. 2035 * 2036 * @param { ZStream } strm - Object to structure z_stream. 2037 * @param { number } bits - The number of bits to be inserted. The value range is between 0~16. 2038 * @param { number } value - The bit value corresponding to the number of bits. 2039 * @returns { Promise<ReturnStatus> } Return ReturnStatus the specific meaning is defined as enum. 2040 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1. Mandatory parameters are left unspecified; 2041 * 2. Incorrect parameter types; 3. Parameter verification failed. 2042 * @throws { BusinessError } 17800004 - Compression or decompression stream error, which may be caused by an initialization error in the zlib stream structure or a modified structure. 2043 * @syscap SystemCapability.BundleManager.Zlib 2044 * @atomicservice 2045 * @since 12 2046 */ 2047 deflatePrime(strm: ZStream, bits: number, value: number): Promise<ReturnStatus>; 2048 } 2049 2050 /** 2051 * Gzip related interfaces. 2052 * 2053 * @typedef GZip 2054 * @syscap SystemCapability.BundleManager.Zlib 2055 * @atomicservice 2056 * @since 12 2057 */ 2058 interface GZip { 2059 2060 /** 2061 * Associate a gzFile with the file descriptor fd. 2062 * 2063 * @param { number } fd - The file descriptor. Usually this is obtained through system calls to 'open' or other methods. 2064 * @param { string } mode - Used to specify access mode. 2065 * @returns { Promise<void> } 2066 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1. Mandatory parameters are left unspecified; 2067 * 2. Incorrect parameter types; 3. Parameter verification failed. 2068 * @throws { BusinessError } 17800002 - No such file or access mode error. 2069 * @syscap SystemCapability.BundleManager.Zlib 2070 * @atomicservice 2071 * @since 12 2072 */ 2073 gzdopen(fd: number, mode: string): Promise<void>; 2074 2075 /** 2076 * Set the internal buffer size used by this library's functions for file to size. 2077 * 2078 * @param { number } size - The internal buffer size to be set. 2079 * @returns { Promise<number> } Returns 0 on success. 2080 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1. Mandatory parameters are left unspecified; 2081 * 2. Incorrect parameter types; 3. Parameter verification failed. 2082 * @throws { BusinessError } 17800009 - Internal structure error. 2083 * @syscap SystemCapability.BundleManager.Zlib 2084 * @atomicservice 2085 * @since 12 2086 */ 2087 gzbuffer(size: number): Promise<number>; 2088 2089 /** 2090 * Open the gzip (.gz) file at path for reading and decompressing, or compressing and writing. 2091 * 2092 * @param { string } path - The file path to be opened. 2093 * @param { string } mode - Specify the file opening method. 2094 * @returns { Promise<void> } 2095 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1. Mandatory parameters are left unspecified; 2096 * 2. Incorrect parameter types; 3. Parameter verification failed. 2097 * @throws { BusinessError } 17800002 - No such file or access mode error. 2098 * @syscap SystemCapability.BundleManager.Zlib 2099 * @atomicservice 2100 * @since 12 2101 */ 2102 gzopen(path: string, mode: string): Promise<void>; 2103 2104 /** 2105 * Check if the reading position of the gzip compressed file has reached the end of the file. 2106 * 2107 * @returns { Promise<number> } Return 1 (true) if the end-of-file indicator for file has been set while reading. 2108 * @syscap SystemCapability.BundleManager.Zlib 2109 * @atomicservice 2110 * @since 12 2111 */ 2112 gzeof(): Promise<number>; 2113 2114 /** 2115 * Check if the specified gzip file handle file directly accesses the original uncompressed data. 2116 * 2117 * @returns { Promise<number> } returns 1 (true) if transparent writing was requested. 2118 * @syscap SystemCapability.BundleManager.Zlib 2119 * @atomicservice 2120 * @since 12 2121 */ 2122 gzdirect(): Promise<number>; 2123 2124 /** 2125 * Flush all pending output for file, if necessary, close file and deallocate the (de)compression state. 2126 * 2127 * @returns { Promise<ReturnStatus> } Return ReturnStatus the specific meaning is defined as enum. 2128 * @throws { BusinessError } 17800004 - Compression or decompression stream error, which may be caused by an initialization error in the zlib stream structure or a modified structure. 2129 * @throws { BusinessError } 17800006 - Memory allocation failed. 2130 * @syscap SystemCapability.BundleManager.Zlib 2131 * @atomicservice 2132 * @since 12 2133 */ 2134 gzclose(): Promise<ReturnStatus>; 2135 2136 /** 2137 * Clear the error and end-of-file flags for file. 2138 * 2139 * @returns { Promise<void> } 2140 * @syscap SystemCapability.BundleManager.Zlib 2141 * @atomicservice 2142 * @since 12 2143 */ 2144 gzclearerr(): Promise<void>; 2145 2146 /** 2147 * The error message for the last error which occurred on file. 2148 * 2149 * @returns { Promise<GzErrorOutputInfo> } Return the status message for the last status which occurred on file and ReturnStatus. 2150 * @throws { BusinessError } 17800004 - Compression or decompression stream error, which may be caused by an initialization error in the zlib stream structure or a modified structure. 2151 * @syscap SystemCapability.BundleManager.Zlib 2152 * @atomicservice 2153 * @since 12 2154 */ 2155 gzerror(): Promise<GzErrorOutputInfo>; 2156 2157 /** 2158 * Read and decompress one byte from file. 2159 * 2160 * @returns { Promise<number> } Return the ASCII code of a character. 2161 * @throws { BusinessError } 17800009 - Internal structure error. 2162 * @syscap SystemCapability.BundleManager.Zlib 2163 * @atomicservice 2164 * @since 12 2165 */ 2166 gzgetc(): Promise<number>; 2167 2168 /** 2169 * Flush all pending output to file. 2170 * 2171 * @param { CompressFlushMode } flush - Control the behavior of refresh operations. 2172 * @returns { Promise<ReturnStatus> } Return ReturnStatus the specific meaning is defined as enum. 2173 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1. Mandatory parameters are left unspecified; 2174 * 2. Incorrect parameter types; 3. Parameter verification failed. 2175 * @throws { BusinessError } 17800004 - Compression or decompression stream error, which may be caused by an initialization error in the zlib stream structure or a modified structure. 2176 * @syscap SystemCapability.BundleManager.Zlib 2177 * @atomicservice 2178 * @since 12 2179 */ 2180 gzflush(flush: CompressFlushMode): Promise<ReturnStatus>; 2181 2182 /** 2183 * Compress and write nitems items of size size from buf to file. 2184 * 2185 * @param { ArrayBuffer } buf - The buffer to write data to. 2186 * @param { number } size - The number of bytes in a single data block. 2187 * @param { number } nitems - Number of data blocks to be written. 2188 * @returns { Promise<number> } Return the number of full items written of size size. 2189 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1. Mandatory parameters are left unspecified; 2190 * 2. Incorrect parameter types; 3. Parameter verification failed. 2191 * @throws { BusinessError } 17800009 - Internal structure error. 2192 * @syscap SystemCapability.BundleManager.Zlib 2193 * @atomicservice 2194 * @since 12 2195 */ 2196 gzfwrite(buf: ArrayBuffer, size: number, nitems: number): Promise<number>; 2197 2198 /** 2199 * Read and decompress data from gzip compressed files. 2200 * 2201 * @param { ArrayBuffer } buf - Target buffer for storing read results. 2202 * @param { number } size - The number of bytes in a single data block. 2203 * @param { number } nitems - Number of data blocks to be read. 2204 * @returns { Promise<number> } Return the number of full items read of size size. 2205 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1. Mandatory parameters are left unspecified; 2206 * 2. Incorrect parameter types; 3. Parameter verification failed. 2207 * @throws { BusinessError } 17800009 - Internal structure error. 2208 * @syscap SystemCapability.BundleManager.Zlib 2209 * @atomicservice 2210 * @since 12 2211 */ 2212 gzfread(buf: ArrayBuffer, size: number, nitems: number): Promise<number>; 2213 2214 /** 2215 * Same as gzclose(), gzclosew() only for use when writing or appending. 2216 * 2217 * @returns { Promise<ReturnStatus> } Return ReturnStatus the specific meaning is defined as enum. 2218 * @throws { BusinessError } 17800004 - Compression or decompression stream error, which may be caused by an initialization error in the zlib stream structure or a modified structure. 2219 * @throws { BusinessError } 17800006 - Memory allocation failed. 2220 * @syscap SystemCapability.BundleManager.Zlib 2221 * @atomicservice 2222 * @since 12 2223 */ 2224 gzclosew(): Promise<ReturnStatus>; 2225 2226 /** 2227 * Same as gzclose(), gzcloser() is only for use when reading. 2228 * 2229 * @returns { Promise<ReturnStatus> } Return ReturnStatus the specific meaning is defined as enum. 2230 * @throws { BusinessError } 17800004 - Compression or decompression stream error, which may be caused by an initialization error in the zlib stream structure or a modified structure. 2231 * @syscap SystemCapability.BundleManager.Zlib 2232 * @atomicservice 2233 * @since 12 2234 */ 2235 gzcloser(): Promise<ReturnStatus>; 2236 2237 /** 2238 * Compress and write the len uncompressed bytes at buf to file. 2239 * 2240 * @param { ArrayBuffer } buf - Object to the data buffer to be written. 2241 * @param { number } len - The len uncompressed bytes. 2242 * @returns { Promise<number> } Return the number of uncompressed bytes written. 2243 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1. Mandatory parameters are left unspecified; 2244 * 2. Incorrect parameter types; 3. Parameter verification failed. 2245 * @throws { BusinessError } 17800009 - Internal structure error. 2246 * @syscap SystemCapability.BundleManager.Zlib 2247 * @atomicservice 2248 * @since 12 2249 */ 2250 gzwrite(buf: ArrayBuffer, len: number): Promise<number>; 2251 2252 /** 2253 * Push c back onto the stream for file to be read as the first character on the next read. 2254 * 2255 * @param { number } c - To fall back to the character before the input stream. 2256 * @returns { Promise<number> } Return the character pushed. 2257 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1. Mandatory parameters are left unspecified; 2258 * 2. Incorrect parameter types; 3. Parameter verification failed. 2259 * @throws { BusinessError } 17800009 - Internal structure error. 2260 * @syscap SystemCapability.BundleManager.Zlib 2261 * @atomicservice 2262 * @since 12 2263 */ 2264 gzungetc(c: number): Promise<number>; 2265 2266 /** 2267 * Return the starting position for the next gzread or gzwrite on file. 2268 * 2269 * @returns { Promise<number> } Return the starting position for the next gzread or gzwrite on file. 2270 * @throws { BusinessError } 17800009 - Internal structure error. 2271 * @syscap SystemCapability.BundleManager.Zlib 2272 * @atomicservice 2273 * @since 12 2274 */ 2275 gztell(): Promise<number>; 2276 2277 /** 2278 * Dynamically update the compression level and strategy for file. 2279 * 2280 * @param { CompressLevel } level - Compression level. 2281 * @param { CompressStrategy } strategy - Compression strategy. 2282 * @returns { Promise<ReturnStatus> } Return ReturnStatus the specific meaning is defined as enum. 2283 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1. Mandatory parameters are left unspecified; 2284 * 2. Incorrect parameter types; 3. Parameter verification failed. 2285 * @throws { BusinessError } 17800004 - Compression or decompression stream error, which may be caused by an initialization error in the zlib stream structure or a modified structure. 2286 * @syscap SystemCapability.BundleManager.Zlib 2287 * @atomicservice 2288 * @since 12 2289 */ 2290 gzsetparams(level: CompressLevel, strategy: CompressStrategy): Promise<ReturnStatus>; 2291 2292 /** 2293 * Set the starting position to offset relative to whence for the next gzread or gzwrite on file. 2294 * 2295 * @param { number } offset - Specify the new offset to move to. 2296 * @param { OffsetReferencePoint } whence - Define the reference point for offset. 2297 * @returns { Promise<number> } Return the resulting offset location as measured in bytes from the beginning of the uncompressed stream. 2298 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1. Mandatory parameters are left unspecified; 2299 * 2. Incorrect parameter types; 3. Parameter verification failed. 2300 * @throws { BusinessError } 17800009 - Internal structure error. 2301 * @syscap SystemCapability.BundleManager.Zlib 2302 * @atomicservice 2303 * @since 12 2304 */ 2305 gzseek(offset: number, whence: OffsetReferencePoint): Promise<number>; 2306 2307 /** 2308 * Rewind file. This function is supported only for reading. 2309 * 2310 * @returns { Promise<ReturnStatus> } Return ReturnStatus the specific meaning is defined as enum. 2311 * @throws { BusinessError } 17800009 - Internal structure error. 2312 * @syscap SystemCapability.BundleManager.Zlib 2313 * @atomicservice 2314 * @since 12 2315 */ 2316 gzrewind(): Promise<ReturnStatus>; 2317 2318 /** 2319 * Read and decompress up to len uncompressed bytes from file into buf. 2320 * 2321 * @param { ArrayBuffer } buf - User provided buffer address. 2322 * @returns { Promise<number> } Return the number of uncompressed bytes actually read, less than len for end of file. 2323 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1. Mandatory parameters are left unspecified; 2324 * 2. Incorrect parameter types; 3. Parameter verification failed. 2325 * @throws { BusinessError } 17800009 - Internal structure error. 2326 * @syscap SystemCapability.BundleManager.Zlib 2327 * @atomicservice 2328 * @since 12 2329 */ 2330 gzread(buf: ArrayBuffer): Promise<number>; 2331 2332 /** 2333 * Compress and write the given null-terminated string s to file, excluding the terminating null character. 2334 * 2335 * @param { string } str - Format descriptors and plain text. 2336 * @returns { Promise<number> } Return the number of characters written. 2337 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1. Mandatory parameters are left unspecified; 2338 * 2. Incorrect parameter types; 3. Parameter verification failed. 2339 * @throws { BusinessError } 17800009 - Internal structure error. 2340 * @syscap SystemCapability.BundleManager.Zlib 2341 * @atomicservice 2342 * @since 12 2343 */ 2344 gzputs(str: string): Promise<number>; 2345 2346 /** 2347 * Compress and write c, converted to an unsigned char, into file. 2348 * 2349 * @param { number } char - Write ASCII values for characters. 2350 * @returns { Promise<number> } Return the value that was written. 2351 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1. Mandatory parameters are left unspecified; 2352 * 2. Incorrect parameter types; 3. Parameter verification failed. 2353 * @throws { BusinessError } 17800009 - Internal structure error. 2354 * @syscap SystemCapability.BundleManager.Zlib 2355 * @atomicservice 2356 * @since 12 2357 */ 2358 gzputc(char: number): Promise<number>; 2359 2360 /** 2361 * Convert, format, compress, and write the arguments to file under control of the string format, as in fprintf. 2362 * 2363 * @param { string } format - Format descriptors and plain text. 2364 * @param { Array<string | number> } args - Variable argument lists. 2365 * @returns { Promise<number> } Return the number of uncompressed bytes actually written. 2366 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1. Mandatory parameters are left unspecified; 2367 * 2. Incorrect parameter types; 3. Parameter verification failed. 2368 * @throws { BusinessError } 17800004 - Compression or decompression stream error, which may be caused by an initialization error in the zlib stream structure or a modified structure. 2369 * @throws { BusinessError } 17800009 - Internal structure error. 2370 * @syscap SystemCapability.BundleManager.Zlib 2371 * @atomicservice 2372 * @since 12 2373 */ 2374 gzprintf(format: string, ...args: Array<string | number>): Promise<number>; 2375 2376 /** 2377 * Return the current compressed (actual) read or write offset of file. 2378 * 2379 * @returns { Promise<number> } Return the current compressed (actual) read or write offset of file. 2380 * @throws { BusinessError } 17800009 - Internal structure error. 2381 * @syscap SystemCapability.BundleManager.Zlib 2382 * @atomicservice 2383 * @since 12 2384 */ 2385 gzoffset(): Promise<number>; 2386 2387 /** 2388 * Read and decompress bytes from file into buf, until len-1 characters are read, or until a newline character is read and transferred to buf, 2389 * or an end-of-file condition is encountered. 2390 * 2391 * @param { ArrayBuffer } buf - Store the read row data. 2392 * @returns { Promise<string> } Return buf which is a null-terminated string. 2393 * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1. Mandatory parameters are left unspecified; 2394 * 2. Incorrect parameter types; 3. Parameter verification failed. 2395 * @throws { BusinessError } 17800009 - Internal structure error. 2396 * @syscap SystemCapability.BundleManager.Zlib 2397 * @atomicservice 2398 * @since 12 2399 */ 2400 gzgets(buf: ArrayBuffer): Promise<string>; 2401 } 2402} 2403export default zlib; 2404