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