### Install pako with npm Source: https://nodeca.github.io/pako/index.html Install pako via npm. This is the standard installation command for the package. ```bash npm install pako ``` -------------------------------- ### onStart(strm: ZStream): void Source: https://nodeca.github.io/pako/classes/Inflate.html Called once before the first low-level inflate call. Override this handler to attach low-level inflate state, for example to read gzip header metadata. ```APIDOC ## onStart(strm: ZStream): void ### Description Called once before the first low-level inflate call. Override this handler to attach low-level inflate state, for example to read gzip header metadata. ### Parameters - **strm** (ZStream) - Required - The low-level inflate stream. ### Returns - **void** ### Example ```js import { Inflate, GZheader, zlibInflateGetHeader } from 'pako' const inflator = new Inflate() inflator.onStart = function (strm) { this.header = new GZheader() zlibInflateGetHeader(strm, this.header) } inflator.push(data, true) console.log(inflator.header.name) ``` ``` -------------------------------- ### Compress and restore strings with pako Source: https://nodeca.github.io/pako/index.html Shows working with strings: deflate automatically recodes strings to utf-8, and inflate with `toText: true` decodes utf-8 back to a JavaScript string. This example compresses a JSON string and restores the original object. ```javascript import { deflate, inflate } from 'pako'; const test = { my: 'super', puper: [456, 567], awesome: 'pako' }; const compressed = deflate(JSON.stringify(test)); const restored = JSON.parse(inflate(compressed, { toText: true })); ``` -------------------------------- ### One-shot inflate with error handling Source: https://nodeca.github.io/pako/functions/inflate.html Shows one-shot inflate usage: deflate a Uint8Array, then inflate it inside a try/catch to handle decompression errors. The function autodetects gzip/zlib format via the wrapper header; set toText: true to get a UTF-8 string instead of a Uint8Array. ```javascript import { deflate, inflate } from 'pako' const input = deflate(new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8, 9])) let output try { output = inflate(input) } catch (err) { console.log(err) } ``` -------------------------------- ### onStart(strm: ZStream): void Source: https://nodeca.github.io/pako/classes/Deflate.html Called once before the first low-level deflate call. ```APIDOC ## onStart(strm: ZStream): void ### Description Called once before the first low-level deflate call. ### Method onStart ### Parameters - **strm** (ZStream) - Required - The zlib stream object. ### Returns void ``` -------------------------------- ### Create and use an Inflate instance Source: https://nodeca.github.io/pako/classes/Inflate.html Demonstrates initializing an Inflate instance and pushing data chunks to it. The second argument to push indicates whether the chunk is the final one. ```javascript import { Inflate } from 'pako' const chunk1 = new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8, 9]) const chunk2 = new Uint8Array([10, 11, 12, 13, 14, 15, 16, 17, 18, 19]) const inflate = new Inflate({ level: 3 }) inflate.push(chunk1, false) inflate.push(chunk2, true) // true -> last chunk if (inflate.err) throw new Error(inflate.err) console.log(inflate.result) ``` -------------------------------- ### zlibDeflateInit2(strm, level, method, windowBits, memLevel, strategy, legacyHash?) Source: https://nodeca.github.io/pako/functions/zlibDeflateInit2.html Initializes a deflate stream with the given parameters. Returns a Z_CallStatus indicating success or failure. ```APIDOC ## zlibDeflateInit2 ### Description Initializes a deflate stream with the specified compression level, method, window bits, memory level, and strategy. Optionally accepts a legacy hash flag. ### Method Function call ### Signature zlibDeflateInit2(strm: ZStream, level: number, method: number, windowBits: number, memLevel: number, strategy: number, legacyHash?: boolean): Z_CallStatus ### Parameters - **strm** (ZStream) - Required - The stream to initialize. - **level** (number) - Required - Compression level. - **method** (number) - Required - Compression method. - **windowBits** (number) - Required - Window bits for the deflate algorithm. - **memLevel** (number) - Required - Memory level for the deflate algorithm. - **strategy** (number) - Required - Compression strategy. - **legacyHash** (boolean) - Optional - Legacy hash flag. ### Returns - **Z_CallStatus** - Status of the initialization call. ``` -------------------------------- ### Override onStart to read gzip header metadata Source: https://nodeca.github.io/pako/classes/Inflate.html Demonstrates overriding the onStart handler to attach a GZheader and retrieve metadata from the stream. ```javascript import { Inflate, GZheader, zlibInflateGetHeader } from 'pako' const inflator = new Inflate() inflator.onStart = function (strm) { this.header = new GZheader() zlibInflateGetHeader(strm, this.header) } inflator.push(data, true) console.log(inflator.header.name) ``` -------------------------------- ### Import and use deflate Source: https://nodeca.github.io/pako/functions/deflate.html Imports the deflate function from 'pako', creates a Uint8Array with sample data, and logs the compressed result. ```javascript import { deflate } from 'pako' const data = new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8, 9]) console.log(deflate(data)) ``` -------------------------------- ### Create and use Deflate with push and result Source: https://nodeca.github.io/pako/classes/Deflate.html Creates a Deflate instance with level 3, pushes two Uint8Array chunks (the second with flush flag true to mark the last chunk), then throws if deflate.err is set and logs the compressed result. Requires importing Deflate from 'pako'. ```javascript import { Deflate } from 'pako' const chunk1 = new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8, 9]) const chunk2 = new Uint8Array([10, 11, 12, 13, 14, 15, 16, 17, 18, 19]) const deflate = new Deflate({ level: 3 }) deflate.push(chunk1, false) deflate.push(chunk2, true) // true -> last chunk if (deflate.err) throw new Error(deflate.err) console.log(deflate.result) ``` -------------------------------- ### Benchmark output for pako vs zlib Source: https://nodeca.github.io/pako/index.html Benchmark results from node v24 with a 1 MB input sample, comparing pako and native zlib operations. Shows pako's deflate and gzip performance is slower than native zlib, while inflate and ungzip are also slower but still in the same order of magnitude. ```text deflate-pako x 14.27 ops/sec ±3.41% (37 runs sampled) deflate-pako-zlib-hash x 10.60 ops/sec ±0.50% (29 runs sampled) deflate-zlib x 30.30 ops/sec ±0.61% (51 runs sampled) gzip-pako x 13.48 ops/sec ±0.50% (36 runs sampled) inflate-pako x 138 ops/sec ±1.26% (75 runs sampled) inflate-zlib x 397 ops/sec ±1.37% (81 runs sampled) ungzip-pako x 125 ops/sec ±1.46% (73 runs sampled) ``` -------------------------------- ### zlibInflateInit2(strm, windowBits) Source: https://nodeca.github.io/pako/functions/zlibInflateInit2.html Initializes the inflate stream with the given window bits. Returns a status code indicating success or failure. ```APIDOC ## zlibInflateInit2(strm, windowBits) ### Description Initializes the inflate stream with the given window bits. Returns a status code indicating success or failure. ### Function Signature zlibInflateInit2(strm: ZStream, windowBits: number): Z_CallStatus ### Parameters - **strm** (ZStream) - Required - The stream to initialize. - **windowBits** (number) - Required - The window size in bits. ### Returns - **Z_CallStatus** - Status code indicating success or failure. ``` -------------------------------- ### gzip(input, options?) Source: https://nodeca.github.io/pako/functions/gzip.html Compresses the given input using gzip format. This is the same as deflate but with a gzip wrapper. ```APIDOC ## gzip(input, options?) ### Description Compresses the given input using gzip format. This is the same as deflate but with a gzip wrapper. ### Method Function ### Signature gzip(input: string | ArrayBuffer | Uint8Array, options?: DeflateOptions): Uint8Array ### Parameters - **input** (string | ArrayBuffer | Uint8Array) - Required - The data to compress. - **options** (DeflateOptions) - Optional - Compression options. Defaults to {}. ### Returns - **Uint8Array** - The compressed data in gzip format. ``` -------------------------------- ### new GZheader() Source: https://nodeca.github.io/pako/classes/GZheader.html Creates a new GZheader instance. This constructor initializes a GZheader object with default values for all header properties. ```APIDOC ## new GZheader() ### Description Creates a new GZheader instance. This constructor initializes a GZheader object with default values for all header properties. ### Method Constructor ### Returns - **GZheader** - A new GZheader instance. ``` -------------------------------- ### new ZStream() Source: https://nodeca.github.io/pako/classes/ZStream.html Constructor for the ZStream class. ```APIDOC ## new ZStream() ### Description Creates a new ZStream instance. ### Returns - **ZStream** - A new ZStream object. ``` -------------------------------- ### Import pako as namespace Source: https://nodeca.github.io/pako/index.html Namespace import to access the entire pako API as an object. ```javascript import * as pako from 'pako'; ``` -------------------------------- ### zlibInflateInit(strm: ZStream): Z_CallStatus Source: https://nodeca.github.io/pako/functions/zlibInflateInit.html Initializes an inflate stream for zlib decompression. This function must be called before using the stream for inflation. ```APIDOC ## zlibInflateInit(strm: ZStream): Z_CallStatus ### Description Initializes an inflate stream for zlib decompression. This function must be called before using the stream for inflation. ### Parameters - **strm** (ZStream) - Required - The stream to initialize. ### Returns - **Z_CallStatus** - Status code indicating success or error. ``` -------------------------------- ### zlibInflateReset(strm: ZStream): Z_CallStatus Source: https://nodeca.github.io/pako/functions/zlibInflateReset.html Documentation for the zlibInflateReset function, including its parameters and return type. ```APIDOC ## zlibInflateReset(strm: ZStream): Z_CallStatus ### Description Resets the inflate stream state for the given ZStream object, allowing it to be reused for a new decompression operation. ### Parameters - **strm** (ZStream) - Required - The stream to reset. ### Returns - **Z_CallStatus** - The status of the reset operation. ``` -------------------------------- ### zlibDeflateInit(strm: ZStream, level: number): Z_CallStatus Source: https://nodeca.github.io/pako/functions/zlibDeflateInit.html Initializes a deflate stream for zlib compression with the specified compression level. Returns a status code indicating success or failure. ```APIDOC ## zlibDeflateInit(strm: ZStream, level: number): Z_CallStatus ### Description Initializes a deflate stream for zlib compression with the specified compression level. Returns a status code indicating success or failure. ### Function Signature `zlibDeflateInit(strm: ZStream, level: number): Z_CallStatus` ### Parameters - **strm** (ZStream) - Required - The stream object to initialize. - **level** (number) - Required - The compression level (0-9 or Z_DEFAULT_COMPRESSION). ### Returns - **Z_CallStatus** - Status code indicating the result of initialization. ``` -------------------------------- ### deflate(input, options?) Source: https://nodeca.github.io/pako/functions/deflate.html Compresses the given input data using the deflate algorithm with optional options. Returns the compressed data as a Uint8Array. ```APIDOC ## deflate(input, options?) ### Description Compress `data` with deflate algorithm and `options`. See DeflateOptions for the list of supported options. ### Method Function ### Signature ```typescript function deflate( input: string | ArrayBuffer | Uint8Array, options?: DeflateOptions, ): Uint8Array ``` ### Parameters - **input** (string | ArrayBuffer | Uint8Array) - Required - The data to compress. - **options** (DeflateOptions) - Optional - Compression options. Defaults to `{}`. ### Returns - **Uint8Array** - The compressed data. ### Example ```typescript import { deflate } from 'pako' const data = new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8, 9]) console.log(deflate(data)) ``` ``` -------------------------------- ### new Inflate(options?: InflateOptions): Inflate Source: https://nodeca.github.io/pako/classes/Inflate.html Creates a new inflator instance with the specified params. Throws an exception on bad params. By default, the deflate/gzip data format is autodetected via the wrapper header. ```APIDOC ## new Inflate(options?: InflateOptions): Inflate ### Description Creates a new inflator instance with the specified params. Throws an exception on bad params. By default, the deflate/gzip data format is autodetected via the wrapper header. ### Parameters - **options** (InflateOptions) - Optional - Default: {} - See InflateOptions for the list of supported options. ### Returns - **Inflate** - The new inflator instance. ### Example ```js import { Inflate } from 'pako' const chunk1 = new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8, 9]) const chunk2 = new Uint8Array([10, 11, 12, 13, 14, 15, 16, 17, 18, 19]) const inflate = new Inflate({ level: 3 }) inflate.push(chunk1, false) inflate.push(chunk2, true) // true -> last chunk if (inflate.err) throw new Error(inflate.err) console.log(inflate.result) ``` ``` -------------------------------- ### push(data: string | ArrayBuffer | Uint8Array, flush_mode?: boolean | Z_FlushMode): boolean Source: https://nodeca.github.io/pako/classes/Deflate.html Sends input data to the deflate pipe, generating Deflate.onData calls with new compressed chunks. Returns `true` on success. The last data block must have `flush_mode` Z_FINISH (or `true`). That will flush the internal pending buffers and call Deflate.onEnd. On failure, calls Deflate.onEnd with the error code and returns false. ```APIDOC ## push(data: string | ArrayBuffer | Uint8Array, flush_mode?: boolean | Z_FlushMode): boolean ### Description Sends input data to the deflate pipe, generating Deflate.onData calls with new compressed chunks. Returns `true` on success. The last data block must have `flush_mode` Z_FINISH (or `true`). That will flush the internal pending buffers and call Deflate.onEnd. On failure, calls Deflate.onEnd with the error code and returns false. ### Method push ### Parameters - **data** (string | ArrayBuffer | Uint8Array) - Required - Input data. Strings will be converted to utf8 byte sequence. - **flush_mode** (boolean | Z_FlushMode) - Optional - Default: false - 0..6 for corresponding Z_NO_FLUSH..Z_TREES modes. See constants. Skipped or `false` means Z_NO_FLUSH, `true` means Z_FINISH. ### Returns boolean ### Example ``` push(chunk, false) // push one of data chunks ... push(chunk, true) // push last chunk ``` ``` -------------------------------- ### zlibDeflateSetDictionary(strm, dictionary) Source: https://nodeca.github.io/pako/functions/zlibDeflateSetDictionary.html Documentation for the zlibDeflateSetDictionary function, which sets a deflate dictionary for a deflate stream. ```APIDOC ## zlibDeflateSetDictionary(strm, dictionary) ### Description Sets the deflate dictionary for the given deflate stream. This function is used to improve compression of small data by providing a preset dictionary. ### Parameters - **strm** (ZStream) - Required - The deflate stream to set the dictionary for. - **dictionary** (Uint8Array) - Required - The dictionary data to use for compression. ### Returns - **Z_CallStatus** - The status of the operation, indicating success or an error code. ``` -------------------------------- ### InflateOptions Source: https://nodeca.github.io/pako/interfaces/InflateOptions.html Configuration options for pako inflate operations. ```APIDOC ## InflateOptions ### Description Interface for configuring pako inflate operations. ### Properties #### windowBits (optional) - **Type**: number - **Description**: Window size. See the zlib manual for more information. #### dictionary (optional) - **Type**: ArrayBuffer | Uint8Array - **Description**: Initial dictionary. See the zlib manual for more information. #### chunkSize (optional) - **Type**: number - **Description**: Size of generated data chunks (64K by default). #### raw (optional) - **Type**: boolean - **Description**: Do raw inflate. Say that we work with raw stream, if you don't wish to specify negative `windowBits` implicitly. ### Example ```typescript const options: InflateOptions = { windowBits: 15, dictionary: new Uint8Array([1, 2, 3]), chunkSize: 65536, raw: false }; ``` ``` -------------------------------- ### Use pako deflate and inflate with chunking Source: https://nodeca.github.io/pako/index.html Shows the main pako API: the high-level `deflate` and `inflate` functions, and the `Deflate`/`Inflate` classes for chunked processing without exceptions. The simple wrappers throw on broken streams; the class-based interface uses `push` with a final `true` flag for deflate and auto-detects the end for inflate. Errors are checked via the `err` and `msg` properties. ```javascript import { Deflate, Inflate, deflate, inflate } from 'pako'; // Deflate // const input = new Uint8Array(); //... fill input data here const output = deflate(input); // Inflate (simple wrapper can throw exception on broken stream) // const compressed = new Uint8Array(); //... fill data to uncompress here try { const result = inflate(compressed); // ... continue processing } catch (err) { console.log(err); } // // Alternate interface for chunking & without exceptions // const deflator = new Deflate(); deflator.push(chunk1, false); deflator.push(chunk2); // second param is false by default. ... deflator.push(chunk_last, true); // `true` says this chunk is last if (deflator.err) { console.log(deflator.msg); } const output = deflator.result; const inflator = new Inflate(); inflator.push(chunk1); inflator.push(chunk2); ... inflator.push(chunk_last); // no second param because end is auto-detected if (inflator.err) { console.log(inflator.msg); } const output = inflator.result; ``` -------------------------------- ### new Deflate(options?: DeflateOptions): Deflate Source: https://nodeca.github.io/pako/classes/Deflate.html Creates a new deflator instance with the specified params. Throws an exception on bad params. See DeflateOptions for the list of supported options. ```APIDOC ## new Deflate(options?: DeflateOptions): Deflate ### Description Creates a new deflator instance with the specified params. Throws an exception on bad params. See DeflateOptions for the list of supported options. ### Method constructor ### Parameters - **options** (DeflateOptions) - Optional - Default: {} - Deflate options. ### Returns Deflate ### Example ``` import { Deflate } from 'pako' const chunk1 = new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8, 9]) const chunk2 = new Uint8Array([10, 11, 12, 13, 14, 15, 16, 17, 18, 19]) const deflate = new Deflate({ level: 3 }) deflate.push(chunk1, false) deflate.push(chunk2, true) // true -> last chunk if (deflate.err) throw new Error(deflate.err) console.log(deflate.result) ``` ``` -------------------------------- ### push(data: ArrayBuffer | Uint8Array, flush_mode?: boolean | Z_FlushMode): boolean Source: https://nodeca.github.io/pako/classes/Inflate.html Sends input data to the inflate pipe, generating Inflate.onData calls with new output chunks. Returns true on success. If end of stream is detected, Inflate.onEnd will be called. ```APIDOC ## push(data: ArrayBuffer | Uint8Array, flush_mode?: boolean | Z_FlushMode): boolean ### Description Sends input data to the inflate pipe, generating Inflate.onData calls with new output chunks. Returns `true` on success. If end of stream is detected, Inflate.onEnd will be called. `flush_mode` is not needed for normal operation, because end of stream is detected automatically. Pass Z_SYNC_FLUSH to force the decoder to emit all currently available output — handy when you need to decode data frame-by-frame from a long-running stream. On failure, calls Inflate.onEnd with the error code and returns false. Once the stream has ended (a compressed stream may end before your data does), further `push` calls are no-ops and return whether the decode finished successfully. The final outcome is in Inflate.result, Inflate.err and Inflate.msg. ### Parameters - **data** (ArrayBuffer | Uint8Array) - Required - Input data to decompress. - **flush_mode** (boolean | Z_FlushMode) - Optional - Default: false - 0..6 for corresponding Z_NO_FLUSH..Z_TREES flush modes. See constants. Skipped or `false` means Z_NO_FLUSH, `true` means Z_FINISH. ### Returns - **boolean** - `true` on success, `false` on failure. ### Example ```js push(chunk, false) // push one of data chunks ... push(chunk, true) // push last chunk ``` ``` -------------------------------- ### zlibInflateReset2(strm, windowBits) Source: https://nodeca.github.io/pako/functions/zlibInflateReset2.html Resets an inflate stream with a new windowBits value. Takes a ZStream and a number for windowBits, returns a Z_CallStatus. ```APIDOC ## zlibInflateReset2(strm, windowBits) ### Description Resets an inflate stream with a new windowBits value. ### Function Signature zlibInflateReset2(strm: ZStream, windowBits: number): Z_CallStatus ### Parameters - **strm** (ZStream) - Required - The stream to reset. - **windowBits** (number) - Required - The new window size in bits. ### Returns - **Z_CallStatus** - The status of the call. ``` -------------------------------- ### deflateRaw(input, options?) Source: https://nodeca.github.io/pako/functions/deflateRaw.html Compresses the given input using raw deflate, without a wrapper (header and adler32 crc). Returns the compressed data as a Uint8Array. ```APIDOC ## deflateRaw(input, options?) ### Description Compresses the given input using raw deflate, without a wrapper (header and adler32 crc). Returns the compressed data as a Uint8Array. ### Method Function ### Signature deflateRaw(input: string | ArrayBuffer | Uint8Array, options?: DeflateOptions): Uint8Array ### Parameters - **input** (string | ArrayBuffer | Uint8Array) - Required - The data to compress. - **options** (DeflateOptions) - Optional - Compression options. Defaults to {}. ### Returns - **Uint8Array** - The compressed data. ``` -------------------------------- ### Import pako with CommonJS require Source: https://nodeca.github.io/pako/index.html CommonJS import for pako, providing the `deflate` and `inflate` functions. ```javascript const { deflate, inflate } = require('pako'); ``` -------------------------------- ### zlibInflate(strm: ZStream, flush: Z_FlushMode): Z_CallStatus Source: https://nodeca.github.io/pako/functions/zlibInflate.html Inflates data using the zlib format. Takes a ZStream and a flush mode, returns a Z_CallStatus indicating the result. ```APIDOC ## zlibInflate(strm: ZStream, flush: Z_FlushMode): Z_CallStatus ### Description Inflates data using the zlib format. Takes a ZStream and a flush mode, returns a Z_CallStatus indicating the result. ### Parameters - **strm** (ZStream) - Required - The stream to inflate. - **flush** (Z_FlushMode) - Required - The flush mode to use. ### Returns - **Z_CallStatus** - The status of the inflate operation. ``` -------------------------------- ### inflate Source: https://nodeca.github.io/pako/functions/inflate.html One-shot inflate decompress. Autodetects gzip/zlib format via the wrapper header. Set toText: true to decode the result as UTF-8 text. ```APIDOC ## inflate ### Description One-shot inflate decompress. Autodetects gzip/zlib format via the wrapper header. Set toText: true to decode the result as UTF-8 text. ### Signature inflate(input: ArrayBuffer | Uint8Array, options?: O): O extends { toText: true } ? string : Uint8Array ### Type Parameters - O extends InflateOptions & { toText?: boolean } ### Parameters - input: ArrayBuffer | Uint8Array - The compressed data to decompress. - options: O = ... - Optional zlib options. See InflateOptions for details. Set toText: true to decode as UTF-8 text. ### Returns - O extends { toText: true } ? string : Uint8Array - Returns a string if toText is true, otherwise a Uint8Array. ### Example ``` import { deflate, inflate } from 'pako' const input = deflate(new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8, 9])) let output try { output = inflate(input) } catch (err) { console.log(err) } ``` ``` -------------------------------- ### Push data chunks with flush mode Source: https://nodeca.github.io/pako/classes/Deflate.html Shows the pattern for pushing data chunks to a Deflate instance: call push with false for intermediate chunks and true for the final chunk to trigger flushing and onEnd. ```javascript push(chunk, false) // push one of data chunks ... push(chunk, true) // push last chunk ``` -------------------------------- ### onData(chunk: Uint8Array): void Source: https://nodeca.github.io/pako/classes/Deflate.html By default, stores data blocks in the Deflate.chunks property and glues them in Deflate.onEnd. Override this handler if you need another behaviour. ```APIDOC ## onData(chunk: Uint8Array): void ### Description By default, stores data blocks in the Deflate.chunks property and glues them in Deflate.onEnd. Override this handler if you need another behaviour. ### Method onData ### Parameters - **chunk** (Uint8Array) - Required - The compressed data chunk. ### Returns void ``` -------------------------------- ### onData(chunk: Uint8Array): void Source: https://nodeca.github.io/pako/classes/Inflate.html By default, stores data blocks in the Inflate.chunks property and glues them in Inflate.onEnd. Override this handler if you need another behaviour. ```APIDOC ## onData(chunk: Uint8Array): void ### Description By default, stores data blocks in the Inflate.chunks property and glues them in Inflate.onEnd. Override this handler if you need another behaviour. ### Parameters - **chunk** (Uint8Array) - Required - Output data chunk. ### Returns - **void** ``` -------------------------------- ### zlibInflateGetHeader(strm, head) Source: https://nodeca.github.io/pako/functions/zlibInflateGetHeader.html Retrieves the GZIP header from the given inflate stream and stores it in the provided GZheader object. Returns a status code indicating success or failure. ```APIDOC ## zlibInflateGetHeader(strm, head) ### Description Retrieves the GZIP header information from the inflate stream and stores it in the provided GZheader object. Returns a status code indicating the result. ### Function Signature `zlibInflateGetHeader(strm: ZStream, head: GZheader): Z_CallStatus` ### Parameters - **strm** (ZStream) - Required - The inflate stream from which to retrieve the header. - **head** (GZheader) - Required - The object where the header data will be stored. ### Returns - **Z_CallStatus** - Status code indicating the result of the operation. ``` -------------------------------- ### zlibInflateSetDictionary(strm, dictionary) Source: https://nodeca.github.io/pako/functions/zlibInflateSetDictionary.html Sets the inflation dictionary for the given zlib stream. It takes a ZStream object and a Uint8Array dictionary and returns a status code indicating the operation result. ```APIDOC ## Function zlibInflateSetDictionary ### Description Sets the inflation dictionary for a zlib stream to allow inflation of data compressed with a preset dictionary. ### Signature `zlibInflateSetDictionary(strm: ZStream, dictionary: Uint8Array): Z_CallStatus` ### Parameters - **strm** (`ZStream`) – Required – The zlib stream object on which to set the inflation dictionary. - **dictionary** (`Uint8Array`) – Required – The dictionary bytes to use for inflation. ### Returns - **Z_CallStatus** – The status code indicating the success or failure of the operation. ``` -------------------------------- ### zlibDeflateSetHeader(strm: ZStream, head: GZheader): Z_CallStatus Source: https://nodeca.github.io/pako/functions/zlibDeflateSetHeader.html Sets the GZIP header for a deflate stream. Takes a ZStream and a GZheader object and returns a status code. ```APIDOC ## zlibDeflateSetHeader(strm: ZStream, head: GZheader): Z_CallStatus ### Description Sets the GZIP header for a deflate stream. This function is used to configure the header of a GZIP-compressed output. ### Parameters - **strm** (ZStream) - Required - The deflate stream to set the header on. - **head** (GZheader) - Required - The GZIP header to set. ### Returns - **Z_CallStatus** - The status of the call, indicating success or error. ``` -------------------------------- ### zlibDeflate(strm: ZStream, flush: Z_FlushMode): Z_CallStatus Source: https://nodeca.github.io/pako/functions/zlibDeflate.html Deflates data using zlib compression. Takes a ZStream and a flush mode, returns a call status. ```APIDOC ## zlibDeflate(strm: ZStream, flush: Z_FlushMode): Z_CallStatus ### Description Deflates data using zlib compression. Takes a ZStream and a flush mode, returns a call status. ### Parameters - **strm** (ZStream) - Required - The stream to deflate. - **flush** (Z_FlushMode) - Required - The flush mode. ### Returns - **Z_CallStatus** - The status of the call. ``` -------------------------------- ### onEnd(status: Z_CallStatus): void Source: https://nodeca.github.io/pako/classes/Inflate.html Called after you tell inflate that the input stream is complete (Z_FINISH). By default, joins the collected Inflate.chunks, frees memory and fills the Inflate.result property. ```APIDOC ## onEnd(status: Z_CallStatus): void ### Description Called after you tell inflate that the input stream is complete (Z_FINISH). By default, joins the collected Inflate.chunks, frees memory and fills the Inflate.result property. ### Parameters - **status** (Z_CallStatus) - Required - Inflate status. Z_OK on success, other if not. ### Returns - **void** ``` -------------------------------- ### ZStream Properties Source: https://nodeca.github.io/pako/classes/ZStream.html Properties of the ZStream class. ```APIDOC ## Properties ### input - **Type**: Uint8Array ### next_in - **Type**: number ### avail_in - **Type**: number ### total_in - **Type**: number ### output - **Type**: Uint8Array ### next_out - **Type**: number ### avail_out - **Type**: number ### total_out - **Type**: number ### msg - **Type**: string ### state - **Type**: any ### data_type - **Type**: number ### adler - **Type**: number ``` -------------------------------- ### Properties Source: https://nodeca.github.io/pako/classes/GZheader.html The GZheader class exposes properties that represent the fields of a gzip header. These properties can be read and modified to set or retrieve header information. ```APIDOC ## Properties ### text - **type**: number - Description: Indicates whether the file is text or binary. ### time - **type**: number - Description: The modification time of the file. ### xflags - **type**: number - Description: Extra flags. ### os - **type**: number - Description: The operating system that created the file. ### extra - **type**: Uint8Array | number[] | null - Description: Extra field data. ### extra_len - **type**: number - Description: Length of the extra field. ### name - **type**: string | null - Description: The original file name. ### comment - **type**: string | null - Description: A comment associated with the file. ### hcrc - **type**: boolean - Description: Indicates whether a header CRC is present. ### done - **type**: boolean - Description: Indicates whether the header has been fully processed. ``` -------------------------------- ### inflateRaw Source: https://nodeca.github.io/pako/functions/inflateRaw.html Decompresses raw deflate data without a wrapper (header and adler32 crc). Accepts an ArrayBuffer or Uint8Array input and optional options, returning a string if toText is true, otherwise a Uint8Array. ```APIDOC ## Function inflateRaw ### Description Decompresses raw deflate data without a wrapper (header and adler32 crc). This is the same as inflate but expects raw deflate data. ### Signature inflateRaw(input: ArrayBuffer | Uint8Array, options?: O): O extends { toText: true } ? string : Uint8Array ### Type Parameters - **O** extends InflateOptions & { toText?: boolean } ### Parameters - **input** (ArrayBuffer | Uint8Array) - Required - The raw deflate data to decompress. - **options** (O) - Optional - Options for decompression, including toText to return a string. ### Returns - If options.toText is true, returns a string. - Otherwise, returns a Uint8Array. ### Example ```typescript const result = inflateRaw(input, { toText: true }); ``` ``` -------------------------------- ### zlibInflateEnd(strm: ZStream): Z_CallStatus Source: https://nodeca.github.io/pako/functions/zlibInflateEnd.html The zlibInflateEnd function is used to end an inflate operation. It accepts a ZStream object and returns a Z_CallStatus indicating the outcome. ```APIDOC ## zlibInflateEnd(strm: ZStream): Z_CallStatus ### Description Ends an inflate operation. This function is part of the pako zlib inflate API. ### Function Signature `zlibInflateEnd(strm: ZStream): Z_CallStatus` ### Parameters - **strm** (ZStream) - Required - The stream object to end. ### Returns - **Z_CallStatus** - The status of the call, indicating success or error. ``` -------------------------------- ### zlibDeflateResetKeep(strm: ZStream): Z_CallStatus Source: https://nodeca.github.io/pako/functions/zlibDeflateResetKeep.html Resets a deflate stream while keeping the compression state. This function is part of the pako library's zlib API. ```APIDOC ## zlibDeflateResetKeep(strm: ZStream): Z_CallStatus ### Description Resets a deflate stream while keeping the compression state. This function is part of the pako library's zlib API. ### Method Function ### Signature `zlibDeflateResetKeep(strm: ZStream): Z_CallStatus` ### Parameters - **strm** (ZStream) - Required - The stream to reset. ### Returns - **Z_CallStatus** - The status of the call. ``` -------------------------------- ### onEnd(status: Z_CallStatus): void Source: https://nodeca.github.io/pako/classes/Deflate.html Called once after you tell deflate that the input stream is complete (Z_FINISH). By default, joins the collected Deflate.chunks into the Deflate.result property. ```APIDOC ## onEnd(status: Z_CallStatus): void ### Description Called once after you tell deflate that the input stream is complete (Z_FINISH). By default, joins the collected Deflate.chunks into the Deflate.result property. ### Method onEnd ### Parameters - **status** (Z_CallStatus) - Required - Deflate status. Z_OK on success, other if not. ### Returns void ``` -------------------------------- ### zlibInflateResetKeep(strm: ZStream): Z_CallStatus Source: https://nodeca.github.io/pako/functions/zlibInflateResetKeep.html Resets the inflate stream while keeping its state. This function is part of the pako library's zlib API and is used to reset an inflate stream without losing the current state. ```APIDOC ## Function zlibInflateResetKeep ### Description Resets the inflate stream while keeping its state. This function is part of the pako library's zlib API and is used to reset an inflate stream without losing the current state. ### Signature zlibInflateResetKeep(strm: ZStream): Z_CallStatus ### Parameters - **strm** (ZStream) - Required - The stream to reset. ### Returns - **Z_CallStatus** - The status of the reset operation. ``` -------------------------------- ### zlibDeflateReset(strm: ZStream): Z_CallStatus Source: https://nodeca.github.io/pako/functions/zlibDeflateReset.html Resets the deflate stream to its initial state. This function is used to reuse a deflate stream for a new compression operation. ```APIDOC ## zlibDeflateReset(strm: ZStream): Z_CallStatus ### Description Resets the deflate stream to its initial state, allowing the stream to be reused for a new compression operation. ### Function Signature `zlibDeflateReset(strm: ZStream): Z_CallStatus` ### Parameters - **strm** (ZStream) - Required - The deflate stream to reset. ### Returns - **Z_CallStatus** - The status of the reset operation (e.g., Z_OK, Z_STREAM_ERROR). ``` -------------------------------- ### zlibDeflateEnd(strm: ZStream): Z_CallStatus Source: https://nodeca.github.io/pako/functions/zlibDeflateEnd.html Ends a deflate session, releasing resources associated with the given stream. Returns a status code indicating success or failure. ```APIDOC ## zlibDeflateEnd(strm: ZStream): Z_CallStatus ### Description Ends a deflate session, releasing resources associated with the given stream. Returns a status code indicating success or failure. ### Function Signature zlibDeflateEnd(strm: ZStream): Z_CallStatus ### Parameters - **strm** (ZStream) - Required - The stream to end. ### Returns - **Z_CallStatus** - Status code indicating the result of the operation. ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.