Sophie

Sophie

distrib > Mageia > 6 > x86_64 > by-pkgid > 4642cf16cdfb16e1cdaefd0999c41911 > files > 141

nodejs-docs-6.17.1-8.mga6.noarch.rpm

{
  "source": "doc/api/zlib.md",
  "modules": [
    {
      "textRaw": "Zlib",
      "name": "zlib",
      "introduced_in": "v0.10.0",
      "stability": 2,
      "stabilityText": "Stable",
      "desc": "<p>The <code>zlib</code> module provides compression functionality implemented using Gzip and\nDeflate/Inflate. It can be accessed using:</p>\n<pre><code class=\"lang-js\">const zlib = require(&#39;zlib&#39;);\n</code></pre>\n<p>Compressing or decompressing a stream (such as a file) can be accomplished by\npiping the source stream data through a <code>zlib</code> stream into a destination stream:</p>\n<pre><code class=\"lang-js\">const gzip = zlib.createGzip();\nconst fs = require(&#39;fs&#39;);\nconst inp = fs.createReadStream(&#39;input.txt&#39;);\nconst out = fs.createWriteStream(&#39;input.txt.gz&#39;);\n\ninp.pipe(gzip).pipe(out);\n</code></pre>\n<p>It is also possible to compress or decompress data in a single step:</p>\n<pre><code class=\"lang-js\">const input = &#39;.................................&#39;;\nzlib.deflate(input, (err, buffer) =&gt; {\n  if (!err) {\n    console.log(buffer.toString(&#39;base64&#39;));\n  } else {\n    // handle error\n  }\n});\n\nconst buffer = Buffer.from(&#39;eJzT0yMAAGTvBe8=&#39;, &#39;base64&#39;);\nzlib.unzip(buffer, (err, buffer) =&gt; {\n  if (!err) {\n    console.log(buffer.toString());\n  } else {\n    // handle error\n  }\n});\n</code></pre>\n",
      "modules": [
        {
          "textRaw": "Compressing HTTP requests and responses",
          "name": "compressing_http_requests_and_responses",
          "desc": "<p>The <code>zlib</code> module can be used to implement support for the <code>gzip</code> and <code>deflate</code>\ncontent-encoding mechanisms defined by\n<a href=\"https://tools.ietf.org/html/rfc7230#section-4.2\">HTTP</a>.</p>\n<p>The HTTP <a href=\"https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.3\"><code>Accept-Encoding</code></a> header is used within an http request to identify\nthe compression encodings accepted by the client. The <a href=\"https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.11\"><code>Content-Encoding</code></a>\nheader is used to identify the compression encodings actually applied to a\nmessage.</p>\n<p><strong>Note: the examples given below are drastically simplified to show\nthe basic concept.</strong> Using <code>zlib</code> encoding can be expensive, and the results\nought to be cached. See <a href=\"#zlib_memory_usage_tuning\">Memory Usage Tuning</a> for more information\non the speed/memory/compression tradeoffs involved in <code>zlib</code> usage.</p>\n<pre><code class=\"lang-js\">// client request example\nconst zlib = require(&#39;zlib&#39;);\nconst http = require(&#39;http&#39;);\nconst fs = require(&#39;fs&#39;);\nconst request = http.get({ host: &#39;example.com&#39;,\n                           path: &#39;/&#39;,\n                           port: 80,\n                           headers: { &#39;Accept-Encoding&#39;: &#39;gzip,deflate&#39; } });\nrequest.on(&#39;response&#39;, (response) =&gt; {\n  const output = fs.createWriteStream(&#39;example.com_index.html&#39;);\n\n  switch (response.headers[&#39;content-encoding&#39;]) {\n    // or, just use zlib.createUnzip() to handle both cases\n    case &#39;gzip&#39;:\n      response.pipe(zlib.createGunzip()).pipe(output);\n      break;\n    case &#39;deflate&#39;:\n      response.pipe(zlib.createInflate()).pipe(output);\n      break;\n    default:\n      response.pipe(output);\n      break;\n  }\n});\n</code></pre>\n<pre><code class=\"lang-js\">// server example\n// Running a gzip operation on every request is quite expensive.\n// It would be much more efficient to cache the compressed buffer.\nconst zlib = require(&#39;zlib&#39;);\nconst http = require(&#39;http&#39;);\nconst fs = require(&#39;fs&#39;);\nhttp.createServer((request, response) =&gt; {\n  const raw = fs.createReadStream(&#39;index.html&#39;);\n  let acceptEncoding = request.headers[&#39;accept-encoding&#39;];\n  if (!acceptEncoding) {\n    acceptEncoding = &#39;&#39;;\n  }\n\n  // Note: this is not a conformant accept-encoding parser.\n  // See http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.3\n  if (acceptEncoding.match(/\\bdeflate\\b/)) {\n    response.writeHead(200, { &#39;Content-Encoding&#39;: &#39;deflate&#39; });\n    raw.pipe(zlib.createDeflate()).pipe(response);\n  } else if (acceptEncoding.match(/\\bgzip\\b/)) {\n    response.writeHead(200, { &#39;Content-Encoding&#39;: &#39;gzip&#39; });\n    raw.pipe(zlib.createGzip()).pipe(response);\n  } else {\n    response.writeHead(200, {});\n    raw.pipe(response);\n  }\n}).listen(1337);\n</code></pre>\n<p>By default, the <code>zlib</code> methods will throw an error when decompressing\ntruncated data. However, if it is known that the data is incomplete, or\nthe desire is to inspect only the beginning of a compressed file, it is\npossible to suppress the default error handling by changing the flushing\nmethod that is used to compressed the last chunk of input data:</p>\n<pre><code class=\"lang-js\">// This is a truncated version of the buffer from the above examples\nconst buffer = Buffer.from(&#39;eJzT0yMA&#39;, &#39;base64&#39;);\n\nzlib.unzip(\n  buffer,\n  { finishFlush: zlib.Z_SYNC_FLUSH },\n  (err, buffer) =&gt; {\n    if (!err) {\n      console.log(buffer.toString());\n    } else {\n      // handle error\n    }\n  });\n</code></pre>\n<p>This will not change the behavior in other error-throwing situations, e.g.\nwhen the input data has an invalid format. Using this method, it will not be\npossible to determine whether the input ended prematurely or lacks the\nintegrity checks, making it necessary to manually check that the\ndecompressed result is valid.</p>\n",
          "type": "module",
          "displayName": "Compressing HTTP requests and responses"
        },
        {
          "textRaw": "Flushing",
          "name": "flushing",
          "desc": "<p>Calling <a href=\"#zlib_zlib_flush_kind_callback\"><code>.flush()</code></a> on a compression stream will make <code>zlib</code> return as much\noutput as currently possible. This may come at the cost of degraded compression\nquality, but can be useful when data needs to be available as soon as possible.</p>\n<p>In the following example, <code>flush()</code> is used to write a compressed partial\nHTTP response to the client:</p>\n<pre><code class=\"lang-js\">const zlib = require(&#39;zlib&#39;);\nconst http = require(&#39;http&#39;);\n\nhttp.createServer((request, response) =&gt; {\n  // For the sake of simplicity, the Accept-Encoding checks are omitted.\n  response.writeHead(200, { &#39;content-encoding&#39;: &#39;gzip&#39; });\n  const output = zlib.createGzip();\n  output.pipe(response);\n\n  setInterval(() =&gt; {\n    output.write(`The current time is ${Date()}\\n`, () =&gt; {\n      // The data has been passed to zlib, but the compression algorithm may\n      // have decided to buffer the data for more efficient compression.\n      // Calling .flush() will make the data available as soon as the client\n      // is ready to receive it.\n      output.flush();\n    });\n  }, 1000);\n}).listen(1337);\n</code></pre>\n",
          "type": "module",
          "displayName": "Flushing"
        }
      ],
      "miscs": [
        {
          "textRaw": "Memory Usage Tuning",
          "name": "Memory Usage Tuning",
          "type": "misc",
          "desc": "<p>From <code>zlib/zconf.h</code>, modified to node.js&#39;s usage:</p>\n<p>The memory requirements for deflate are (in bytes):</p>\n<pre><code class=\"lang-js\">(1 &lt;&lt; (windowBits + 2)) + (1 &lt;&lt; (memLevel + 9));\n</code></pre>\n<p>That is: 128K for windowBits = 15 + 128K for memLevel = 8\n(default values) plus a few kilobytes for small objects.</p>\n<p>For example, to reduce the default memory requirements from 256K to 128K, the\noptions should be set to:</p>\n<pre><code class=\"lang-js\">const options = { windowBits: 14, memLevel: 7 };\n</code></pre>\n<p>This will, however, generally degrade compression.</p>\n<p>The memory requirements for inflate are (in bytes)</p>\n<pre><code class=\"lang-js\">1 &lt;&lt; windowBits;\n</code></pre>\n<p>That is, 32K for windowBits = 15 (default value) plus a few kilobytes\nfor small objects.</p>\n<p>This is in addition to a single internal output slab buffer of size\n<code>chunkSize</code>, which defaults to 16K.</p>\n<p>The speed of <code>zlib</code> compression is affected most dramatically by the\n<code>level</code> setting. A higher level will result in better compression, but\nwill take longer to complete. A lower level will result in less\ncompression, but will be much faster.</p>\n<p>In general, greater memory usage options will mean that Node.js has to make\nfewer calls to <code>zlib</code> because it will be able to process more data on\neach <code>write</code> operation. So, this is another factor that affects the\nspeed, at the cost of memory usage.</p>\n"
        },
        {
          "textRaw": "Constants",
          "name": "Constants",
          "meta": {
            "added": [
              "v0.5.8"
            ]
          },
          "type": "misc",
          "desc": "<p>All of the constants defined in <code>zlib.h</code> are also defined on <code>require(&#39;zlib&#39;)</code>.\nIn the normal course of operations, it will not be necessary to use these\nconstants. They are documented so that their presence is not surprising. This\nsection is taken almost directly from the <a href=\"http://zlib.net/manual.html#Constants\">zlib documentation</a>. See\n<a href=\"http://zlib.net/manual.html#Constants\">http://zlib.net/manual.html#Constants</a> for more details.</p>\n<p>Allowed flush values.</p>\n<ul>\n<li><code>zlib.Z_NO_FLUSH</code></li>\n<li><code>zlib.Z_PARTIAL_FLUSH</code></li>\n<li><code>zlib.Z_SYNC_FLUSH</code></li>\n<li><code>zlib.Z_FULL_FLUSH</code></li>\n<li><code>zlib.Z_FINISH</code></li>\n<li><code>zlib.Z_BLOCK</code></li>\n<li><code>zlib.Z_TREES</code></li>\n</ul>\n<p>Return codes for the compression/decompression functions. Negative\nvalues are errors, positive values are used for special but normal\nevents.</p>\n<ul>\n<li><code>zlib.Z_OK</code></li>\n<li><code>zlib.Z_STREAM_END</code></li>\n<li><code>zlib.Z_NEED_DICT</code></li>\n<li><code>zlib.Z_ERRNO</code></li>\n<li><code>zlib.Z_STREAM_ERROR</code></li>\n<li><code>zlib.Z_DATA_ERROR</code></li>\n<li><code>zlib.Z_MEM_ERROR</code></li>\n<li><code>zlib.Z_BUF_ERROR</code></li>\n<li><code>zlib.Z_VERSION_ERROR</code></li>\n</ul>\n<p>Compression levels.</p>\n<ul>\n<li><code>zlib.Z_NO_COMPRESSION</code></li>\n<li><code>zlib.Z_BEST_SPEED</code></li>\n<li><code>zlib.Z_BEST_COMPRESSION</code></li>\n<li><code>zlib.Z_DEFAULT_COMPRESSION</code></li>\n</ul>\n<p>Compression strategy.</p>\n<ul>\n<li><code>zlib.Z_FILTERED</code></li>\n<li><code>zlib.Z_HUFFMAN_ONLY</code></li>\n<li><code>zlib.Z_RLE</code></li>\n<li><code>zlib.Z_FIXED</code></li>\n<li><code>zlib.Z_DEFAULT_STRATEGY</code></li>\n</ul>\n<p>The deflate compression method (the only one supported in this version).</p>\n<ul>\n<li><code>zlib.Z_DEFLATED</code></li>\n</ul>\n<p>For initializing zalloc, zfree, opaque.</p>\n<ul>\n<li><code>zlib.Z_NULL</code></li>\n</ul>\n"
        },
        {
          "textRaw": "Class Options",
          "name": "Class Options",
          "meta": {
            "added": [
              "v0.11.1"
            ]
          },
          "type": "misc",
          "desc": "<p>Each class takes an <code>options</code> object. All options are optional.</p>\n<p>Note that some options are only relevant when compressing, and are\nignored by the decompression classes.</p>\n<ul>\n<li><code>flush</code> (default: <code>zlib.Z_NO_FLUSH</code>)</li>\n<li><code>finishFlush</code> (default: <code>zlib.Z_FINISH</code>)</li>\n<li><code>chunkSize</code> (default: <code>16 * 1024</code>)</li>\n<li><code>windowBits</code></li>\n<li><code>level</code> (compression only)</li>\n<li><code>memLevel</code> (compression only)</li>\n<li><code>strategy</code> (compression only)</li>\n<li><code>dictionary</code> (deflate/inflate only, empty dictionary by default)</li>\n</ul>\n<p>See the description of <code>deflateInit2</code> and <code>inflateInit2</code> at\n<a href=\"http://zlib.net/manual.html#Advanced\">http://zlib.net/manual.html#Advanced</a> for more information on these.</p>\n"
        },
        {
          "textRaw": "Convenience Methods",
          "name": "Convenience Methods",
          "type": "misc",
          "desc": "<p>All of these take a <a href=\"buffer.html\">Buffer</a> or string as the first argument, an optional\nsecond argument to supply options to the <code>zlib</code> classes and will call the\nsupplied callback with <code>callback(error, result)</code>.</p>\n<p>Every method has a <code>*Sync</code> counterpart, which accept the same arguments, but\nwithout a callback.</p>\n",
          "methods": [
            {
              "textRaw": "zlib.deflate(buf[, options], callback)",
              "type": "method",
              "name": "deflate",
              "meta": {
                "added": [
                  "v0.6.0"
                ]
              },
              "desc": "<p>Compress a <a href=\"buffer.html\">Buffer</a> or string with <a href=\"#zlib_class_zlib_deflate\">Deflate</a>.</p>\n",
              "signatures": [
                {
                  "params": [
                    {
                      "name": "buf"
                    },
                    {
                      "name": "options",
                      "optional": true
                    }
                  ]
                },
                {
                  "params": [
                    {
                      "name": "buf"
                    },
                    {
                      "name": "options",
                      "optional": true
                    },
                    {
                      "name": "callback"
                    }
                  ]
                }
              ]
            },
            {
              "textRaw": "zlib.deflateSync(buf[, options])",
              "type": "method",
              "name": "deflateSync",
              "meta": {
                "added": [
                  "v0.11.12"
                ]
              },
              "desc": "<p>Compress a <a href=\"buffer.html\">Buffer</a> or string with <a href=\"#zlib_class_zlib_deflate\">Deflate</a>.</p>\n",
              "signatures": [
                {
                  "params": [
                    {
                      "name": "buf"
                    },
                    {
                      "name": "options",
                      "optional": true
                    }
                  ]
                }
              ]
            },
            {
              "textRaw": "zlib.deflateRaw(buf[, options], callback)",
              "type": "method",
              "name": "deflateRaw",
              "meta": {
                "added": [
                  "v0.6.0"
                ]
              },
              "desc": "<p>Compress a <a href=\"buffer.html\">Buffer</a> or string with <a href=\"#zlib_class_zlib_deflateraw\">DeflateRaw</a>.</p>\n",
              "signatures": [
                {
                  "params": [
                    {
                      "name": "buf"
                    },
                    {
                      "name": "options",
                      "optional": true
                    }
                  ]
                },
                {
                  "params": [
                    {
                      "name": "buf"
                    },
                    {
                      "name": "options",
                      "optional": true
                    },
                    {
                      "name": "callback"
                    }
                  ]
                }
              ]
            },
            {
              "textRaw": "zlib.deflateRawSync(buf[, options])",
              "type": "method",
              "name": "deflateRawSync",
              "meta": {
                "added": [
                  "v0.11.12"
                ]
              },
              "desc": "<p>Compress a <a href=\"buffer.html\">Buffer</a> or string with <a href=\"#zlib_class_zlib_deflateraw\">DeflateRaw</a>.</p>\n",
              "signatures": [
                {
                  "params": [
                    {
                      "name": "buf"
                    },
                    {
                      "name": "options",
                      "optional": true
                    }
                  ]
                }
              ]
            },
            {
              "textRaw": "zlib.gunzip(buf[, options], callback)",
              "type": "method",
              "name": "gunzip",
              "meta": {
                "added": [
                  "v0.6.0"
                ]
              },
              "desc": "<p>Decompress a <a href=\"buffer.html\">Buffer</a> or string with <a href=\"#zlib_class_zlib_gunzip\">Gunzip</a>.</p>\n",
              "signatures": [
                {
                  "params": [
                    {
                      "name": "buf"
                    },
                    {
                      "name": "options",
                      "optional": true
                    }
                  ]
                },
                {
                  "params": [
                    {
                      "name": "buf"
                    },
                    {
                      "name": "options",
                      "optional": true
                    },
                    {
                      "name": "callback"
                    }
                  ]
                }
              ]
            },
            {
              "textRaw": "zlib.gunzipSync(buf[, options])",
              "type": "method",
              "name": "gunzipSync",
              "meta": {
                "added": [
                  "v0.11.12"
                ]
              },
              "desc": "<p>Decompress a <a href=\"buffer.html\">Buffer</a> or string with <a href=\"#zlib_class_zlib_gunzip\">Gunzip</a>.</p>\n",
              "signatures": [
                {
                  "params": [
                    {
                      "name": "buf"
                    },
                    {
                      "name": "options",
                      "optional": true
                    }
                  ]
                }
              ]
            },
            {
              "textRaw": "zlib.gzip(buf[, options], callback)",
              "type": "method",
              "name": "gzip",
              "meta": {
                "added": [
                  "v0.6.0"
                ]
              },
              "desc": "<p>Compress a <a href=\"buffer.html\">Buffer</a> or string with <a href=\"#zlib_class_zlib_gzip\">Gzip</a>.</p>\n",
              "signatures": [
                {
                  "params": [
                    {
                      "name": "buf"
                    },
                    {
                      "name": "options",
                      "optional": true
                    }
                  ]
                },
                {
                  "params": [
                    {
                      "name": "buf"
                    },
                    {
                      "name": "options",
                      "optional": true
                    },
                    {
                      "name": "callback"
                    }
                  ]
                }
              ]
            },
            {
              "textRaw": "zlib.gzipSync(buf[, options])",
              "type": "method",
              "name": "gzipSync",
              "meta": {
                "added": [
                  "v0.11.12"
                ]
              },
              "desc": "<p>Compress a <a href=\"buffer.html\">Buffer</a> or string with <a href=\"#zlib_class_zlib_gzip\">Gzip</a>.</p>\n",
              "signatures": [
                {
                  "params": [
                    {
                      "name": "buf"
                    },
                    {
                      "name": "options",
                      "optional": true
                    }
                  ]
                }
              ]
            },
            {
              "textRaw": "zlib.inflate(buf[, options], callback)",
              "type": "method",
              "name": "inflate",
              "meta": {
                "added": [
                  "v0.6.0"
                ]
              },
              "desc": "<p>Decompress a <a href=\"buffer.html\">Buffer</a> or string with <a href=\"#zlib_class_zlib_inflate\">Inflate</a>.</p>\n",
              "signatures": [
                {
                  "params": [
                    {
                      "name": "buf"
                    },
                    {
                      "name": "options",
                      "optional": true
                    }
                  ]
                },
                {
                  "params": [
                    {
                      "name": "buf"
                    },
                    {
                      "name": "options",
                      "optional": true
                    },
                    {
                      "name": "callback"
                    }
                  ]
                }
              ]
            },
            {
              "textRaw": "zlib.inflateSync(buf[, options])",
              "type": "method",
              "name": "inflateSync",
              "meta": {
                "added": [
                  "v0.11.12"
                ]
              },
              "desc": "<p>Decompress a <a href=\"buffer.html\">Buffer</a> or string with <a href=\"#zlib_class_zlib_inflate\">Inflate</a>.</p>\n",
              "signatures": [
                {
                  "params": [
                    {
                      "name": "buf"
                    },
                    {
                      "name": "options",
                      "optional": true
                    }
                  ]
                }
              ]
            },
            {
              "textRaw": "zlib.inflateRaw(buf[, options], callback)",
              "type": "method",
              "name": "inflateRaw",
              "meta": {
                "added": [
                  "v0.6.0"
                ]
              },
              "desc": "<p>Decompress a <a href=\"buffer.html\">Buffer</a> or string with <a href=\"#zlib_class_zlib_inflateraw\">InflateRaw</a>.</p>\n",
              "signatures": [
                {
                  "params": [
                    {
                      "name": "buf"
                    },
                    {
                      "name": "options",
                      "optional": true
                    }
                  ]
                },
                {
                  "params": [
                    {
                      "name": "buf"
                    },
                    {
                      "name": "options",
                      "optional": true
                    },
                    {
                      "name": "callback"
                    }
                  ]
                }
              ]
            },
            {
              "textRaw": "zlib.inflateRawSync(buf[, options])",
              "type": "method",
              "name": "inflateRawSync",
              "meta": {
                "added": [
                  "v0.11.12"
                ]
              },
              "desc": "<p>Decompress a <a href=\"buffer.html\">Buffer</a> or string with <a href=\"#zlib_class_zlib_inflateraw\">InflateRaw</a>.</p>\n",
              "signatures": [
                {
                  "params": [
                    {
                      "name": "buf"
                    },
                    {
                      "name": "options",
                      "optional": true
                    }
                  ]
                }
              ]
            },
            {
              "textRaw": "zlib.unzip(buf[, options], callback)",
              "type": "method",
              "name": "unzip",
              "meta": {
                "added": [
                  "v0.6.0"
                ]
              },
              "desc": "<p>Decompress a <a href=\"buffer.html\">Buffer</a> or string with <a href=\"#zlib_class_zlib_unzip\">Unzip</a>.</p>\n",
              "signatures": [
                {
                  "params": [
                    {
                      "name": "buf"
                    },
                    {
                      "name": "options",
                      "optional": true
                    }
                  ]
                },
                {
                  "params": [
                    {
                      "name": "buf"
                    },
                    {
                      "name": "options",
                      "optional": true
                    },
                    {
                      "name": "callback"
                    }
                  ]
                }
              ]
            },
            {
              "textRaw": "zlib.unzipSync(buf[, options])",
              "type": "method",
              "name": "unzipSync",
              "meta": {
                "added": [
                  "v0.11.12"
                ]
              },
              "desc": "<p>Decompress a <a href=\"buffer.html\">Buffer</a> or string with <a href=\"#zlib_class_zlib_unzip\">Unzip</a>.</p>\n",
              "signatures": [
                {
                  "params": [
                    {
                      "name": "buf"
                    },
                    {
                      "name": "options",
                      "optional": true
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "meta": {
        "added": [
          "v0.5.8"
        ]
      },
      "classes": [
        {
          "textRaw": "Class: zlib.Deflate",
          "type": "class",
          "name": "zlib.Deflate",
          "meta": {
            "added": [
              "v0.5.8"
            ]
          },
          "desc": "<p>Compress data using deflate.</p>\n"
        },
        {
          "textRaw": "Class: zlib.DeflateRaw",
          "type": "class",
          "name": "zlib.DeflateRaw",
          "meta": {
            "added": [
              "v0.5.8"
            ]
          },
          "desc": "<p>Compress data using deflate, and do not append a <code>zlib</code> header.</p>\n"
        },
        {
          "textRaw": "Class: zlib.Gunzip",
          "type": "class",
          "name": "zlib.Gunzip",
          "meta": {
            "added": [
              "v0.5.8"
            ]
          },
          "desc": "<p>Decompress a gzip stream.</p>\n"
        },
        {
          "textRaw": "Class: zlib.Gzip",
          "type": "class",
          "name": "zlib.Gzip",
          "meta": {
            "added": [
              "v0.5.8"
            ]
          },
          "desc": "<p>Compress data using gzip.</p>\n"
        },
        {
          "textRaw": "Class: zlib.Inflate",
          "type": "class",
          "name": "zlib.Inflate",
          "meta": {
            "added": [
              "v0.5.8"
            ]
          },
          "desc": "<p>Decompress a deflate stream.</p>\n"
        },
        {
          "textRaw": "Class: zlib.InflateRaw",
          "type": "class",
          "name": "zlib.InflateRaw",
          "meta": {
            "added": [
              "v0.5.8"
            ]
          },
          "desc": "<p>Decompress a raw deflate stream.</p>\n"
        },
        {
          "textRaw": "Class: zlib.Unzip",
          "type": "class",
          "name": "zlib.Unzip",
          "meta": {
            "added": [
              "v0.5.8"
            ]
          },
          "desc": "<p>Decompress either a Gzip- or Deflate-compressed stream by auto-detecting\nthe header.</p>\n"
        },
        {
          "textRaw": "Class: zlib.Zlib",
          "type": "class",
          "name": "zlib.Zlib",
          "meta": {
            "added": [
              "v0.5.8"
            ]
          },
          "desc": "<p>Not exported by the <code>zlib</code> module. It is documented here because it is the base\nclass of the compressor/decompressor classes.</p>\n",
          "methods": [
            {
              "textRaw": "zlib.close([callback])",
              "type": "method",
              "name": "close",
              "meta": {
                "added": [
                  "v0.9.4"
                ]
              },
              "desc": "<p>Close the underlying handle.</p>\n",
              "signatures": [
                {
                  "params": [
                    {
                      "name": "callback",
                      "optional": true
                    }
                  ]
                }
              ]
            },
            {
              "textRaw": "zlib.flush([kind], callback)",
              "type": "method",
              "name": "flush",
              "meta": {
                "added": [
                  "v0.5.8"
                ]
              },
              "desc": "<p><code>kind</code> defaults to <code>zlib.Z_FULL_FLUSH</code>.</p>\n<p>Flush pending data. Don&#39;t call this frivolously, premature flushes negatively\nimpact the effectiveness of the compression algorithm.</p>\n<p>Calling this only flushes data from the internal <code>zlib</code> state, and does not\nperform flushing of any kind on the streams level. Rather, it behaves like a\nnormal call to <code>.write()</code>, i.e. it will be queued up behind other pending\nwrites and will only produce output when data is being read from the stream.</p>\n",
              "signatures": [
                {
                  "params": [
                    {
                      "name": "kind",
                      "optional": true
                    },
                    {
                      "name": "callback"
                    }
                  ]
                }
              ]
            },
            {
              "textRaw": "zlib.params(level, strategy, callback)",
              "type": "method",
              "name": "params",
              "meta": {
                "added": [
                  "v0.11.4"
                ]
              },
              "desc": "<p>Dynamically update the compression level and compression strategy.\nOnly applicable to deflate algorithm.</p>\n",
              "signatures": [
                {
                  "params": [
                    {
                      "name": "level"
                    },
                    {
                      "name": "strategy"
                    },
                    {
                      "name": "callback"
                    }
                  ]
                }
              ]
            },
            {
              "textRaw": "zlib.reset()",
              "type": "method",
              "name": "reset",
              "meta": {
                "added": [
                  "v0.7.0"
                ]
              },
              "desc": "<p>Reset the compressor/decompressor to factory defaults. Only applicable to\nthe inflate and deflate algorithms.</p>\n",
              "signatures": [
                {
                  "params": []
                }
              ]
            }
          ]
        }
      ],
      "properties": [
        {
          "textRaw": "zlib.constants",
          "name": "constants",
          "meta": {
            "added": [
              "v7.0.0"
            ]
          },
          "desc": "<p>Provides an object enumerating Zlib-related constants.</p>\n"
        }
      ],
      "methods": [
        {
          "textRaw": "zlib.createDeflate([options])",
          "type": "method",
          "name": "createDeflate",
          "meta": {
            "added": [
              "v0.5.8"
            ]
          },
          "desc": "<p>Returns a new <a href=\"#zlib_class_zlib_deflate\">Deflate</a> object with an <a href=\"#zlib_class_options\">options</a>.</p>\n",
          "signatures": [
            {
              "params": [
                {
                  "name": "options",
                  "optional": true
                }
              ]
            }
          ]
        },
        {
          "textRaw": "zlib.createDeflateRaw([options])",
          "type": "method",
          "name": "createDeflateRaw",
          "meta": {
            "added": [
              "v0.5.8"
            ]
          },
          "desc": "<p>Returns a new <a href=\"#zlib_class_zlib_deflateraw\">DeflateRaw</a> object with an <a href=\"#zlib_class_options\">options</a>.</p>\n<p><em>Note</em>: An upgrade of zlib from 1.2.8 to 1.2.11 changed behavior when windowBits\nis set to 8 for raw deflate streams. zlib would automatically set windowBits\nto 9 if was initially set to 8. Newer versions of zlib will throw an exception,\nso Node.js restored the original behavior of upgrading a value of 8 to 9,\nsince passing <code>windowBits = 9</code> to zlib actually results in a compressed stream\nthat effectively uses an 8-bit window only.</p>\n",
          "signatures": [
            {
              "params": [
                {
                  "name": "options",
                  "optional": true
                }
              ]
            }
          ]
        },
        {
          "textRaw": "zlib.createGunzip([options])",
          "type": "method",
          "name": "createGunzip",
          "meta": {
            "added": [
              "v0.5.8"
            ]
          },
          "desc": "<p>Returns a new <a href=\"#zlib_class_zlib_gunzip\">Gunzip</a> object with an <a href=\"#zlib_class_options\">options</a>.</p>\n",
          "signatures": [
            {
              "params": [
                {
                  "name": "options",
                  "optional": true
                }
              ]
            }
          ]
        },
        {
          "textRaw": "zlib.createGzip([options])",
          "type": "method",
          "name": "createGzip",
          "meta": {
            "added": [
              "v0.5.8"
            ]
          },
          "desc": "<p>Returns a new <a href=\"#zlib_class_zlib_gzip\">Gzip</a> object with an <a href=\"#zlib_class_options\">options</a>.</p>\n",
          "signatures": [
            {
              "params": [
                {
                  "name": "options",
                  "optional": true
                }
              ]
            }
          ]
        },
        {
          "textRaw": "zlib.createInflate([options])",
          "type": "method",
          "name": "createInflate",
          "meta": {
            "added": [
              "v0.5.8"
            ]
          },
          "desc": "<p>Returns a new <a href=\"#zlib_class_zlib_inflate\">Inflate</a> object with an <a href=\"#zlib_class_options\">options</a>.</p>\n",
          "signatures": [
            {
              "params": [
                {
                  "name": "options",
                  "optional": true
                }
              ]
            }
          ]
        },
        {
          "textRaw": "zlib.createInflateRaw([options])",
          "type": "method",
          "name": "createInflateRaw",
          "meta": {
            "added": [
              "v0.5.8"
            ]
          },
          "desc": "<p>Returns a new <a href=\"#zlib_class_zlib_inflateraw\">InflateRaw</a> object with an <a href=\"#zlib_class_options\">options</a>.</p>\n",
          "signatures": [
            {
              "params": [
                {
                  "name": "options",
                  "optional": true
                }
              ]
            }
          ]
        },
        {
          "textRaw": "zlib.createUnzip([options])",
          "type": "method",
          "name": "createUnzip",
          "meta": {
            "added": [
              "v0.5.8"
            ]
          },
          "desc": "<p>Returns a new <a href=\"#zlib_class_zlib_unzip\">Unzip</a> object with an <a href=\"#zlib_class_options\">options</a>.</p>\n",
          "signatures": [
            {
              "params": [
                {
                  "name": "options",
                  "optional": true
                }
              ]
            }
          ]
        }
      ],
      "type": "module",
      "displayName": "Zlib"
    }
  ]
}