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