{"$schema":"https://doc-kit.nodejs.org/schemas/api-doc/1.0.0.json","id":"zlib","path":"/zlib","type":"module","module":"zlib","title":"Zlib","introducedIn":"v0.10.0","sourceLink":{"path":"lib/zlib.js","url":"https://github.com/nodejs/node/blob/HEAD/lib/zlib.js"},"stability":{"index":"2","description":"Stable"},"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"The `node:zlib` module provides compression functionality implemented using\nGzip, Deflate/Inflate, Brotli, and Zstd.\n\nTo access it:\n\n```mjs\nimport zlib from 'node:zlib';\n```\n\n```cjs\nconst zlib = require('node:zlib');\n```\n\nCompression and decompression are built around the Node.js [Streams API](stream.html).\n\nCompressing or decompressing a stream (such as a file) can be accomplished by\npiping the source stream through a `zlib` `Transform` stream into a destination\nstream:\n\n```mjs\nimport {\n  createReadStream,\n  createWriteStream,\n} from 'node:fs';\nimport process from 'node:process';\nimport { createGzip } from 'node:zlib';\nimport { pipeline } from 'node:stream';\n\nconst gzip = createGzip();\nconst source = createReadStream('input.txt');\nconst destination = createWriteStream('input.txt.gz');\n\npipeline(source, gzip, destination, (err) => {\n  if (err) {\n    console.error('An error occurred:', err);\n    process.exitCode = 1;\n  }\n});\n```\n\n```cjs\nconst {\n  createReadStream,\n  createWriteStream,\n} = require('node:fs');\nconst { createGzip } = require('node:zlib');\nconst { pipeline } = require('node:stream');\n\nconst gzip = createGzip();\nconst source = createReadStream('input.txt');\nconst destination = createWriteStream('input.txt.gz');\n\npipeline(source, gzip, destination, (err) => {\n  if (err) {\n    console.error('An error occurred:', err);\n    process.exitCode = 1;\n  }\n});\n```\n\nOr, using the promise `pipeline` API:\n\n```mjs\nimport {\n  createReadStream,\n  createWriteStream,\n} from 'node:fs';\nimport { createGzip } from 'node:zlib';\nimport { pipeline } from 'node:stream/promises';\n\nasync function do_gzip(input, output) {\n  const gzip = createGzip();\n  const source = createReadStream(input);\n  const destination = createWriteStream(output);\n  await pipeline(source, gzip, destination);\n}\n\nawait do_gzip('input.txt', 'input.txt.gz');\n```\n\n```cjs\nconst {\n  createReadStream,\n  createWriteStream,\n} = require('node:fs');\nconst { createGzip } = require('node:zlib');\nconst { pipeline } = require('node:stream/promises');\n\nasync function do_gzip(input, output) {\n  const gzip = createGzip();\n  const source = createReadStream(input);\n  const destination = createWriteStream(output);\n  await pipeline(source, gzip, destination);\n}\n\ndo_gzip('input.txt', 'input.txt.gz')\n  .catch((err) => {\n    console.error('An error occurred:', err);\n    process.exitCode = 1;\n  });\n```\n\nIt is also possible to compress or decompress data in a single step:\n\n```mjs\nimport process from 'node:process';\nimport { Buffer } from 'node:buffer';\nimport { deflate, unzip } from 'node:zlib';\n\nconst input = '.................................';\ndeflate(input, (err, buffer) => {\n  if (err) {\n    console.error('An error occurred:', err);\n    process.exitCode = 1;\n  }\n  console.log(buffer.toString('base64'));\n});\n\nconst buffer = Buffer.from('eJzT0yMAAGTvBe8=', 'base64');\nunzip(buffer, (err, buffer) => {\n  if (err) {\n    console.error('An error occurred:', err);\n    process.exitCode = 1;\n  }\n  console.log(buffer.toString());\n});\n\n// Or, Promisified\n\nimport { promisify } from 'node:util';\nconst do_unzip = promisify(unzip);\n\nconst unzippedBuffer = await do_unzip(buffer);\nconsole.log(unzippedBuffer.toString());\n```\n\n```cjs\nconst { deflate, unzip } = require('node:zlib');\n\nconst input = '.................................';\ndeflate(input, (err, buffer) => {\n  if (err) {\n    console.error('An error occurred:', err);\n    process.exitCode = 1;\n  }\n  console.log(buffer.toString('base64'));\n});\n\nconst buffer = Buffer.from('eJzT0yMAAGTvBe8=', 'base64');\nunzip(buffer, (err, buffer) => {\n  if (err) {\n    console.error('An error occurred:', err);\n    process.exitCode = 1;\n  }\n  console.log(buffer.toString());\n});\n\n// Or, Promisified\n\nconst { promisify } = require('node:util');\nconst do_unzip = promisify(unzip);\n\ndo_unzip(buffer)\n  .then((buf) => console.log(buf.toString()))\n  .catch((err) => {\n    console.error('An error occurred:', err);\n    process.exitCode = 1;\n  });\n```","summary":"The `node:zlib` module provides compression functionality implemented using Gzip, Deflate/Inflate, Brotli, and Zstd.","examples":[{"language":"mjs","displayName":null,"code":"import zlib from 'node:zlib';"},{"language":"cjs","displayName":null,"code":"const zlib = require('node:zlib');"},{"language":"mjs","displayName":null,"code":"import {\n  createReadStream,\n  createWriteStream,\n} from 'node:fs';\nimport process from 'node:process';\nimport { createGzip } from 'node:zlib';\nimport { pipeline } from 'node:stream';\n\nconst gzip = createGzip();\nconst source = createReadStream('input.txt');\nconst destination = createWriteStream('input.txt.gz');\n\npipeline(source, gzip, destination, (err) => {\n  if (err) {\n    console.error('An error occurred:', err);\n    process.exitCode = 1;\n  }\n});"},{"language":"cjs","displayName":null,"code":"const {\n  createReadStream,\n  createWriteStream,\n} = require('node:fs');\nconst { createGzip } = require('node:zlib');\nconst { pipeline } = require('node:stream');\n\nconst gzip = createGzip();\nconst source = createReadStream('input.txt');\nconst destination = createWriteStream('input.txt.gz');\n\npipeline(source, gzip, destination, (err) => {\n  if (err) {\n    console.error('An error occurred:', err);\n    process.exitCode = 1;\n  }\n});"},{"language":"mjs","displayName":null,"code":"import {\n  createReadStream,\n  createWriteStream,\n} from 'node:fs';\nimport { createGzip } from 'node:zlib';\nimport { pipeline } from 'node:stream/promises';\n\nasync function do_gzip(input, output) {\n  const gzip = createGzip();\n  const source = createReadStream(input);\n  const destination = createWriteStream(output);\n  await pipeline(source, gzip, destination);\n}\n\nawait do_gzip('input.txt', 'input.txt.gz');"},{"language":"cjs","displayName":null,"code":"const {\n  createReadStream,\n  createWriteStream,\n} = require('node:fs');\nconst { createGzip } = require('node:zlib');\nconst { pipeline } = require('node:stream/promises');\n\nasync function do_gzip(input, output) {\n  const gzip = createGzip();\n  const source = createReadStream(input);\n  const destination = createWriteStream(output);\n  await pipeline(source, gzip, destination);\n}\n\ndo_gzip('input.txt', 'input.txt.gz')\n  .catch((err) => {\n    console.error('An error occurred:', err);\n    process.exitCode = 1;\n  });"},{"language":"mjs","displayName":null,"code":"import process from 'node:process';\nimport { Buffer } from 'node:buffer';\nimport { deflate, unzip } from 'node:zlib';\n\nconst input = '.................................';\ndeflate(input, (err, buffer) => {\n  if (err) {\n    console.error('An error occurred:', err);\n    process.exitCode = 1;\n  }\n  console.log(buffer.toString('base64'));\n});\n\nconst buffer = Buffer.from('eJzT0yMAAGTvBe8=', 'base64');\nunzip(buffer, (err, buffer) => {\n  if (err) {\n    console.error('An error occurred:', err);\n    process.exitCode = 1;\n  }\n  console.log(buffer.toString());\n});\n\n// Or, Promisified\n\nimport { promisify } from 'node:util';\nconst do_unzip = promisify(unzip);\n\nconst unzippedBuffer = await do_unzip(buffer);\nconsole.log(unzippedBuffer.toString());"},{"language":"cjs","displayName":null,"code":"const { deflate, unzip } = require('node:zlib');\n\nconst input = '.................................';\ndeflate(input, (err, buffer) => {\n  if (err) {\n    console.error('An error occurred:', err);\n    process.exitCode = 1;\n  }\n  console.log(buffer.toString('base64'));\n});\n\nconst buffer = Buffer.from('eJzT0yMAAGTvBe8=', 'base64');\nunzip(buffer, (err, buffer) => {\n  if (err) {\n    console.error('An error occurred:', err);\n    process.exitCode = 1;\n  }\n  console.log(buffer.toString());\n});\n\n// Or, Promisified\n\nconst { promisify } = require('node:util');\nconst do_unzip = promisify(unzip);\n\ndo_unzip(buffer)\n  .then((buf) => console.log(buf.toString()))\n  .catch((err) => {\n    console.error('An error occurred:', err);\n    process.exitCode = 1;\n  });"}],"children":[{"kind":"section","id":"threadpool-usage-and-performance-considerations","name":"Threadpool usage and performance considerations","title":"Threadpool usage and performance considerations","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"All `zlib` APIs, except those that are explicitly synchronous, use the Node.js\ninternal threadpool. This can lead to surprising effects and performance\nlimitations in some applications.\n\nCreating and using a large number of zlib objects simultaneously can cause\nsignificant memory fragmentation.\n\n```mjs\nimport zlib from 'node:zlib';\nimport { Buffer } from 'node:buffer';\n\nconst payload = Buffer.from('This is some data');\n\n// WARNING: DO NOT DO THIS!\nfor (let i = 0; i < 30000; ++i) {\n  zlib.deflate(payload, (err, buffer) => {});\n}\n```\n\n```cjs\nconst zlib = require('node:zlib');\n\nconst payload = Buffer.from('This is some data');\n\n// WARNING: DO NOT DO THIS!\nfor (let i = 0; i < 30000; ++i) {\n  zlib.deflate(payload, (err, buffer) => {});\n}\n```\n\nIn the preceding example, 30,000 deflate instances are created concurrently.\nBecause of how some operating systems handle memory allocation and\ndeallocation, this may lead to significant memory fragmentation.\n\nIt is strongly recommended that the results of compression\noperations be cached to avoid duplication of effort.","summary":"All `zlib` APIs, except those that are explicitly synchronous, use the Node.js internal threadpool. This can lead to surprising effects and performance limitations in some applications.","examples":[{"language":"mjs","displayName":null,"code":"import zlib from 'node:zlib';\nimport { Buffer } from 'node:buffer';\n\nconst payload = Buffer.from('This is some data');\n\n// WARNING: DO NOT DO THIS!\nfor (let i = 0; i < 30000; ++i) {\n  zlib.deflate(payload, (err, buffer) => {});\n}"},{"language":"cjs","displayName":null,"code":"const zlib = require('node:zlib');\n\nconst payload = Buffer.from('This is some data');\n\n// WARNING: DO NOT DO THIS!\nfor (let i = 0; i < 30000; ++i) {\n  zlib.deflate(payload, (err, buffer) => {});\n}"}],"children":[]},{"kind":"section","id":"compressing-http-requests-and-responses","name":"Compressing HTTP requests and responses","title":"Compressing HTTP requests and responses","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"The `node:zlib` module can be used to implement support for the `gzip`, `deflate`,\n`br`, and `zstd` content-encoding mechanisms defined by\n[HTTP](https://tools.ietf.org/html/rfc7230#section-4.2).\n\nThe HTTP [`Accept-Encoding`](https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.3) header is used within an HTTP request to identify\nthe compression encodings accepted by the client. The [`Content-Encoding`](https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.11)\nheader is used to identify the compression encodings actually applied to a\nmessage.\n\nThe examples given below are drastically simplified to show the basic concept.\nUsing `zlib` encoding can be expensive, and the results ought to be cached.\nSee [Memory usage tuning](#memory-usage-tuning) for more information on the speed/memory/compression\ntradeoffs involved in `zlib` usage.\n\n```mjs\n// Client request example\nimport fs from 'node:fs';\nimport zlib from 'node:zlib';\nimport http from 'node:http';\nimport process from 'node:process';\nimport { pipeline } from 'node:stream';\n\nconst request = http.get({ host: 'example.com',\n                           path: '/',\n                           port: 80,\n                           headers: { 'Accept-Encoding': 'br,gzip,deflate,zstd' } });\nrequest.on('response', (response) => {\n  const output = fs.createWriteStream('example.com_index.html');\n\n  const onError = (err) => {\n    if (err) {\n      console.error('An error occurred:', err);\n      process.exitCode = 1;\n    }\n  };\n\n  switch (response.headers['content-encoding']) {\n    case 'br':\n      pipeline(response, zlib.createBrotliDecompress(), output, onError);\n      break;\n    // Or, just use zlib.createUnzip() to handle both of the following cases:\n    case 'gzip':\n      pipeline(response, zlib.createGunzip(), output, onError);\n      break;\n    case 'deflate':\n      pipeline(response, zlib.createInflate(), output, onError);\n      break;\n    case 'zstd':\n      pipeline(response, zlib.createZstdDecompress(), output, onError);\n      break;\n    default:\n      pipeline(response, output, onError);\n      break;\n  }\n});\n```\n\n```cjs\n// Client request example\nconst zlib = require('node:zlib');\nconst http = require('node:http');\nconst fs = require('node:fs');\nconst { pipeline } = require('node:stream');\n\nconst request = http.get({ host: 'example.com',\n                           path: '/',\n                           port: 80,\n                           headers: { 'Accept-Encoding': 'br,gzip,deflate,zstd' } });\nrequest.on('response', (response) => {\n  const output = fs.createWriteStream('example.com_index.html');\n\n  const onError = (err) => {\n    if (err) {\n      console.error('An error occurred:', err);\n      process.exitCode = 1;\n    }\n  };\n\n  switch (response.headers['content-encoding']) {\n    case 'br':\n      pipeline(response, zlib.createBrotliDecompress(), output, onError);\n      break;\n    // Or, just use zlib.createUnzip() to handle both of the following cases:\n    case 'gzip':\n      pipeline(response, zlib.createGunzip(), output, onError);\n      break;\n    case 'deflate':\n      pipeline(response, zlib.createInflate(), output, onError);\n      break;\n    case 'zstd':\n      pipeline(response, zlib.createZstdDecompress(), output, onError);\n      break;\n    default:\n      pipeline(response, output, onError);\n      break;\n  }\n});\n```\n\n```mjs\n// 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.\nimport zlib from 'node:zlib';\nimport http from 'node:http';\nimport fs from 'node:fs';\nimport { pipeline } from 'node:stream';\n\nhttp.createServer((request, response) => {\n  const raw = fs.createReadStream('index.html');\n  // Store both a compressed and an uncompressed version of the resource.\n  response.setHeader('Vary', 'Accept-Encoding');\n  const acceptEncoding = request.headers['accept-encoding'] || '';\n\n  const onError = (err) => {\n    if (err) {\n      // If an error occurs, there's not much we can do because\n      // the server has already sent the 200 response code and\n      // some amount of data has already been sent to the client.\n      // The best we can do is terminate the response immediately\n      // and log the error.\n      response.end();\n      console.error('An error occurred:', err);\n    }\n  };\n\n  // Note: This is not a conformant accept-encoding parser.\n  // See https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.3\n  if (/\\bdeflate\\b/.test(acceptEncoding)) {\n    response.writeHead(200, { 'Content-Encoding': 'deflate' });\n    pipeline(raw, zlib.createDeflate(), response, onError);\n  } else if (/\\bgzip\\b/.test(acceptEncoding)) {\n    response.writeHead(200, { 'Content-Encoding': 'gzip' });\n    pipeline(raw, zlib.createGzip(), response, onError);\n  } else if (/\\bbr\\b/.test(acceptEncoding)) {\n    response.writeHead(200, { 'Content-Encoding': 'br' });\n    pipeline(raw, zlib.createBrotliCompress(), response, onError);\n  } else if (/\\bzstd\\b/.test(acceptEncoding)) {\n    response.writeHead(200, { 'Content-Encoding': 'zstd' });\n    pipeline(raw, zlib.createZstdCompress(), response, onError);\n  } else {\n    response.writeHead(200, {});\n    pipeline(raw, response, onError);\n  }\n}).listen(1337);\n```\n\n```cjs\n// 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('node:zlib');\nconst http = require('node:http');\nconst fs = require('node:fs');\nconst { pipeline } = require('node:stream');\n\nhttp.createServer((request, response) => {\n  const raw = fs.createReadStream('index.html');\n  // Store both a compressed and an uncompressed version of the resource.\n  response.setHeader('Vary', 'Accept-Encoding');\n  const acceptEncoding = request.headers['accept-encoding'] || '';\n\n  const onError = (err) => {\n    if (err) {\n      // If an error occurs, there's not much we can do because\n      // the server has already sent the 200 response code and\n      // some amount of data has already been sent to the client.\n      // The best we can do is terminate the response immediately\n      // and log the error.\n      response.end();\n      console.error('An error occurred:', err);\n    }\n  };\n\n  // Note: This is not a conformant accept-encoding parser.\n  // See https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.3\n  if (/\\bdeflate\\b/.test(acceptEncoding)) {\n    response.writeHead(200, { 'Content-Encoding': 'deflate' });\n    pipeline(raw, zlib.createDeflate(), response, onError);\n  } else if (/\\bgzip\\b/.test(acceptEncoding)) {\n    response.writeHead(200, { 'Content-Encoding': 'gzip' });\n    pipeline(raw, zlib.createGzip(), response, onError);\n  } else if (/\\bbr\\b/.test(acceptEncoding)) {\n    response.writeHead(200, { 'Content-Encoding': 'br' });\n    pipeline(raw, zlib.createBrotliCompress(), response, onError);\n  } else if (/\\bzstd\\b/.test(acceptEncoding)) {\n    response.writeHead(200, { 'Content-Encoding': 'zstd' });\n    pipeline(raw, zlib.createZstdCompress(), response, onError);\n  } else {\n    response.writeHead(200, {});\n    pipeline(raw, response, onError);\n  }\n}).listen(1337);\n```\n\nBy default, the `zlib` 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 decompress the last chunk of input data:\n\n```js\n// This is a truncated version of the buffer from the above examples\nconst buffer = Buffer.from('eJzT0yMA', 'base64');\n\nzlib.unzip(\n  buffer,\n  // For Brotli, the equivalent is zlib.constants.BROTLI_OPERATION_FLUSH.\n  // For Zstd, the equivalent is zlib.constants.ZSTD_e_flush.\n  { finishFlush: zlib.constants.Z_SYNC_FLUSH },\n  (err, buffer) => {\n    if (err) {\n      console.error('An error occurred:', err);\n      process.exitCode = 1;\n    }\n    console.log(buffer.toString());\n  });\n```\n\nThis 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.","summary":"The `node:zlib` module can be used to implement support for the `gzip`, `deflate`, `br`, and `zstd` content-encoding mechanisms defined by HTTP.","examples":[{"language":"mjs","displayName":null,"code":"// Client request example\nimport fs from 'node:fs';\nimport zlib from 'node:zlib';\nimport http from 'node:http';\nimport process from 'node:process';\nimport { pipeline } from 'node:stream';\n\nconst request = http.get({ host: 'example.com',\n                           path: '/',\n                           port: 80,\n                           headers: { 'Accept-Encoding': 'br,gzip,deflate,zstd' } });\nrequest.on('response', (response) => {\n  const output = fs.createWriteStream('example.com_index.html');\n\n  const onError = (err) => {\n    if (err) {\n      console.error('An error occurred:', err);\n      process.exitCode = 1;\n    }\n  };\n\n  switch (response.headers['content-encoding']) {\n    case 'br':\n      pipeline(response, zlib.createBrotliDecompress(), output, onError);\n      break;\n    // Or, just use zlib.createUnzip() to handle both of the following cases:\n    case 'gzip':\n      pipeline(response, zlib.createGunzip(), output, onError);\n      break;\n    case 'deflate':\n      pipeline(response, zlib.createInflate(), output, onError);\n      break;\n    case 'zstd':\n      pipeline(response, zlib.createZstdDecompress(), output, onError);\n      break;\n    default:\n      pipeline(response, output, onError);\n      break;\n  }\n});"},{"language":"cjs","displayName":null,"code":"// Client request example\nconst zlib = require('node:zlib');\nconst http = require('node:http');\nconst fs = require('node:fs');\nconst { pipeline } = require('node:stream');\n\nconst request = http.get({ host: 'example.com',\n                           path: '/',\n                           port: 80,\n                           headers: { 'Accept-Encoding': 'br,gzip,deflate,zstd' } });\nrequest.on('response', (response) => {\n  const output = fs.createWriteStream('example.com_index.html');\n\n  const onError = (err) => {\n    if (err) {\n      console.error('An error occurred:', err);\n      process.exitCode = 1;\n    }\n  };\n\n  switch (response.headers['content-encoding']) {\n    case 'br':\n      pipeline(response, zlib.createBrotliDecompress(), output, onError);\n      break;\n    // Or, just use zlib.createUnzip() to handle both of the following cases:\n    case 'gzip':\n      pipeline(response, zlib.createGunzip(), output, onError);\n      break;\n    case 'deflate':\n      pipeline(response, zlib.createInflate(), output, onError);\n      break;\n    case 'zstd':\n      pipeline(response, zlib.createZstdDecompress(), output, onError);\n      break;\n    default:\n      pipeline(response, output, onError);\n      break;\n  }\n});"},{"language":"mjs","displayName":null,"code":"// 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.\nimport zlib from 'node:zlib';\nimport http from 'node:http';\nimport fs from 'node:fs';\nimport { pipeline } from 'node:stream';\n\nhttp.createServer((request, response) => {\n  const raw = fs.createReadStream('index.html');\n  // Store both a compressed and an uncompressed version of the resource.\n  response.setHeader('Vary', 'Accept-Encoding');\n  const acceptEncoding = request.headers['accept-encoding'] || '';\n\n  const onError = (err) => {\n    if (err) {\n      // If an error occurs, there's not much we can do because\n      // the server has already sent the 200 response code and\n      // some amount of data has already been sent to the client.\n      // The best we can do is terminate the response immediately\n      // and log the error.\n      response.end();\n      console.error('An error occurred:', err);\n    }\n  };\n\n  // Note: This is not a conformant accept-encoding parser.\n  // See https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.3\n  if (/\\bdeflate\\b/.test(acceptEncoding)) {\n    response.writeHead(200, { 'Content-Encoding': 'deflate' });\n    pipeline(raw, zlib.createDeflate(), response, onError);\n  } else if (/\\bgzip\\b/.test(acceptEncoding)) {\n    response.writeHead(200, { 'Content-Encoding': 'gzip' });\n    pipeline(raw, zlib.createGzip(), response, onError);\n  } else if (/\\bbr\\b/.test(acceptEncoding)) {\n    response.writeHead(200, { 'Content-Encoding': 'br' });\n    pipeline(raw, zlib.createBrotliCompress(), response, onError);\n  } else if (/\\bzstd\\b/.test(acceptEncoding)) {\n    response.writeHead(200, { 'Content-Encoding': 'zstd' });\n    pipeline(raw, zlib.createZstdCompress(), response, onError);\n  } else {\n    response.writeHead(200, {});\n    pipeline(raw, response, onError);\n  }\n}).listen(1337);"},{"language":"cjs","displayName":null,"code":"// 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('node:zlib');\nconst http = require('node:http');\nconst fs = require('node:fs');\nconst { pipeline } = require('node:stream');\n\nhttp.createServer((request, response) => {\n  const raw = fs.createReadStream('index.html');\n  // Store both a compressed and an uncompressed version of the resource.\n  response.setHeader('Vary', 'Accept-Encoding');\n  const acceptEncoding = request.headers['accept-encoding'] || '';\n\n  const onError = (err) => {\n    if (err) {\n      // If an error occurs, there's not much we can do because\n      // the server has already sent the 200 response code and\n      // some amount of data has already been sent to the client.\n      // The best we can do is terminate the response immediately\n      // and log the error.\n      response.end();\n      console.error('An error occurred:', err);\n    }\n  };\n\n  // Note: This is not a conformant accept-encoding parser.\n  // See https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.3\n  if (/\\bdeflate\\b/.test(acceptEncoding)) {\n    response.writeHead(200, { 'Content-Encoding': 'deflate' });\n    pipeline(raw, zlib.createDeflate(), response, onError);\n  } else if (/\\bgzip\\b/.test(acceptEncoding)) {\n    response.writeHead(200, { 'Content-Encoding': 'gzip' });\n    pipeline(raw, zlib.createGzip(), response, onError);\n  } else if (/\\bbr\\b/.test(acceptEncoding)) {\n    response.writeHead(200, { 'Content-Encoding': 'br' });\n    pipeline(raw, zlib.createBrotliCompress(), response, onError);\n  } else if (/\\bzstd\\b/.test(acceptEncoding)) {\n    response.writeHead(200, { 'Content-Encoding': 'zstd' });\n    pipeline(raw, zlib.createZstdCompress(), response, onError);\n  } else {\n    response.writeHead(200, {});\n    pipeline(raw, response, onError);\n  }\n}).listen(1337);"},{"language":"js","displayName":null,"code":"// This is a truncated version of the buffer from the above examples\nconst buffer = Buffer.from('eJzT0yMA', 'base64');\n\nzlib.unzip(\n  buffer,\n  // For Brotli, the equivalent is zlib.constants.BROTLI_OPERATION_FLUSH.\n  // For Zstd, the equivalent is zlib.constants.ZSTD_e_flush.\n  { finishFlush: zlib.constants.Z_SYNC_FLUSH },\n  (err, buffer) => {\n    if (err) {\n      console.error('An error occurred:', err);\n      process.exitCode = 1;\n    }\n    console.log(buffer.toString());\n  });"}],"children":[]},{"kind":"section","id":"memory-usage-tuning","name":"Memory usage tuning","title":"Memory usage tuning","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"","summary":"","examples":[],"children":[{"kind":"section","id":"for-zlib-based-streams","name":"For zlib-based streams","title":"For zlib-based streams","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"From `zlib/zconf.h`, modified for Node.js usage:\n\nThe memory requirements for deflate are (in bytes):\n\n```js\n(1 << (windowBits + 2)) + (1 << (memLevel + 9));\n```\n\nThat is: 128K for `windowBits` = 15 + 128K for `memLevel` = 8\n(default values) plus a few kilobytes for small objects.\n\nFor example, to reduce the default memory requirements from 256K to 128K, the\noptions should be set to:\n\n```js\nconst options = { windowBits: 14, memLevel: 7 };\n```\n\nThis will, however, generally degrade compression.\n\nThe memory requirements for inflate are (in bytes) `1 << windowBits`.\nThat is, 32K for `windowBits` = 15 (default value) plus a few kilobytes\nfor small objects.\n\nThis is in addition to a single internal output slab buffer of size\n`chunkSize`, which defaults to 16K.\n\nThe speed of `zlib` compression is affected most dramatically by the\n`level` 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.\n\nIn general, greater memory usage options will mean that Node.js has to make\nfewer calls to `zlib` because it will be able to process more data on\neach `write` operation. So, this is another factor that affects the\nspeed, at the cost of memory usage.","summary":"From `zlib/zconf.h`, modified for Node.js usage:","examples":[{"language":"js","displayName":null,"code":"(1 << (windowBits + 2)) + (1 << (memLevel + 9));"},{"language":"js","displayName":null,"code":"const options = { windowBits: 14, memLevel: 7 };"}],"children":[]},{"kind":"section","id":"for-brotli-based-streams","name":"For Brotli-based streams","title":"For Brotli-based streams","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"There are equivalents to the zlib options for Brotli-based streams, although\nthese options have different ranges than the zlib ones:\n\n* zlib's `level` option matches Brotli's `BROTLI_PARAM_QUALITY` option.\n* zlib's `windowBits` option matches Brotli's `BROTLI_PARAM_LGWIN` option.\n\nSee [below](#brotli-constants) for more details on Brotli-specific options.","summary":"There are equivalents to the zlib options for Brotli-based streams, although these options have different ranges than the zlib ones:","examples":[],"children":[]},{"kind":"section","id":"for-zstd-based-streams","name":"For Zstd-based streams","title":"For Zstd-based streams","scope":"module","overloadOf":null,"stability":{"index":"1","description":"Experimental"},"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"There are equivalents to the zlib options for Zstd-based streams, although\nthese options have different ranges than the zlib ones:\n\n* zlib's `level` option matches Zstd's `ZSTD_c_compressionLevel` option.\n* zlib's `windowBits` option matches Zstd's `ZSTD_c_windowLog` option.\n\nSee [below](#zstd-constants) for more details on Zstd-specific options.","summary":"There are equivalents to the zlib options for Zstd-based streams, although these options have different ranges than the zlib ones:","examples":[],"children":[]}]},{"kind":"section","id":"flushing","name":"Flushing","title":"Flushing","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"Calling [`.flush()`](#zlibflushkind-callback) on a compression stream will make `zlib` 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.\n\nIn the following example, `flush()` is used to write a compressed partial\nHTTP response to the client:\n\n```mjs\nimport zlib from 'node:zlib';\nimport http from 'node:http';\nimport { pipeline } from 'node:stream';\n\nhttp.createServer((request, response) => {\n  // For the sake of simplicity, the Accept-Encoding checks are omitted.\n  response.writeHead(200, { 'content-encoding': 'gzip' });\n  const output = zlib.createGzip();\n  let i;\n\n  pipeline(output, response, (err) => {\n    if (err) {\n      // If an error occurs, there's not much we can do because\n      // the server has already sent the 200 response code and\n      // some amount of data has already been sent to the client.\n      // The best we can do is terminate the response immediately\n      // and log the error.\n      clearInterval(i);\n      response.end();\n      console.error('An error occurred:', err);\n    }\n  });\n\n  i = setInterval(() => {\n    output.write(`The current time is ${Date()}\\n`, () => {\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```\n\n```cjs\nconst zlib = require('node:zlib');\nconst http = require('node:http');\nconst { pipeline } = require('node:stream');\n\nhttp.createServer((request, response) => {\n  // For the sake of simplicity, the Accept-Encoding checks are omitted.\n  response.writeHead(200, { 'content-encoding': 'gzip' });\n  const output = zlib.createGzip();\n  let i;\n\n  pipeline(output, response, (err) => {\n    if (err) {\n      // If an error occurs, there's not much we can do because\n      // the server has already sent the 200 response code and\n      // some amount of data has already been sent to the client.\n      // The best we can do is terminate the response immediately\n      // and log the error.\n      clearInterval(i);\n      response.end();\n      console.error('An error occurred:', err);\n    }\n  });\n\n  i = setInterval(() => {\n    output.write(`The current time is ${Date()}\\n`, () => {\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```","summary":"Calling `.flush()` on a compression stream will make `zlib` return as much output as currently possible. This may come at the cost of degraded compression quality, but can be useful when data needs to be available as soon as possible.","examples":[{"language":"mjs","displayName":null,"code":"import zlib from 'node:zlib';\nimport http from 'node:http';\nimport { pipeline } from 'node:stream';\n\nhttp.createServer((request, response) => {\n  // For the sake of simplicity, the Accept-Encoding checks are omitted.\n  response.writeHead(200, { 'content-encoding': 'gzip' });\n  const output = zlib.createGzip();\n  let i;\n\n  pipeline(output, response, (err) => {\n    if (err) {\n      // If an error occurs, there's not much we can do because\n      // the server has already sent the 200 response code and\n      // some amount of data has already been sent to the client.\n      // The best we can do is terminate the response immediately\n      // and log the error.\n      clearInterval(i);\n      response.end();\n      console.error('An error occurred:', err);\n    }\n  });\n\n  i = setInterval(() => {\n    output.write(`The current time is ${Date()}\\n`, () => {\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);"},{"language":"cjs","displayName":null,"code":"const zlib = require('node:zlib');\nconst http = require('node:http');\nconst { pipeline } = require('node:stream');\n\nhttp.createServer((request, response) => {\n  // For the sake of simplicity, the Accept-Encoding checks are omitted.\n  response.writeHead(200, { 'content-encoding': 'gzip' });\n  const output = zlib.createGzip();\n  let i;\n\n  pipeline(output, response, (err) => {\n    if (err) {\n      // If an error occurs, there's not much we can do because\n      // the server has already sent the 200 response code and\n      // some amount of data has already been sent to the client.\n      // The best we can do is terminate the response immediately\n      // and log the error.\n      clearInterval(i);\n      response.end();\n      console.error('An error occurred:', err);\n    }\n  });\n\n  i = setInterval(() => {\n    output.write(`The current time is ${Date()}\\n`, () => {\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);"}],"children":[]},{"kind":"section","id":"constants","name":"Constants","title":"Constants","scope":"module","overloadOf":null,"stability":null,"added":["v0.5.8"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"","summary":"","examples":[],"children":[{"kind":"section","id":"zlib-constants","name":"zlib constants","title":"zlib constants","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"All of the constants defined in `zlib.h` are also defined on\n`require('node:zlib').constants`. In the normal course of operations, it will\nnot be necessary to use these constants. They are documented so that their\npresence is not surprising. This section is taken almost directly from the\n[zlib documentation](https://zlib.net/manual.html#Constants).\n\nPreviously, the constants were available directly from `require('node:zlib')`,\nfor instance `zlib.Z_NO_FLUSH`. Accessing the constants directly from the module\nis currently still possible but is deprecated.\n\nAllowed flush values.\n\n* `zlib.constants.Z_NO_FLUSH`\n* `zlib.constants.Z_PARTIAL_FLUSH`\n* `zlib.constants.Z_SYNC_FLUSH`\n* `zlib.constants.Z_FULL_FLUSH`\n* `zlib.constants.Z_FINISH`\n* `zlib.constants.Z_BLOCK`\n\nReturn codes for the compression/decompression functions. Negative\nvalues are errors, positive values are used for special but normal\nevents.\n\n* `zlib.constants.Z_OK`\n* `zlib.constants.Z_STREAM_END`\n* `zlib.constants.Z_NEED_DICT`\n* `zlib.constants.Z_ERRNO`\n* `zlib.constants.Z_STREAM_ERROR`\n* `zlib.constants.Z_DATA_ERROR`\n* `zlib.constants.Z_MEM_ERROR`\n* `zlib.constants.Z_BUF_ERROR`\n* `zlib.constants.Z_VERSION_ERROR`\n\nCompression levels.\n\n* `zlib.constants.Z_NO_COMPRESSION`\n* `zlib.constants.Z_BEST_SPEED`\n* `zlib.constants.Z_BEST_COMPRESSION`\n* `zlib.constants.Z_DEFAULT_COMPRESSION`\n\nCompression strategy.\n\n* `zlib.constants.Z_FILTERED`\n* `zlib.constants.Z_HUFFMAN_ONLY`\n* `zlib.constants.Z_RLE`\n* `zlib.constants.Z_FIXED`\n* `zlib.constants.Z_DEFAULT_STRATEGY`","summary":"All of the constants defined in `zlib.h` are also defined on `require('node:zlib').constants`. In the normal course of operations, it will not be necessary to use these constants. They are documented so that their presence is not surprising. This section is taken almost directly from the zlib documentation.","examples":[],"children":[]},{"kind":"section","id":"brotli-constants","name":"Brotli constants","title":"Brotli constants","scope":"module","overloadOf":null,"stability":null,"added":["v11.7.0","v10.16.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"There are several options and other constants available for Brotli-based\nstreams:","summary":"There are several options and other constants available for Brotli-based streams:","examples":[],"children":[{"kind":"section","id":"flush-operations","name":"Flush operations","title":"Flush operations","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"The following values are valid flush operations for Brotli-based streams:\n\n* `zlib.constants.BROTLI_OPERATION_PROCESS` (default for all operations)\n* `zlib.constants.BROTLI_OPERATION_FLUSH` (default when calling `.flush()`)\n* `zlib.constants.BROTLI_OPERATION_FINISH` (default for the last chunk)\n* `zlib.constants.BROTLI_OPERATION_EMIT_METADATA`\n  * This particular operation may be hard to use in a Node.js context,\n    as the streaming layer makes it hard to know which data will end up\n    in this frame. Also, there is currently no way to consume this data through\n    the Node.js API.","summary":"The following values are valid flush operations for Brotli-based streams:","examples":[],"children":[]},{"kind":"section","id":"compressor-options","name":"Compressor options","title":"Compressor options","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"There are several options that can be set on Brotli encoders, affecting\ncompression efficiency and speed. Both the keys and the values can be accessed\nas properties of the `zlib.constants` object.\n\nThe most important options are:\n\n* `BROTLI_PARAM_MODE`\n  * `BROTLI_MODE_GENERIC` (default)\n  * `BROTLI_MODE_TEXT`, adjusted for UTF-8 text\n  * `BROTLI_MODE_FONT`, adjusted for WOFF 2.0 fonts\n* `BROTLI_PARAM_QUALITY`\n  * Ranges from `BROTLI_MIN_QUALITY` to `BROTLI_MAX_QUALITY`,\n    with a default of `BROTLI_DEFAULT_QUALITY`.\n* `BROTLI_PARAM_SIZE_HINT`\n  * Integer value representing the expected input size;\n    defaults to `0` for an unknown input size.\n\nThe following flags can be set for advanced control over the compression\nalgorithm and memory usage tuning:\n\n* `BROTLI_PARAM_LGWIN`\n  * Ranges from `BROTLI_MIN_WINDOW_BITS` to `BROTLI_MAX_WINDOW_BITS`,\n    with a default of `BROTLI_DEFAULT_WINDOW`, or up to\n    `BROTLI_LARGE_MAX_WINDOW_BITS` if the `BROTLI_PARAM_LARGE_WINDOW` flag\n    is set.\n* `BROTLI_PARAM_LGBLOCK`\n  * Ranges from `BROTLI_MIN_INPUT_BLOCK_BITS` to `BROTLI_MAX_INPUT_BLOCK_BITS`.\n* `BROTLI_PARAM_DISABLE_LITERAL_CONTEXT_MODELING`\n  * Boolean flag that decreases compression ratio in favour of\n    decompression speed.\n* `BROTLI_PARAM_LARGE_WINDOW`\n  * Boolean flag enabling “Large Window Brotli” mode (not compatible with the\n    Brotli format as standardized in [RFC 7932](https://www.rfc-editor.org/rfc/rfc7932.html)).\n* `BROTLI_PARAM_NPOSTFIX`\n  * Ranges from `0` to `BROTLI_MAX_NPOSTFIX`.\n* `BROTLI_PARAM_NDIRECT`\n  * Ranges from `0` to `15 << NPOSTFIX` in steps of `1 << NPOSTFIX`.","summary":"There are several options that can be set on Brotli encoders, affecting compression efficiency and speed. Both the keys and the values can be accessed as properties of the `zlib.constants` object.","examples":[],"children":[]},{"kind":"section","id":"decompressor-options","name":"Decompressor options","title":"Decompressor options","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"These advanced options are available for controlling decompression:\n\n* `BROTLI_DECODER_PARAM_DISABLE_RING_BUFFER_REALLOCATION`\n  * Boolean flag that affects internal memory allocation patterns.\n* `BROTLI_DECODER_PARAM_LARGE_WINDOW`\n  * Boolean flag enabling “Large Window Brotli” mode (not compatible with the\n    Brotli format as standardized in [RFC 7932](https://www.rfc-editor.org/rfc/rfc7932.html)).","summary":"These advanced options are available for controlling decompression:","examples":[],"children":[]}]},{"kind":"section","id":"zstd-constants","name":"Zstd constants","title":"Zstd constants","scope":"module","overloadOf":null,"stability":{"index":"1","description":"Experimental"},"added":["v23.8.0","v22.15.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"There are several options and other constants available for Zstd-based\nstreams:","summary":"There are several options and other constants available for Zstd-based streams:","examples":[],"children":[{"kind":"section","id":"flush-operations-1","name":"Flush operations","title":"Flush operations","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"The following values are valid flush operations for Zstd-based streams:\n\n* `zlib.constants.ZSTD_e_continue` (default for all operations)\n* `zlib.constants.ZSTD_e_flush` (default when calling `.flush()`)\n* `zlib.constants.ZSTD_e_end` (default for the last chunk)","summary":"The following values are valid flush operations for Zstd-based streams:","examples":[],"children":[]},{"kind":"section","id":"compressor-options-1","name":"Compressor options","title":"Compressor options","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"There are several options that can be set on Zstd encoders, affecting\ncompression efficiency and speed. Both the keys and the values can be accessed\nas properties of the `zlib.constants` object.\n\nThe most important options are:\n\n* `ZSTD_c_compressionLevel`\n  * Set compression parameters according to pre-defined cLevel table. Default\n    level is ZSTD\\_CLEVEL\\_DEFAULT==3.\n* `ZSTD_c_strategy`\n  * Select the compression strategy.\n  * Possible values are listed in the strategy options section below.","summary":"There are several options that can be set on Zstd encoders, affecting compression efficiency and speed. Both the keys and the values can be accessed as properties of the `zlib.constants` object.","examples":[],"children":[]},{"kind":"section","id":"strategy-options","name":"Strategy options","title":"Strategy options","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"The following constants can be used as values for the `ZSTD_c_strategy`\nparameter:\n\n* `zlib.constants.ZSTD_fast`\n* `zlib.constants.ZSTD_dfast`\n* `zlib.constants.ZSTD_greedy`\n* `zlib.constants.ZSTD_lazy`\n* `zlib.constants.ZSTD_lazy2`\n* `zlib.constants.ZSTD_btlazy2`\n* `zlib.constants.ZSTD_btopt`\n* `zlib.constants.ZSTD_btultra`\n* `zlib.constants.ZSTD_btultra2`\n\nExample:\n\n```js\nconst stream = zlib.createZstdCompress({\n  params: {\n    [zlib.constants.ZSTD_c_strategy]: zlib.constants.ZSTD_btultra,\n  },\n});\n```","summary":"The following constants can be used as values for the `ZSTD_c_strategy` parameter:","examples":[{"language":"js","displayName":null,"code":"const stream = zlib.createZstdCompress({\n  params: {\n    [zlib.constants.ZSTD_c_strategy]: zlib.constants.ZSTD_btultra,\n  },\n});"}],"children":[]},{"kind":"section","id":"pledged-source-size","name":"Pledged Source Size","title":"Pledged Source Size","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"It's possible to specify the expected total size of the uncompressed input via\n`opts.pledgedSrcSize`, which must be a non-negative safe integer. If the size\ndoesn't match at the end of the input, compression will fail with the code\n`ZSTD_error_srcSize_wrong`.","summary":"It's possible to specify the expected total size of the uncompressed input via `opts.pledgedSrcSize`, which must be a non-negative safe integer. If the size doesn't match at the end of the input, compression will fail with the code `ZSTD_error_srcSize_wrong`.","examples":[],"children":[]},{"kind":"section","id":"decompressor-options-1","name":"Decompressor options","title":"Decompressor options","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"These advanced options are available for controlling decompression:\n\n* `ZSTD_d_windowLogMax`\n  * Select a size limit (in power of 2) beyond which the streaming API will\n    refuse to allocate memory buffer in order to protect the host from\n    unreasonable memory requirements.","summary":"These advanced options are available for controlling decompression:","examples":[],"children":[]}]}]},{"kind":"section","id":"class-options","name":"Class: Options","title":"Class: `Options`","scope":"module","overloadOf":null,"stability":null,"added":["v0.11.1"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v26.5.0"],"prUrl":"https://github.com/nodejs/node/pull/64023","commit":null,"description":"The `rejectGarbageAfterEnd` option was added."},{"versions":["v14.5.0","v12.19.0"],"prUrl":"https://github.com/nodejs/node/pull/33516","commit":null,"description":"The `maxOutputLength` option is supported now."},{"versions":["v9.4.0"],"prUrl":"https://github.com/nodejs/node/pull/16042","commit":null,"description":"The `dictionary` option can be an `ArrayBuffer`."},{"versions":["v8.0.0"],"prUrl":"https://github.com/nodejs/node/pull/12001","commit":null,"description":"The `dictionary` option can be an `Uint8Array` now."},{"versions":["v5.11.0"],"prUrl":"https://github.com/nodejs/node/pull/6069","commit":null,"description":"The `finishFlush` option is supported now."}],"description":"Each zlib-based class takes an `options` object. No options are required.\n\nSome options are only relevant when compressing and are\nignored by the decompression classes.\n\n* `flush` {integer} **Default:** `zlib.constants.Z_NO_FLUSH`\n* `finishFlush` {integer} **Default:** `zlib.constants.Z_FINISH`\n* `chunkSize` {integer} **Default:** `16 * 1024`\n* `windowBits` {integer}\n* `level` {integer} (compression only)\n* `memLevel` {integer} (compression only)\n* `strategy` {integer} (compression only)\n* `dictionary` {Buffer | TypedArray | DataView | ArrayBuffer} (deflate/inflate only,\n  empty dictionary by default)\n* `info` {boolean} (If `true`, returns an object with `buffer` and `engine`.)\n* `maxOutputLength` {integer} Limits output size when using\n  [convenience methods](#convenience-methods). **Default:** [`buffer.kMaxLength`](buffer.html#bufferkmaxlength)\n* `rejectGarbageAfterEnd` {boolean} If `true`, decompression fails when\n  trailing input is detected after the end of the compressed stream. This\n  includes unreadable bytes and, when decompressing gzip, additional gzip\n  members following the first member. **Default:** `false`\n\nSee the [`deflateInit2` and `inflateInit2`](https://zlib.net/manual.html#Advanced) documentation for more\ninformation.","summary":"Each zlib-based class takes an `options` object. No options are required.","examples":[],"children":[]},{"kind":"section","id":"class-brotlioptions","name":"Class: BrotliOptions","title":"Class: `BrotliOptions`","scope":"module","overloadOf":null,"stability":null,"added":["v11.7.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v26.5.0"],"prUrl":"https://github.com/nodejs/node/pull/64023","commit":null,"description":"The `rejectGarbageAfterEnd` option was added."},{"versions":["v14.5.0","v12.19.0"],"prUrl":"https://github.com/nodejs/node/pull/33516","commit":null,"description":"The `maxOutputLength` option is supported now."}],"description":"Each Brotli-based class takes an `options` object. All options are optional.\n\n* `flush` {integer} **Default:** `zlib.constants.BROTLI_OPERATION_PROCESS`\n* `finishFlush` {integer} **Default:** `zlib.constants.BROTLI_OPERATION_FINISH`\n* `chunkSize` {integer} **Default:** `16 * 1024`\n* `params` {Object} Key-value object containing indexed [Brotli parameters](#brotli-constants).\n* `maxOutputLength` {integer} Limits output size when using\n  [convenience methods](#convenience-methods). **Default:** [`buffer.kMaxLength`](buffer.html#bufferkmaxlength)\n* `info` {boolean} If `true`, returns an object with `buffer` and `engine`. **Default:** `false`\n* `rejectGarbageAfterEnd` {boolean} If `true`, decompression fails when\n  input remains after the first complete compressed stream. **Default:** `false`\n\nFor example:\n\n```js\nconst stream = zlib.createBrotliCompress({\n  chunkSize: 32 * 1024,\n  params: {\n    [zlib.constants.BROTLI_PARAM_MODE]: zlib.constants.BROTLI_MODE_TEXT,\n    [zlib.constants.BROTLI_PARAM_QUALITY]: 4,\n    [zlib.constants.BROTLI_PARAM_SIZE_HINT]: fs.statSync(inputFile).size,\n  },\n});\n```","summary":"Each Brotli-based class takes an `options` object. All options are optional.","examples":[{"language":"js","displayName":null,"code":"const stream = zlib.createBrotliCompress({\n  chunkSize: 32 * 1024,\n  params: {\n    [zlib.constants.BROTLI_PARAM_MODE]: zlib.constants.BROTLI_MODE_TEXT,\n    [zlib.constants.BROTLI_PARAM_QUALITY]: 4,\n    [zlib.constants.BROTLI_PARAM_SIZE_HINT]: fs.statSync(inputFile).size,\n  },\n});"}],"children":[]},{"kind":"class","id":"class-zlibbrotlicompress","name":"BrotliCompress","title":"Class: `zlib.BrotliCompress`","scope":"module","overloadOf":null,"stability":null,"added":["v11.7.0","v10.16.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"extends":null,"description":"Compress data using the Brotli algorithm.","summary":"Compress data using the Brotli algorithm.","examples":[],"children":[]},{"kind":"class","id":"class-zlibbrotlidecompress","name":"BrotliDecompress","title":"Class: `zlib.BrotliDecompress`","scope":"module","overloadOf":null,"stability":null,"added":["v11.7.0","v10.16.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"extends":null,"description":"Decompress data using the Brotli algorithm.","summary":"Decompress data using the Brotli algorithm.","examples":[],"children":[]},{"kind":"class","id":"class-zlibdeflate","name":"Deflate","title":"Class: `zlib.Deflate`","scope":"module","overloadOf":null,"stability":null,"added":["v0.5.8"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"extends":null,"description":"Compress data using deflate.","summary":"Compress data using deflate.","examples":[],"children":[]},{"kind":"class","id":"class-zlibdeflateraw","name":"DeflateRaw","title":"Class: `zlib.DeflateRaw`","scope":"module","overloadOf":null,"stability":null,"added":["v0.5.8"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"extends":null,"description":"Compress data using deflate, and do not append a `zlib` header.","summary":"Compress data using deflate, and do not append a `zlib` header.","examples":[],"children":[]},{"kind":"class","id":"class-zlibgunzip","name":"Gunzip","title":"Class: `zlib.Gunzip`","scope":"module","overloadOf":null,"stability":null,"added":["v0.5.8"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v6.0.0"],"prUrl":"https://github.com/nodejs/node/pull/5883","commit":null,"description":"Trailing garbage at the end of the input stream will now result in an `'error'` event."},{"versions":["v5.9.0"],"prUrl":"https://github.com/nodejs/node/pull/5120","commit":null,"description":"Multiple concatenated gzip file members are supported now."},{"versions":["v5.0.0"],"prUrl":"https://github.com/nodejs/node/pull/2595","commit":null,"description":"A truncated input stream will now result in an `'error'` event."}],"extends":null,"description":"Decompress a gzip stream.","summary":"Decompress a gzip stream.","examples":[],"children":[]},{"kind":"class","id":"class-zlibgzip","name":"Gzip","title":"Class: `zlib.Gzip`","scope":"module","overloadOf":null,"stability":null,"added":["v0.5.8"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"extends":null,"description":"Compress data using gzip.","summary":"Compress data using gzip.","examples":[],"children":[]},{"kind":"class","id":"class-zlibinflate","name":"Inflate","title":"Class: `zlib.Inflate`","scope":"module","overloadOf":null,"stability":null,"added":["v0.5.8"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v5.0.0"],"prUrl":"https://github.com/nodejs/node/pull/2595","commit":null,"description":"A truncated input stream will now result in an `'error'` event."}],"extends":null,"description":"Decompress a deflate stream.","summary":"Decompress a deflate stream.","examples":[],"children":[]},{"kind":"class","id":"class-zlibinflateraw","name":"InflateRaw","title":"Class: `zlib.InflateRaw`","scope":"module","overloadOf":null,"stability":null,"added":["v0.5.8"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v6.8.0"],"prUrl":"https://github.com/nodejs/node/pull/8512","commit":null,"description":"Custom dictionaries are now supported by `InflateRaw`."},{"versions":["v5.0.0"],"prUrl":"https://github.com/nodejs/node/pull/2595","commit":null,"description":"A truncated input stream will now result in an `'error'` event."}],"extends":null,"description":"Decompress a raw deflate stream.","summary":"Decompress a raw deflate stream.","examples":[],"children":[]},{"kind":"class","id":"class-zlibunzip","name":"Unzip","title":"Class: `zlib.Unzip`","scope":"module","overloadOf":null,"stability":null,"added":["v0.5.8"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"extends":null,"description":"Decompress either a Gzip- or Deflate-compressed stream by auto-detecting\nthe header.","summary":"Decompress either a Gzip- or Deflate-compressed stream by auto-detecting the header.","examples":[],"children":[]},{"kind":"class","id":"class-zlibzipbuffer","name":"ZipBuffer","title":"Class: `zlib.ZipBuffer`","scope":"module","overloadOf":null,"stability":{"index":"1.0","description":"Early development"},"added":["v26.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"extends":null,"description":"The ZIP archive API is experimental. Using any part of it (this class among\nthem) emits an experimental warning the first time; merely importing\n`node:zlib` does not.\n\nAn in-memory, **zero-copy** view over the entries of a ZIP archive already\nheld in a `Buffer`, `TypedArray`, `DataView`, or `ArrayBuffer`. Its set of\nentries can be edited - entries added or removed - but, unlike [`ZipFile`](#class-zlibzipfile),\nthose edits are **not** written into the source buffer: a newly added entry is\nheld as a separate in-memory [`ZipEntry`](#class-zlibzipentry) (the passed buffer is a fixed-size\nview with no room to append to), and removal just drops the entry from\n`ZipBuffer`'s index. The original bytes are never modified.\n[`zipBuffer.toBuffer()`](#zipbuffertobufferoptions) serializes the current set of entries into a fresh\narchive.\n\n`ZipBuffer` does not copy the archive you hand it. It keeps a view onto that\nmemory and reads each entry's content lazily and directly from it, which is\nwhat makes construction cheap regardless of archive size. The trade-off is\nthat you **must not modify or reuse** that memory - including the\n`ArrayBuffer` backing a `TypedArray`/`DataView` - while the `ZipBuffer`, or\nany [`ZipEntry`](#class-zlibzipentry) obtained from it, is still in use: a later read would\nobserve the change and may fail or return corrupt data. Pass a copy (for\nexample `Buffer.from(source)`) if the source might be mutated or reused.\n\n`add()` and `toBuffer()` each have a `*Sync` counterpart\n([`addSync()`](#zipbufferaddsyncfilename-data-options), [`toBufferSync()`](#zipbuffertobuffersyncoptions))\nthat performs the same compression work synchronously. As with the\nsynchronous `node:fs` APIs, these block the Node.js event loop and further\nJavaScript execution until the operation completes; use them only where\nsynchronous execution is appropriate (for example, short-lived scripts or\nstartup code), not in code that must stay responsive.\n\n```mjs\nimport { ZipBuffer } from 'node:zlib';\nimport { readFileSync, writeFileSync } from 'node:fs';\nimport { Buffer } from 'node:buffer';\n\nconst zip = new ZipBuffer(readFileSync('archive.zip'));\nfor (const [name, entry] of zip) {\n  console.log(name, entry.size);\n}\nawait zip.add('hello.txt', Buffer.from('Hello, world!'));\nzip.delete('unwanted.txt');\nwriteFileSync('archive.zip', await zip.toBuffer());\n```\n\n```cjs\nconst { ZipBuffer } = require('node:zlib');\nconst { readFileSync, writeFileSync } = require('node:fs');\n\nasync function main() {\n  const zip = new ZipBuffer(readFileSync('archive.zip'));\n  for (const [name, entry] of zip) {\n    console.log(name, entry.size);\n  }\n  await zip.add('hello.txt', Buffer.from('Hello, world!'));\n  zip.delete('unwanted.txt');\n  writeFileSync('archive.zip', await zip.toBuffer());\n}\nmain();\n```","summary":"The ZIP archive API is experimental. Using any part of it (this class among them) emits an experimental warning the first time; merely importing `node:zlib` does not.","examples":[{"language":"mjs","displayName":null,"code":"import { ZipBuffer } from 'node:zlib';\nimport { readFileSync, writeFileSync } from 'node:fs';\nimport { Buffer } from 'node:buffer';\n\nconst zip = new ZipBuffer(readFileSync('archive.zip'));\nfor (const [name, entry] of zip) {\n  console.log(name, entry.size);\n}\nawait zip.add('hello.txt', Buffer.from('Hello, world!'));\nzip.delete('unwanted.txt');\nwriteFileSync('archive.zip', await zip.toBuffer());"},{"language":"cjs","displayName":null,"code":"const { ZipBuffer } = require('node:zlib');\nconst { readFileSync, writeFileSync } = require('node:fs');\n\nasync function main() {\n  const zip = new ZipBuffer(readFileSync('archive.zip'));\n  for (const [name, entry] of zip) {\n    console.log(name, entry.size);\n  }\n  await zip.add('hello.txt', Buffer.from('Hello, world!'));\n  zip.delete('unwanted.txt');\n  writeFileSync('archive.zip', await zip.toBuffer());\n}\nmain();"}],"children":[{"kind":"constructor","id":"new-zlibzipbufferbuffer","name":"ZipBuffer","title":"`new zlib.ZipBuffer(buffer)`","scope":"module","overloadOf":null,"stability":null,"added":["v26.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"buffer","type":{"text":"Buffer | TypedArray | DataView | ArrayBuffer","links":[{"name":"Buffer","href":"buffer.html#class-buffer","start":0,"end":6},{"name":"TypedArray","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/TypedArray","start":9,"end":19},{"name":"DataView","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/DataView","start":22,"end":30},{"name":"ArrayBuffer","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer","start":33,"end":44}]},"description":"A complete ZIP archive.","default":null,"optional":false,"rest":false,"properties":[]}],"returns":null},"description":"Parses the archive's central directory. Throws an [`ERR_ZIP_INVALID_ARCHIVE`](errors.html#err_zip_invalid_archive)\nor [`ERR_ZIP_UNSUPPORTED_FEATURE`](errors.html#err_zip_unsupported_feature) error if `buffer` is not a well-formed,\nsupported archive.\n\n`buffer` is **not copied**: the `ZipBuffer` retains a zero-copy view of it (for\na `TypedArray`, `DataView`, or `ArrayBuffer`, of the underlying `ArrayBuffer`)\nand reads entry content directly from it on demand. Do not mutate or reuse that\nmemory while the `ZipBuffer` or any entry read from it is still live; pass a\ncopy if it might change.","summary":"Parses the archive's central directory. Throws an `ERR_ZIP_INVALID_ARCHIVE` or `ERR_ZIP_UNSUPPORTED_FEATURE` error if `buffer` is not a well-formed, supported archive.","examples":[],"children":[]},{"kind":"method","id":"zipbufferaddfilename-data-options","name":"add","title":"`zipBuffer.add(filename, data[, options])`","scope":"module","overloadOf":null,"stability":null,"added":["v26.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"filename","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"The entry's name within the archive. A trailing `/`\nmarks a directory entry.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"data","type":{"text":"Buffer | TypedArray | DataView | ArrayBuffer","links":[{"name":"Buffer","href":"buffer.html#class-buffer","start":0,"end":6},{"name":"TypedArray","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/TypedArray","start":9,"end":19},{"name":"DataView","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/DataView","start":22,"end":30},{"name":"ArrayBuffer","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer","start":33,"end":44}]},"description":"The entry's complete,\nuncompressed content.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"options","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"See [`zlib.ZipEntry.create()`](#static-method-zlibzipentrycreatefilename-data-options).","default":null,"optional":true,"rest":false,"properties":[]}],"returns":{"type":{"text":"Promise","links":[{"name":"Promise","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise","start":0,"end":7}]},"description":"Fulfilled with the created {ZipEntry}."}},"description":"Equivalent to `zipBuffer.addEntry(await zlib.ZipEntry.create(filename, data,\noptions))`.","summary":"Equivalent to `zipBuffer.addEntry(await zlib.ZipEntry.create(filename, data,options))`.","examples":[],"children":[]},{"kind":"method","id":"zipbufferaddsyncfilename-data-options","name":"addSync","title":"`zipBuffer.addSync(filename, data[, options])`","scope":"module","overloadOf":null,"stability":null,"added":["v26.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"filename","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"The entry's name within the archive. A trailing `/`\nmarks a directory entry.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"data","type":{"text":"Buffer | TypedArray | DataView | ArrayBuffer","links":[{"name":"Buffer","href":"buffer.html#class-buffer","start":0,"end":6},{"name":"TypedArray","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/TypedArray","start":9,"end":19},{"name":"DataView","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/DataView","start":22,"end":30},{"name":"ArrayBuffer","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer","start":33,"end":44}]},"description":"The entry's complete,\nuncompressed content.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"options","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"See [`zlib.ZipEntry.createSync()`](#static-method-zlibzipentrycreatesyncfilename-data-options).","default":null,"optional":true,"rest":false,"properties":[]}],"returns":{"type":{"text":"ZipEntry","links":[{"name":"ZipEntry","href":"zlib.html#class-zlibzipentry","start":0,"end":8}]},"description":"The created entry."}},"description":"The synchronous version of [`zipBuffer.add()`](#zipbufferaddfilename-data-options). Equivalent to\n`zipBuffer.addEntry(zlib.ZipEntry.createSync(filename, data, options))`.","summary":"The synchronous version of `zipBuffer.add()`. Equivalent to `zipBuffer.addEntry(zlib.ZipEntry.createSync(filename, data, options))`.","examples":[],"children":[]},{"kind":"method","id":"zipbufferaddentryentry","name":"addEntry","title":"`zipBuffer.addEntry(entry)`","scope":"module","overloadOf":null,"stability":null,"added":["v26.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"entry","type":{"text":"ZipEntry","links":[{"name":"ZipEntry","href":"zlib.html#class-zlibzipentry","start":0,"end":8}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":{"type":{"text":"ZipEntry","links":[{"name":"ZipEntry","href":"zlib.html#class-zlibzipentry","start":0,"end":8}]},"description":"`entry`."}},"description":"Adds an already-built entry, keyed by its own [`zipEntry.name`](#zipentryname). Replaces\nany existing entry of that name.","summary":"Adds an already-built entry, keyed by its own `zipEntry.name`. Replaces any existing entry of that name.","examples":[],"children":[]},{"kind":"method","id":"zipbufferclear","name":"clear","title":"`zipBuffer.clear()`","scope":"module","overloadOf":null,"stability":null,"added":["v26.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[],"returns":null},"description":"Removes every entry.","summary":"Removes every entry.","examples":[],"children":[]},{"kind":"property","id":"zipbuffercomment","name":"comment","title":"`zipBuffer.comment`","scope":"module","overloadOf":null,"stability":null,"added":["v26.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"default":null,"description":"The archive-level comment, preserved byte-for-byte across\n[`zipBuffer.toBuffer()`](#zipbuffertobufferoptions) calls unless overridden. The bytes are decoded as\nUTF-8 when they are valid UTF-8 and as CP437 otherwise (the field carries no\nencoding flag of its own).","summary":"The archive-level comment, preserved byte-for-byte across `zipBuffer.toBuffer()` calls unless overridden. The bytes are decoded as UTF-8 when they are valid UTF-8 and as CP437 otherwise (the field carries no encoding flag of its own).","examples":[],"children":[]},{"kind":"method","id":"zipbufferdeletename","name":"delete","title":"`zipBuffer.delete(name)`","scope":"module","overloadOf":null,"stability":null,"added":["v26.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"name","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":{"type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":"`true` if an entry named `name` existed and was removed."}},"description":"","summary":"","examples":[],"children":[]},{"kind":"method","id":"zipbufferentries","name":"entries","title":"`zipBuffer.entries()`","scope":"module","overloadOf":null,"stability":null,"added":["v26.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[],"returns":{"type":{"text":"Iterator","links":[{"name":"Iterator","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Iterator","start":0,"end":8}]},"description":"of `[name, entry]` pairs, where `entry` is a\n[`ZipEntry`](#class-zlibzipentry)."}},"description":"","summary":"","examples":[],"children":[]},{"kind":"method","id":"zipbufferforeachcallback-thisarg","name":"forEach","title":"`zipBuffer.forEach(callback[, thisArg])`","scope":"module","overloadOf":null,"stability":null,"added":["v26.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"callback","type":{"text":"Function","links":[{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":0,"end":8}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"thisArg","type":{"text":"any","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"description":"","default":null,"optional":true,"rest":false,"properties":[]}],"returns":null},"description":"Calls `callback` once for each entry, in the order the archive lists them.","summary":"Calls `callback` once for each entry, in the order the archive lists them.","examples":[],"children":[]},{"kind":"method","id":"zipbuffergetname","name":"get","title":"`zipBuffer.get(name)`","scope":"module","overloadOf":null,"stability":null,"added":["v26.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"name","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":{"type":{"text":"ZipEntry","links":[{"name":"ZipEntry","href":"zlib.html#class-zlibzipentry","start":0,"end":8}]},"description":""}},"description":"Throws [`ERR_ZIP_ENTRY_NOT_FOUND`](errors.html#err_zip_entry_not_found) if the archive has no entry named `name`.","summary":"Throws `ERR_ZIP_ENTRY_NOT_FOUND` if the archive has no entry named `name`.","examples":[],"children":[]},{"kind":"method","id":"zipbufferhasname","name":"has","title":"`zipBuffer.has(name)`","scope":"module","overloadOf":null,"stability":null,"added":["v26.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"name","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":{"type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":""}},"description":"","summary":"","examples":[],"children":[]},{"kind":"method","id":"zipbufferkeys","name":"keys","title":"`zipBuffer.keys()`","scope":"module","overloadOf":null,"stability":null,"added":["v26.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[],"returns":{"type":{"text":"Iterator","links":[{"name":"Iterator","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Iterator","start":0,"end":8}]},"description":"of entry names."}},"description":"","summary":"","examples":[],"children":[]},{"kind":"property","id":"zipbuffersize","name":"size","title":"`zipBuffer.size`","scope":"module","overloadOf":null,"stability":null,"added":["v26.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"default":null,"description":"The number of entries in the archive.","summary":"The number of entries in the archive.","examples":[],"children":[]},{"kind":"method","id":"zipbuffertobufferoptions","name":"toBuffer","title":"`zipBuffer.toBuffer([options])`","scope":"module","overloadOf":null,"stability":null,"added":["v26.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"options","type":{"text":"string | Object","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6},{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":9,"end":15}]},"description":"An archive comment, as a shorthand for\n`{ comment: options }`.","default":null,"optional":true,"rest":false,"properties":[{"name":"comment","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"An archive comment.","default":"zipBuffer.comment","optional":true,"rest":false,"properties":[]},{"name":"baseOffset","type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"description":"Shifts every offset the archive records by this\nmany bytes, so the serialized archive is self-describing even when it is\nwritten somewhere other than the start of its eventual file - for example,\nafter `baseOffset` bytes of other content already written to the same\noutput.","default":"0","optional":true,"rest":false,"properties":[]}]}],"returns":{"type":{"text":"Promise","links":[{"name":"Promise","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise","start":0,"end":7}]},"description":"Fulfilled with a {Buffer} containing the serialized\narchive."}},"description":"Serializes the current set of entries - in the order they were added or\nread - into a fresh archive, switching to Zip64 structures automatically as\nneeded (see [`zlib.createZipArchive()`](#zlibcreateziparchiveentries-options)).","summary":"Serializes the current set of entries - in the order they were added or read - into a fresh archive, switching to Zip64 structures automatically as needed (see `zlib.createZipArchive()`).","examples":[],"children":[]},{"kind":"method","id":"zipbuffertobuffersyncoptions","name":"toBufferSync","title":"`zipBuffer.toBufferSync([options])`","scope":"module","overloadOf":null,"stability":null,"added":["v26.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"options","type":{"text":"string | Object","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6},{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":9,"end":15}]},"description":"See [`zipBuffer.toBuffer()`](#zipbuffertobufferoptions).","default":null,"optional":true,"rest":false,"properties":[]}],"returns":{"type":{"text":"Buffer","links":[{"name":"Buffer","href":"buffer.html#class-buffer","start":0,"end":6}]},"description":"The serialized archive."}},"description":"The synchronous version of [`zipBuffer.toBuffer()`](#zipbuffertobufferoptions) (see\n[`zlib.createZipArchiveSync()`](#zlibcreateziparchivesyncentries-options)).","summary":"The synchronous version of `zipBuffer.toBuffer()` (see `zlib.createZipArchiveSync()`).","examples":[],"children":[]},{"kind":"method","id":"zipbuffervalues","name":"values","title":"`zipBuffer.values()`","scope":"module","overloadOf":null,"stability":null,"added":["v26.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[],"returns":{"type":{"text":"Iterator","links":[{"name":"Iterator","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Iterator","start":0,"end":8}]},"description":"of [`ZipEntry`](#class-zlibzipentry)."}},"description":"","summary":"","examples":[],"children":[]},{"kind":"property","id":"zipbufferwritable","name":"writable","title":"`zipBuffer.writable`","scope":"module","overloadOf":null,"stability":null,"added":["v26.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"default":null,"description":"Always `true`.","summary":"Always `true`.","examples":[],"children":[]}]},{"kind":"class","id":"class-zlibzipentry","name":"ZipEntry","title":"Class: `zlib.ZipEntry`","scope":"module","overloadOf":null,"stability":{"index":"1.0","description":"Early development"},"added":["v26.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"extends":null,"description":"The ZIP archive API is experimental. Using any part of it (this class among\nthem) emits an experimental warning the first time; merely importing\n`node:zlib` does not.\n\nA single file or directory inside a ZIP archive. Instances are produced by\n[`ZipBuffer`](#class-zlibzipbuffer) and [`ZipFile`](#class-zlibzipfile), or created directly for writing with\n`ZipEntry.create()`/`ZipEntry.createStream()`.\n\n`create()` and `content()` each have a `*Sync` counterpart (the streaming\n`contentIterator()` does not). As with the synchronous `node:fs` APIs, these\nblock the\nNode.js event loop and further JavaScript execution until the operation\n(including any deflate/inflate pass) completes; use them only where\nsynchronous execution is appropriate (for example, short-lived scripts or\nstartup code), not in code that must stay responsive.","summary":"The ZIP archive API is experimental. Using any part of it (this class among them) emits an experimental warning the first time; merely importing `node:zlib` does not.","examples":[],"children":[{"kind":"staticMethod","id":"static-method-zlibzipentrycreatefilename-data-options","name":"create","title":"Static method: `zlib.ZipEntry.create(filename, data[, options])`","scope":"module","overloadOf":null,"stability":null,"added":["v26.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"filename","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"The entry's name within the archive. A trailing `/`\nmarks a directory entry.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"data","type":{"text":"Buffer | TypedArray | DataView | ArrayBuffer","links":[{"name":"Buffer","href":"buffer.html#class-buffer","start":0,"end":6},{"name":"TypedArray","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/TypedArray","start":9,"end":19},{"name":"DataView","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/DataView","start":22,"end":30},{"name":"ArrayBuffer","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer","start":33,"end":44}]},"description":"The entry's complete,\nuncompressed content. Must be empty when `filename` names a directory.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"options","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"","default":null,"optional":true,"rest":false,"properties":[{"name":"comment","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"An entry comment.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"mode","type":{"text":"integer","links":[{"name":"integer","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":7}]},"description":"Unix permission bits.","default":"`0o644` (`0o755` for directories)","optional":true,"rest":false,"properties":[]},{"name":"modified","type":{"text":"Date","links":[{"name":"Date","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Date","start":0,"end":4}]},"description":"The entry's modification time.","default":"the current time","optional":true,"rest":false,"properties":[]},{"name":"method","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"One of `'deflate'`, `'store'`, or `'zstd'`.","default":"`'deflate'`, except for directories and empty content, which are always stored","optional":true,"rest":false,"properties":[]}]}],"returns":{"type":{"text":"Promise","links":[{"name":"Promise","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise","start":0,"end":7}]},"description":"Fulfilled with a {ZipEntry}."}},"description":"Compresses `data` (unless `method` is `'store'`, or compression would not\nreduce its size) and computes its CRC-32.\n\nWhen the entry ends up stored uncompressed (because `method` is `'store'`,\nor because compression would not reduce the size), the entry retains a\nzero-copy view of `data` rather than a copy, and its CRC-32 has already been\nrecorded. Do not mutate `data` after creating the entry; pass a copy if it\nmight change.\n\nThe MS-DOS date/time fields ZIP uses for `modified` have 2-second resolution\nand no time zone. When `modified` does not fall on a whole 2-second\nboundary, an Info-ZIP extended-timestamp extra field is written as well,\nrecording the whole (UTC) second so the time round-trips more precisely (see\n[`zipEntry.modified`](#zipentrymodified)). This applies to every entry-creation path.","summary":"Compresses `data` (unless `method` is `'store'`, or compression would not reduce its size) and computes its CRC-32.","examples":[],"children":[]},{"kind":"staticMethod","id":"static-method-zlibzipentrycreatestreamfilename-source-options","name":"createStream","title":"Static method: `zlib.ZipEntry.createStream(filename, source[, options])`","scope":"module","overloadOf":null,"stability":null,"added":["v26.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"filename","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"The entry's name within the archive. Must not end\nin `/`.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"source","type":{"text":"AsyncIterable","links":[{"name":"AsyncIterable","href":"https://tc39.github.io/ecma262/#sec-asynciterable-interface","start":0,"end":13}]},"description":"Yields the entry's uncompressed content as\n`Uint8Array` chunks.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"options","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"","default":null,"optional":true,"rest":false,"properties":[{"name":"comment","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"An entry comment.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"mode","type":{"text":"integer","links":[{"name":"integer","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":7}]},"description":"Unix permission bits.","default":"0o644","optional":true,"rest":false,"properties":[]},{"name":"modified","type":{"text":"Date","links":[{"name":"Date","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Date","start":0,"end":4}]},"description":"The entry's modification time.","default":"the current time","optional":true,"rest":false,"properties":[]},{"name":"method","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"One of `'deflate'`, `'store'`, or `'zstd'`.","default":"'deflate'","optional":true,"rest":false,"properties":[]}]}],"returns":{"type":{"text":"ZipEntry","links":[{"name":"ZipEntry","href":"zlib.html#class-zlibzipentry","start":0,"end":8}]},"description":""}},"description":"Creates an entry whose content is compressed on the fly as it is serialized\nby [`zlib.createZipArchive()`](#zlibcreateziparchiveentries-options), without buffering `source` in memory. Its\n`size`, `compressedSize`, and `crc32` only become available once\nserialization has finished. There is no synchronous counterpart: streaming\nentries only make sense with an asynchronous, incrementally-produced\n`source`.\n\n`source` is drained exactly once, during serialization. Until that happens\nthe entry has no readable content, so [`zipEntry.content()`](#zipentrycontentoptions),\n[`zipEntry.contentSync()`](#zipentrycontentsyncoptions), and [`zipEntry.contentIterator()`](#zipentrycontentiteratoroptions) throw\n[`ERR_INVALID_STATE`](errors.html#err_invalid_state). If the entry is serialized by adding it to a writable\n[`ZipFile`](#class-zlibzipfile) with [`zipFile.addEntry()`](#zipfileaddentryentry) (or `addEntrySync()`), it is then\n**promoted in place** to a file-backed entry pointing at the copy just written,\nso it becomes readable (and can be serialized again) for as long as that\n`ZipFile` stays open. Serializing it any other way (for example directly\nthrough [`zlib.createZipArchive()`](#zlibcreateziparchiveentries-options)) leaves it spent and unreadable.\n\nBecause `source` may hold an operating-system resource (a file read stream,\nsay), a streaming entry is disposable: its `Symbol.dispose` and\n`Symbol.asyncDispose` methods destroy `source` if it has not been consumed.\nAn entry passed to an archive is disposed by that archive (see\n[`zlib.createZipArchive()`](#zlibcreateziparchiveentries-options)); dispose an entry directly only when it was\nbuilt but never handed to one. Disposal is a no-op for non-streaming entries -\nin particular a file-backed entry never closes the [`ZipFile`](#class-zlibzipfile) descriptor it\nborrows.","summary":"Creates an entry whose content is compressed on the fly as it is serialized by `zlib.createZipArchive()`, without buffering `source` in memory. Its `size`, `compressedSize`, and `crc32` only become available once serialization has finished. There is no synchronous counterpart: streaming entries only make sense with an asynchronous, incrementally-produced `source`.","examples":[],"children":[]},{"kind":"staticMethod","id":"static-method-zlibzipentrycreatesymlinkfilename-target-options","name":"createSymlink","title":"Static method: `zlib.ZipEntry.createSymlink(filename, target[, options])`","scope":"module","overloadOf":null,"stability":null,"added":["v26.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"filename","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"The entry's name within the archive.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"target","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"The symbolic link's target path.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"options","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"","default":null,"optional":true,"rest":false,"properties":[{"name":"comment","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"An entry comment.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"mode","type":{"text":"integer","links":[{"name":"integer","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":7}]},"description":"Unix permission bits.","default":"0o777","optional":true,"rest":false,"properties":[]},{"name":"modified","type":{"text":"Date","links":[{"name":"Date","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Date","start":0,"end":4}]},"description":"The entry's modification time.","default":"the current time","optional":true,"rest":false,"properties":[]}]}],"returns":{"type":{"text":"ZipEntry","links":[{"name":"ZipEntry","href":"zlib.html#class-zlibzipentry","start":0,"end":8}]},"description":""}},"description":"Creates a symbolic-link entry: a stored entry whose content is `target` and\nwhose Unix mode type bits mark it as a symlink, so [`zipEntry.isSymlink`](#zipentryissymlink) is\n`true` when it is read back. Extraction tools that honor symlink entries\nrecreate the link; treat `target` as untrusted (see [`zipEntry.name`](#zipentryname) on\npath safety).","summary":"Creates a symbolic-link entry: a stored entry whose content is `target` and whose Unix mode type bits mark it as a symlink, so `zipEntry.isSymlink` is `true` when it is read back. Extraction tools that honor symlink entries recreate the link; treat `target` as untrusted (see `zipEntry.name` on path safety).","examples":[],"children":[]},{"kind":"staticMethod","id":"static-method-zlibzipentrycreatesyncfilename-data-options","name":"createSync","title":"Static method: `zlib.ZipEntry.createSync(filename, data[, options])`","scope":"module","overloadOf":null,"stability":null,"added":["v26.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"filename","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"The entry's name within the archive. A trailing `/`\nmarks a directory entry.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"data","type":{"text":"Buffer | TypedArray | DataView | ArrayBuffer","links":[{"name":"Buffer","href":"buffer.html#class-buffer","start":0,"end":6},{"name":"TypedArray","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/TypedArray","start":9,"end":19},{"name":"DataView","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/DataView","start":22,"end":30},{"name":"ArrayBuffer","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer","start":33,"end":44}]},"description":"The entry's complete,\nuncompressed content. Must be empty when `filename` names a directory.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"options","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"See [`zlib.ZipEntry.create()`](#static-method-zlibzipentrycreatefilename-data-options).","default":null,"optional":true,"rest":false,"properties":[]}],"returns":{"type":{"text":"ZipEntry","links":[{"name":"ZipEntry","href":"zlib.html#class-zlibzipentry","start":0,"end":8}]},"description":""}},"description":"The synchronous version of [`zlib.ZipEntry.create()`](#static-method-zlibzipentrycreatefilename-data-options).","summary":"The synchronous version of `zlib.ZipEntry.create()`.","examples":[],"children":[]},{"kind":"staticMethod","id":"static-method-zlibzipentryreadbuffer","name":"read","title":"Static method: `zlib.ZipEntry.read(buffer)`","scope":"module","overloadOf":null,"stability":null,"added":["v26.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"buffer","type":{"text":"Buffer | TypedArray | DataView | ArrayBuffer","links":[{"name":"Buffer","href":"buffer.html#class-buffer","start":0,"end":6},{"name":"TypedArray","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/TypedArray","start":9,"end":19},{"name":"DataView","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/DataView","start":22,"end":30},{"name":"ArrayBuffer","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer","start":33,"end":44}]},"description":"A complete ZIP archive.","default":null,"optional":false,"rest":false,"properties":[]}],"returns":{"type":{"text":"Iterator","links":[{"name":"Iterator","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Iterator","start":0,"end":8}]},"description":"of {ZipEntry}."}},"description":"Parses every entry out of `buffer` directly, without indexing it into a\n[`ZipBuffer`](#class-zlibzipbuffer). Like [`ZipBuffer`](#class-zlibzipbuffer), the yielded entries hold zero-copy views\nof `buffer` rather than copies of their content, so the same rule applies: do\nnot mutate or reuse `buffer` while any of them is still in use.","summary":"Parses every entry out of `buffer` directly, without indexing it into a `ZipBuffer`. Like `ZipBuffer`, the yielded entries hold zero-copy views of `buffer` rather than copies of their content, so the same rule applies: do not mutate or reuse `buffer` while any of them is still in use.","examples":[],"children":[]},{"kind":"property","id":"zipentrycomment","name":"comment","title":"`zipEntry.comment`","scope":"module","overloadOf":null,"stability":null,"added":["v26.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"default":null,"description":"","summary":"","examples":[],"children":[]},{"kind":"property","id":"zipentrycompressed","name":"compressed","title":"`zipEntry.compressed`","scope":"module","overloadOf":null,"stability":null,"added":["v26.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"default":null,"description":"`true` if the entry's content is stored in compressed form (any compression\nmethod, currently deflate or Zstandard); `false` if it is stored\nuncompressed.","summary":"`true` if the entry's content is stored in compressed form (any compression method, currently deflate or Zstandard); `false` if it is stored uncompressed.","examples":[],"children":[]},{"kind":"property","id":"zipentrycompressedsize","name":"compressedSize","title":"`zipEntry.compressedSize`","scope":"module","overloadOf":null,"stability":null,"added":["v26.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"default":null,"description":"","summary":"","examples":[],"children":[]},{"kind":"method","id":"zipentrycontentoptions","name":"content","title":"`zipEntry.content([options])`","scope":"module","overloadOf":null,"stability":null,"added":["v26.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"options","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"","default":null,"optional":true,"rest":false,"properties":[{"name":"verify","type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":"Verify the entry's CRC-32 checksum.","default":"true","optional":true,"rest":false,"properties":[]},{"name":"maxSize","type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"description":"Reject content declaring more than this many\nuncompressed bytes, before allocating anything.","default":"zlib.getMaxZipContentSize()","optional":true,"rest":false,"properties":[]}]}],"returns":{"type":{"text":"Promise","links":[{"name":"Promise","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise","start":0,"end":7}]},"description":"Fulfilled with a {Buffer} containing the entry's\ndecompressed content. The buffer is a fresh copy that shares no memory\nwith the archive or with data the entry was created from."}},"description":"Throws an [`ERR_ZIP_ENTRY_TOO_LARGE`](errors.html#err_zip_entry_too_large) error if the entry's declared size\nexceeds `maxSize`, an [`ERR_ZIP_ENTRY_CORRUPT`](errors.html#err_zip_entry_corrupt) error if the content fails\nCRC-32 verification or does not match its declared size, and an\n[`ERR_INVALID_STATE`](errors.html#err_invalid_state) error for a streaming entry\n([`zlib.ZipEntry.createStream()`](#static-method-zlibzipentrycreatestreamfilename-source-options)) whose content is not yet available (see\nthat method for when a streaming entry becomes readable).","summary":"Throws an `ERR_ZIP_ENTRY_TOO_LARGE` error if the entry's declared size exceeds `maxSize`, an `ERR_ZIP_ENTRY_CORRUPT` error if the content fails CRC-32 verification or does not match its declared size, and an `ERR_INVALID_STATE` error for a streaming entry (`zlib.ZipEntry.createStream()`) whose content is not yet available (see that method for when a streaming entry becomes readable).","examples":[],"children":[]},{"kind":"method","id":"zipentrycontentsyncoptions","name":"contentSync","title":"`zipEntry.contentSync([options])`","scope":"module","overloadOf":null,"stability":null,"added":["v26.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"options","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"See [`zipEntry.content()`](#zipentrycontentoptions).","default":null,"optional":true,"rest":false,"properties":[]}],"returns":{"type":{"text":"Buffer","links":[{"name":"Buffer","href":"buffer.html#class-buffer","start":0,"end":6}]},"description":"The entry's decompressed content."}},"description":"The synchronous version of [`zipEntry.content()`](#zipentrycontentoptions).","summary":"The synchronous version of `zipEntry.content()`.","examples":[],"children":[]},{"kind":"method","id":"zipentrycontentiteratoroptions","name":"contentIterator","title":"`zipEntry.contentIterator([options])`","scope":"module","overloadOf":null,"stability":null,"added":["v26.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"options","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"","default":null,"optional":true,"rest":false,"properties":[{"name":"verify","type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":"Verify the entry's CRC-32 checksum.","default":"true","optional":true,"rest":false,"properties":[]},{"name":"maxSize","type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"description":"Reject content declaring more than this many\nuncompressed bytes, before decompressing anything.","default":"no limit","optional":true,"rest":false,"properties":[]}]}],"returns":{"type":{"text":"AsyncIterator","links":[{"name":"AsyncIterator","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/AsyncIterator","start":0,"end":13}]},"description":"of {Buffer} chunks of the entry's decompressed\ncontent."}},"description":"Unlike [`zipEntry.content()`](#zipentrycontentoptions), this does not buffer the whole member in\nmemory. For a file-backed entry (one returned by [`zipFile.get()`](#zipfilegetname)) the\ncompressed bytes are read from disk as the iterator is consumed and nothing is\nretained; the entry is valid only while its `ZipFile` is open.\n\nBecause streaming is the bounded-memory path for arbitrarily large members, it\nis **not** capped by [`zlib.getMaxZipContentSize()`](#zlibgetmaxzipcontentsize) the way\n[`zipEntry.content()`](#zipentrycontentoptions) is - that default guards a single large allocation,\nwhich streaming never makes. Output is still bounded per chunk to the declared\nuncompressed size; pass `maxSize` to impose an explicit ceiling.\n\nFor an in-memory entry stored without compression, the yielded chunks are\nzero-copy views of the entry's retained content (see\n[`zipEntry.rawContent`](#zipentryrawcontent)); do not mutate them.\n\nThe yielded chunks are **provisional until the iterator completes**. CRC-32\nverification (and the final declared-size check) can only run once every byte\nhas been read, so a corrupt or truncated entry is reported by the iterator\nthrowing *after* the last chunk, not before the first. Each chunk is still\nbounded so the total never exceeds the declared size or `maxSize`, but a\nconsumer that must not act on unverified bytes should buffer them (or use\n[`zipEntry.content()`](#zipentrycontentoptions), which verifies before returning anything) rather than\nprocessing chunks as they arrive.","summary":"Unlike `zipEntry.content()`, this does not buffer the whole member in memory. For a file-backed entry (one returned by `zipFile.get()`) the compressed bytes are read from disk as the iterator is consumed and nothing is retained; the entry is valid only while its `ZipFile` is open.","examples":[],"children":[]},{"kind":"property","id":"zipentrycrc32","name":"crc32","title":"`zipEntry.crc32`","scope":"module","overloadOf":null,"stability":null,"added":["v26.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"default":null,"description":"","summary":"","examples":[],"children":[]},{"kind":"property","id":"zipentryflags","name":"flags","title":"`zipEntry.flags`","scope":"module","overloadOf":null,"stability":null,"added":["v26.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"default":null,"description":"The entry's raw general-purpose bit flag.","summary":"The entry's raw general-purpose bit flag.","examples":[],"children":[]},{"kind":"property","id":"zipentryisdirectory","name":"isDirectory","title":"`zipEntry.isDirectory`","scope":"module","overloadOf":null,"stability":null,"added":["v26.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"default":null,"description":"`true` if the entry is a directory (its name ends with `/`).","summary":"`true` if the entry is a directory (its name ends with `/`).","examples":[],"children":[]},{"kind":"property","id":"zipentryisfile","name":"isFile","title":"`zipEntry.isFile`","scope":"module","overloadOf":null,"stability":null,"added":["v26.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"default":null,"description":"`true` if the entry is a regular file — that is, neither a directory nor a\nsymbolic link.","summary":"`true` if the entry is a regular file — that is, neither a directory nor a symbolic link.","examples":[],"children":[]},{"kind":"property","id":"zipentryissymlink","name":"isSymlink","title":"`zipEntry.isSymlink`","scope":"module","overloadOf":null,"stability":null,"added":["v26.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"default":null,"description":"`true` if the entry is a symbolic link (its Unix mode type bits are\n`S_IFLNK`); its content is the link target. Always `false` for archives not\nwritten on a Unix-like system. When extracting, treat a symlink's target as\nuntrusted — see [`zipEntry.name`](#zipentryname) on path safety.","summary":"`true` if the entry is a symbolic link (its Unix mode type bits are `S_IFLNK`); its content is the link target. Always `false` for archives not written on a Unix-like system. When extracting, treat a symlink's target as untrusted — see `zipEntry.name` on path safety.","examples":[],"children":[]},{"kind":"property","id":"zipentrymode","name":"mode","title":"`zipEntry.mode`","scope":"module","overloadOf":null,"stability":null,"added":["v26.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"default":null,"description":"The entry's Unix mode permission bits, including the setuid, setgid, and\nsticky bits (the low 12 bits, `0o7777`), or `0` if the archive was not written\non a Unix-like system. The file-type bits are not included here; use\n[`zipEntry.isDirectory`](#zipentryisdirectory) / [`zipEntry.isSymlink`](#zipentryissymlink) for the type.","summary":"The entry's Unix mode permission bits, including the setuid, setgid, and sticky bits (the low 12 bits, `0o7777`), or `0` if the archive was not written on a Unix-like system. The file-type bits are not included here; use `zipEntry.isDirectory` / `zipEntry.isSymlink` for the type.","examples":[],"children":[]},{"kind":"property","id":"zipentrymodified","name":"modified","title":"`zipEntry.modified`","scope":"module","overloadOf":null,"stability":null,"added":["v26.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"Date","links":[{"name":"Date","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Date","start":0,"end":4}]},"default":null,"description":"The entry's last-modification time. When the archive carries a higher-fidelity\ntimestamp in an extra field — an NTFS (`0x000a`), Info-ZIP extended (`0x5455`),\nor Info-ZIP Unix (`0x5855`) field, as most modern tools write — that absolute\n(UTC) time is used; otherwise the coarse, local-time MS-DOS date/time field\n(2-second resolution) is used.\n\nSome tools store their high-fidelity timestamp only in the local file header,\nso on a file-backed entry (one returned by [`zipFile.get()`](#zipfilegetname)) the first read\nof this property may perform a small synchronous positioned disk read to\nresolve that header. If that read fails, the value silently falls back to the\ncentral-directory data.","summary":"The entry's last-modification time. When the archive carries a higher-fidelity timestamp in an extra field — an NTFS (`0x000a`), Info-ZIP extended (`0x5455`), or Info-ZIP Unix (`0x5855`) field, as most modern tools write — that absolute (UTC) time is used; otherwise the coarse, local-time MS-DOS date/time field (2-second resolution) is used.","examples":[],"children":[]},{"kind":"property","id":"zipentrymethod","name":"method","title":"`zipEntry.method`","scope":"module","overloadOf":null,"stability":null,"added":["v26.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"default":null,"description":"The entry's raw compression method: `0` for stored, `8` for deflate, `93`\nfor Zstandard.","summary":"The entry's raw compression method: `0` for stored, `8` for deflate, `93` for Zstandard.","examples":[],"children":[]},{"kind":"property","id":"zipentryname","name":"name","title":"`zipEntry.name`","scope":"module","overloadOf":null,"stability":null,"added":["v26.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"default":null,"description":"The entry's name, decoded from the central directory, which is treated as\nauthoritative — a local file header that disagrees is ignored, so a\nmismatched-header (\"ZIP-confusion\") archive cannot make `name` disagree with\nwhat is read. The bytes are decoded from a valid Info-ZIP Unicode Path extra\nfield (`0x7075`) when one is present; otherwise as UTF-8 when the\nlanguage-encoding flag (general-purpose bit 11) is set **or the bytes are\nvalid UTF-8** (plenty of tools wrote UTF-8 names without ever setting the\nflag); and as CP437 — the historical default — only when they are not.\nSee [`zipEntry.nameBuffer`](#zipentrynamebuffer) for the raw bytes.\n\nThe name is returned **verbatim**: it is never normalized, and a name\ncontaining `..`, a leading `/`, a drive letter, or backslashes is neither\nrewritten nor rejected. A `ZipFile`/`ZipBuffer` never writes to disk, so\nguarding against path traversal (\"Zip Slip\") when extracting is the caller's\nresponsibility.","summary":"The entry's name, decoded from the central directory, which is treated as authoritative — a local file header that disagrees is ignored, so a mismatched-header (\"ZIP-confusion\") archive cannot make `name` disagree with what is read. The bytes are decoded from a valid Info-ZIP Unicode Path extra field (`0x7075`) when one is present; otherwise as UTF-8 when the language-encoding flag (general-purpose bit 11) is set **or the bytes are valid UTF-8** (plenty of tools wrote UTF-8 names without ever setting the flag); and as CP437 — the historical default — only when they are not. See `zipEntry.nameBuffer` for the raw bytes.","examples":[],"children":[]},{"kind":"property","id":"zipentrynamebuffer","name":"nameBuffer","title":"`zipEntry.nameBuffer`","scope":"module","overloadOf":null,"stability":null,"added":["v26.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"Buffer","links":[{"name":"Buffer","href":"buffer.html#class-buffer","start":0,"end":6}]},"default":null,"description":"The entry's raw name bytes, before any character decoding. Useful when the\narchive's names are in an encoding other than UTF-8 or CP437 and the caller\nwants to decode them itself.","summary":"The entry's raw name bytes, before any character decoding. Useful when the archive's names are in an encoding other than UTF-8 or CP437 and the caller wants to decode them itself.","examples":[],"children":[]},{"kind":"property","id":"zipentryrawcontent","name":"rawContent","title":"`zipEntry.rawContent`","scope":"module","overloadOf":null,"stability":null,"added":["v26.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"Buffer | null","links":[{"name":"Buffer","href":"buffer.html#class-buffer","start":0,"end":6},{"name":"null","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#null_type","start":9,"end":13}]},"default":null,"description":"The entry's raw (still compressed, if applicable) content when it is held in\nmemory, or `null` when there is no in-memory buffer to expose - for an entry\ncreated with [`zlib.ZipEntry.createStream()`](#static-method-zlibzipentrycreatestreamfilename-source-options), or a file-backed entry\nreturned by [`zipFile.get()`](#zipfilegetname), whose bytes are read from disk on demand\nrather than retained. Use [`zipEntry.content()`](#zipentrycontentoptions) or\n[`zipEntry.contentIterator()`](#zipentrycontentiteratoroptions) to read a file-backed entry.","summary":"The entry's raw (still compressed, if applicable) content when it is held in memory, or `null` when there is no in-memory buffer to expose - for an entry created with `zlib.ZipEntry.createStream()`, or a file-backed entry returned by `zipFile.get()`, whose bytes are read from disk on demand rather than retained. Use `zipEntry.content()` or `zipEntry.contentIterator()` to read a file-backed entry.","examples":[],"children":[]},{"kind":"property","id":"zipentrysize","name":"size","title":"`zipEntry.size`","scope":"module","overloadOf":null,"stability":null,"added":["v26.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"default":null,"description":"The entry's uncompressed size, in bytes.","summary":"The entry's uncompressed size, in bytes.","examples":[],"children":[]}]},{"kind":"class","id":"class-zlibzipfile","name":"ZipFile","title":"Class: `zlib.ZipFile`","scope":"module","overloadOf":null,"stability":{"index":"1.0","description":"Early development"},"added":["v26.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"extends":null,"description":"The ZIP archive API is experimental. Using any part of it (this class among\nthem) emits an experimental warning the first time; merely importing\n`node:zlib` does not.\n\nA random-access view over the entries of a ZIP archive on disk. Only the\narchive's tail and central directory are read up front; member content is\nread from disk lazily, on demand. Writable when opened with\n`{ writable: true }`: [`zipFile.addEntry()`](#zipfileaddentryentry)/[`zipFile.add()`](#zipfileaddfilename-data-options) append the\nnew member's data where the central directory used to be, then rewrite the\ncentral directory immediately after it; [`zipFile.delete()`](#zipfiledeletename) just rewrites\nthe central directory. Both mean the file is altered as soon as the method's\nreturned `Promise` fulfills. Deleted or replaced members are left behind as\ndead space; [`zipFile.compact()`](#zipfilecompactcomment) produces a stream with none.\n\nThese in-place edits are **not crash-atomic**. Rewriting the central directory\nhappens in place, so a write that fails partway - the disk fills, the device\ndisconnects, the process is killed - can leave the archive on disk with a\npartial or missing central directory, i.e. unreadable, even though the member\ndata before it is intact. The rejected call surfaces the underlying error and\nthe `ZipFile` object is left usable (its in-memory view is not discarded, so a\ncaller can attempt recovery - for example re-writing the entries elsewhere with\n[`zipFile.compact()`](#zipfilecompactcomment)), but that in-memory view may no longer match the bytes\non disk. Write to a copy, or `compact()` into a fresh file, when durability\nacross a failure matters.\n\nEvery method has a `*Sync` counterpart. As with the synchronous `node:fs`\nAPIs, these block the Node.js event loop and further JavaScript execution\nuntil the operation completes; use them only where synchronous execution is\nappropriate (for example, short-lived scripts or startup code), not in code\nthat must stay responsive. A synchronous method throws `ERR_INVALID_STATE`\nif called while an asynchronous `add()`, `addEntry()`, `delete()`, or\n`close()` on the same `ZipFile` has not settled yet, since letting the two\ninterleave could corrupt the archive.\n\n```mjs\nimport { ZipFile } from 'node:zlib';\nimport { Buffer } from 'node:buffer';\n\nconst zip = await ZipFile.open('archive.zip', { writable: true });\ntry {\n  const entry = await zip.get('member.txt');\n  console.log((await entry.content()).toString());\n  for await (const chunk of await zip.stream('huge.bin')) {\n    // Process each chunk without buffering the whole member.\n  }\n  await zip.add('new.txt', Buffer.from('hello'));\n  await zip.delete('unwanted.txt');\n} finally {\n  await zip.close();\n}\n```\n\n```cjs\nconst { ZipFile } = require('node:zlib');\n\nasync function main() {\n  const zip = await ZipFile.open('archive.zip', { writable: true });\n  try {\n    const entry = await zip.get('member.txt');\n    console.log((await entry.content()).toString());\n    for await (const chunk of await zip.stream('huge.bin')) {\n      // Process each chunk without buffering the whole member.\n    }\n    await zip.add('new.txt', Buffer.from('hello'));\n    await zip.delete('unwanted.txt');\n  } finally {\n    await zip.close();\n  }\n}\nmain();\n```","summary":"The ZIP archive API is experimental. Using any part of it (this class among them) emits an experimental warning the first time; merely importing `node:zlib` does not.","examples":[{"language":"mjs","displayName":null,"code":"import { ZipFile } from 'node:zlib';\nimport { Buffer } from 'node:buffer';\n\nconst zip = await ZipFile.open('archive.zip', { writable: true });\ntry {\n  const entry = await zip.get('member.txt');\n  console.log((await entry.content()).toString());\n  for await (const chunk of await zip.stream('huge.bin')) {\n    // Process each chunk without buffering the whole member.\n  }\n  await zip.add('new.txt', Buffer.from('hello'));\n  await zip.delete('unwanted.txt');\n} finally {\n  await zip.close();\n}"},{"language":"cjs","displayName":null,"code":"const { ZipFile } = require('node:zlib');\n\nasync function main() {\n  const zip = await ZipFile.open('archive.zip', { writable: true });\n  try {\n    const entry = await zip.get('member.txt');\n    console.log((await entry.content()).toString());\n    for await (const chunk of await zip.stream('huge.bin')) {\n      // Process each chunk without buffering the whole member.\n    }\n    await zip.add('new.txt', Buffer.from('hello'));\n    await zip.delete('unwanted.txt');\n  } finally {\n    await zip.close();\n  }\n}\nmain();"}],"children":[{"kind":"staticMethod","id":"static-method-zlibzipfileopenfilename-options","name":"open","title":"Static method: `zlib.ZipFile.open(filename[, options])`","scope":"module","overloadOf":null,"stability":null,"added":["v26.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"filename","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"options","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"","default":null,"optional":true,"rest":false,"properties":[{"name":"writable","type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":"Open the underlying file for both reading and\nwriting (`'r+'`), enabling [`zipFile.addEntry()`](#zipfileaddentryentry)/[`zipFile.add()`](#zipfileaddfilename-data-options)/\n[`zipFile.delete()`](#zipfiledeletename).","default":"false","optional":true,"rest":false,"properties":[]}]}],"returns":{"type":{"text":"Promise","links":[{"name":"Promise","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise","start":0,"end":7}]},"description":"Fulfilled with a {ZipFile}."}},"description":"Throws an [`ERR_ZIP_ARCHIVE_TOO_LARGE`](errors.html#err_zip_archive_too_large) error if the archive's central\ndirectory is too large to buffer in memory.","summary":"Throws an `ERR_ZIP_ARCHIVE_TOO_LARGE` error if the archive's central directory is too large to buffer in memory.","examples":[],"children":[]},{"kind":"staticMethod","id":"static-method-zlibzipfileopensyncfilename-options","name":"openSync","title":"Static method: `zlib.ZipFile.openSync(filename[, options])`","scope":"module","overloadOf":null,"stability":null,"added":["v26.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"filename","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"options","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"See [`zlib.ZipFile.open()`](#static-method-zlibzipfileopenfilename-options).","default":null,"optional":true,"rest":false,"properties":[]}],"returns":{"type":{"text":"ZipFile","links":[{"name":"ZipFile","href":"zlib.html#class-zlibzipfile","start":0,"end":7}]},"description":""}},"description":"The synchronous version of [`zlib.ZipFile.open()`](#static-method-zlibzipfileopenfilename-options).","summary":"The synchronous version of `zlib.ZipFile.open()`.","examples":[],"children":[]},{"kind":"method","id":"zipfileaddfilename-data-options","name":"add","title":"`zipFile.add(filename, data[, options])`","scope":"module","overloadOf":null,"stability":null,"added":["v26.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"filename","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"The entry's name within the archive. A trailing `/`\nmarks a directory entry.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"data","type":{"text":"Buffer | TypedArray | DataView | ArrayBuffer","links":[{"name":"Buffer","href":"buffer.html#class-buffer","start":0,"end":6},{"name":"TypedArray","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/TypedArray","start":9,"end":19},{"name":"DataView","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/DataView","start":22,"end":30},{"name":"ArrayBuffer","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer","start":33,"end":44}]},"description":"The entry's complete,\nuncompressed content.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"options","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"See [`zlib.ZipEntry.create()`](#static-method-zlibzipentrycreatefilename-data-options).","default":null,"optional":true,"rest":false,"properties":[]}],"returns":{"type":{"text":"Promise","links":[{"name":"Promise","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise","start":0,"end":7}]},"description":"Fulfilled with the created {ZipEntry}."}},"description":"Equivalent to `zipFile.addEntry(await zlib.ZipEntry.create(filename, data,\noptions))`.","summary":"Equivalent to `zipFile.addEntry(await zlib.ZipEntry.create(filename, data,options))`.","examples":[],"children":[]},{"kind":"method","id":"zipfileaddentryentry","name":"addEntry","title":"`zipFile.addEntry(entry)`","scope":"module","overloadOf":null,"stability":null,"added":["v26.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"entry","type":{"text":"ZipEntry","links":[{"name":"ZipEntry","href":"zlib.html#class-zlibzipentry","start":0,"end":8}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":{"type":{"text":"Promise","links":[{"name":"Promise","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise","start":0,"end":7}]},"description":"Fulfilled with `entry`."}},"description":"Writes `entry` where the central directory currently starts, then rewrites\nthe central directory to include it, replacing any existing entry of the\nsame name. Throws [`ERR_ZIP_NOT_WRITABLE`](errors.html#err_zip_not_writable) if the `ZipFile` was not opened\nwith `{ writable: true }`.\n\nThe returned (same) `entry` is left readable: a streaming entry created with\n[`zlib.ZipEntry.createStream()`](#static-method-zlibzipentrycreatestreamfilename-source-options), which would otherwise be spent once\nserialized, is promoted in place to a file-backed entry pointing at the copy\njust written (valid while this `ZipFile` is open). In-memory entries keep their\nown buffer unchanged.","summary":"Writes `entry` where the central directory currently starts, then rewrites the central directory to include it, replacing any existing entry of the same name. Throws `ERR_ZIP_NOT_WRITABLE` if the `ZipFile` was not opened with `{ writable: true }`.","examples":[],"children":[]},{"kind":"method","id":"zipfileaddentrysyncentry","name":"addEntrySync","title":"`zipFile.addEntrySync(entry)`","scope":"module","overloadOf":null,"stability":null,"added":["v26.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"entry","type":{"text":"ZipEntry","links":[{"name":"ZipEntry","href":"zlib.html#class-zlibzipentry","start":0,"end":8}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":{"type":{"text":"ZipEntry","links":[{"name":"ZipEntry","href":"zlib.html#class-zlibzipentry","start":0,"end":8}]},"description":"`entry`."}},"description":"The synchronous version of [`zipFile.addEntry()`](#zipfileaddentryentry). `entry` must not be a\npending streaming entry (one created with\n[`zlib.ZipEntry.createStream()`](#static-method-zlibzipentrycreatestreamfilename-source-options)) - there is no synchronous way to drain\nits asynchronous source.","summary":"The synchronous version of `zipFile.addEntry()`. `entry` must not be a pending streaming entry (one created with `zlib.ZipEntry.createStream()`) - there is no synchronous way to drain its asynchronous source.","examples":[],"children":[]},{"kind":"method","id":"zipfileaddsyncfilename-data-options","name":"addSync","title":"`zipFile.addSync(filename, data[, options])`","scope":"module","overloadOf":null,"stability":null,"added":["v26.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"filename","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"The entry's name within the archive. A trailing `/`\nmarks a directory entry.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"data","type":{"text":"Buffer | TypedArray | DataView | ArrayBuffer","links":[{"name":"Buffer","href":"buffer.html#class-buffer","start":0,"end":6},{"name":"TypedArray","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/TypedArray","start":9,"end":19},{"name":"DataView","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/DataView","start":22,"end":30},{"name":"ArrayBuffer","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer","start":33,"end":44}]},"description":"The entry's complete,\nuncompressed content.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"options","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"See [`zlib.ZipEntry.createSync()`](#static-method-zlibzipentrycreatesyncfilename-data-options).","default":null,"optional":true,"rest":false,"properties":[]}],"returns":{"type":{"text":"ZipEntry","links":[{"name":"ZipEntry","href":"zlib.html#class-zlibzipentry","start":0,"end":8}]},"description":"The created entry."}},"description":"The synchronous version of [`zipFile.add()`](#zipfileaddfilename-data-options). Equivalent to\n`zipFile.addEntrySync(zlib.ZipEntry.createSync(filename, data, options))`.","summary":"The synchronous version of `zipFile.add()`. Equivalent to `zipFile.addEntrySync(zlib.ZipEntry.createSync(filename, data, options))`.","examples":[],"children":[]},{"kind":"method","id":"zipfileclose","name":"close","title":"`zipFile.close()`","scope":"module","overloadOf":null,"stability":null,"added":["v26.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[],"returns":{"type":{"text":"Promise","links":[{"name":"Promise","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise","start":0,"end":7}]},"description":""}},"description":"Closes the underlying file handle.\n\nClosing does not invalidate outstanding objects: `ZipEntry` objects previously\nreturned by [`zipFile.get()`](#zipfilegetname) and the `ZipFile`'s own methods will fail with\nsystem-level errors (for example `EBADF`) if used after close, rather than a\ndedicated Node.js error code. The same applies to [`zipFile.closeSync()`](#zipfileclosesync).","summary":"Closes the underlying file handle.","examples":[],"children":[]},{"kind":"method","id":"zipfileclosesync","name":"closeSync","title":"`zipFile.closeSync()`","scope":"module","overloadOf":null,"stability":null,"added":["v26.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[],"returns":null},"description":"The synchronous version of [`zipFile.close()`](#zipfileclose).","summary":"The synchronous version of `zipFile.close()`.","examples":[],"children":[]},{"kind":"property","id":"zipfilecomment","name":"comment","title":"`zipFile.comment`","scope":"module","overloadOf":null,"stability":null,"added":["v26.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"default":null,"description":"The archive-level comment, preserved byte-for-byte across\n[`zipFile.addEntry()`](#zipfileaddentryentry)/[`zipFile.delete()`](#zipfiledeletename) calls. The bytes are decoded\nas UTF-8 when they are valid UTF-8 and as CP437 otherwise (the field carries\nno encoding flag of its own).","summary":"The archive-level comment, preserved byte-for-byte across `zipFile.addEntry()`/`zipFile.delete()` calls. The bytes are decoded as UTF-8 when they are valid UTF-8 and as CP437 otherwise (the field carries no encoding flag of its own).","examples":[],"children":[]},{"kind":"method","id":"zipfilecompactcomment","name":"compact","title":"`zipFile.compact([comment])`","scope":"module","overloadOf":null,"stability":null,"added":["v26.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"comment","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"An archive comment.","default":"zipFile.comment","optional":true,"rest":false,"properties":[]}],"returns":{"type":{"text":"stream.Readable","links":[{"name":"stream.Readable","href":"stream.html#class-streamreadable","start":0,"end":15}]},"description":"A stream of the currently live entries,\nserialized as a fresh archive with no dead space left by prior\n[`zipFile.addEntry()`](#zipfileaddentryentry)/[`zipFile.delete()`](#zipfiledeletename) calls."}},"description":"Does not modify the open file; pipe the result into a new one:\n\n```mjs\nimport { createWriteStream } from 'node:fs';\nzip.compact().pipe(createWriteStream('compacted.zip'));\n```","summary":"Does not modify the open file; pipe the result into a new one:","examples":[{"language":"mjs","displayName":null,"code":"import { createWriteStream } from 'node:fs';\nzip.compact().pipe(createWriteStream('compacted.zip'));"}],"children":[]},{"kind":"method","id":"zipfilecompactsynccomment","name":"compactSync","title":"`zipFile.compactSync([comment])`","scope":"module","overloadOf":null,"stability":null,"added":["v26.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"comment","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"An archive comment.","default":"zipFile.comment","optional":true,"rest":false,"properties":[]}],"returns":{"type":{"text":"Buffer","links":[{"name":"Buffer","href":"buffer.html#class-buffer","start":0,"end":6}]},"description":"The currently live entries, serialized as a fresh\narchive with no dead space left by prior\n[`zipFile.addEntry()`](#zipfileaddentryentry)/[`zipFile.delete()`](#zipfiledeletename) calls."}},"description":"The synchronous version of [`zipFile.compact()`](#zipfilecompactcomment). Does not modify the\nopen file.","summary":"The synchronous version of `zipFile.compact()`. Does not modify the open file.","examples":[],"children":[]},{"kind":"method","id":"zipfiledeletename","name":"delete","title":"`zipFile.delete(name)`","scope":"module","overloadOf":null,"stability":null,"added":["v26.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"name","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":{"type":{"text":"Promise","links":[{"name":"Promise","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise","start":0,"end":7}]},"description":"Fulfilled with `true` if an entry named `name` existed\nand was removed, `false` otherwise."}},"description":"Rewrites the central directory without writing any new content - the\narchive does not grow. Throws [`ERR_ZIP_NOT_WRITABLE`](errors.html#err_zip_not_writable) if the `ZipFile` was\nnot opened with `{ writable: true }`.","summary":"Rewrites the central directory without writing any new content - the archive does not grow. Throws `ERR_ZIP_NOT_WRITABLE` if the `ZipFile` was not opened with `{ writable: true }`.","examples":[],"children":[]},{"kind":"method","id":"zipfiledeletesyncname","name":"deleteSync","title":"`zipFile.deleteSync(name)`","scope":"module","overloadOf":null,"stability":null,"added":["v26.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"name","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":{"type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":"`true` if an entry named `name` existed and was\nremoved, `false` otherwise."}},"description":"The synchronous version of [`zipFile.delete()`](#zipfiledeletename).","summary":"The synchronous version of `zipFile.delete()`.","examples":[],"children":[]},{"kind":"method","id":"zipfileentries","name":"entries","title":"`zipFile.entries()`","scope":"module","overloadOf":null,"stability":null,"added":["v26.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[],"returns":{"type":{"text":"Iterator","links":[{"name":"Iterator","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Iterator","start":0,"end":8}]},"description":"of `[name, entry]` pairs, where `entry` is a\n{Promise} fulfilled with a [`ZipEntry`](#class-zlibzipentry)."}},"description":"","summary":"","examples":[],"children":[]},{"kind":"method","id":"zipfileentriessync","name":"entriesSync","title":"`zipFile.entriesSync()`","scope":"module","overloadOf":null,"stability":null,"added":["v26.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[],"returns":{"type":{"text":"Iterator","links":[{"name":"Iterator","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Iterator","start":0,"end":8}]},"description":"of `[name, entry]` pairs, where `entry` is a resolved\n[`ZipEntry`](#class-zlibzipentry) (not a `Promise`)."}},"description":"The synchronous version of [`zipFile.entries()`](#zipfileentries).","summary":"The synchronous version of `zipFile.entries()`.","examples":[],"children":[]},{"kind":"method","id":"zipfileforeachcallback-thisarg","name":"forEach","title":"`zipFile.forEach(callback[, thisArg])`","scope":"module","overloadOf":null,"stability":null,"added":["v26.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"callback","type":{"text":"Function","links":[{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":0,"end":8}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"thisArg","type":{"text":"any","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"description":"","default":null,"optional":true,"rest":false,"properties":[]}],"returns":null},"description":"","summary":"","examples":[],"children":[]},{"kind":"method","id":"zipfileforeachsynccallback-thisarg","name":"forEachSync","title":"`zipFile.forEachSync(callback[, thisArg])`","scope":"module","overloadOf":null,"stability":null,"added":["v26.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"callback","type":{"text":"Function","links":[{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":0,"end":8}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"thisArg","type":{"text":"any","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"description":"","default":null,"optional":true,"rest":false,"properties":[]}],"returns":null},"description":"The synchronous version of [`zipFile.forEach()`](#zipfileforeachcallback-thisarg): `callback` is invoked\nwith a resolved [`ZipEntry`](#class-zlibzipentry) instead of a `Promise`.","summary":"The synchronous version of `zipFile.forEach()`: `callback` is invoked with a resolved `ZipEntry` instead of a `Promise`.","examples":[],"children":[]},{"kind":"method","id":"zipfilegetname","name":"get","title":"`zipFile.get(name)`","scope":"module","overloadOf":null,"stability":null,"added":["v26.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"name","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":{"type":{"text":"Promise","links":[{"name":"Promise","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise","start":0,"end":7}]},"description":"Fulfilled with a {ZipEntry}."}},"description":"Returns a lazy, file-backed [`ZipEntry`](#class-zlibzipentry) for `name`. Nothing is read from\ndisk here and no content is buffered: the returned entry reads (and, for\n[`zipEntry.content()`](#zipentrycontentoptions), decompresses) its member straight from the file on\neach access, and the `ZipFile` retains no member content. The entry is valid\nonly while this `ZipFile` is open. Reading its content later may throw\n[`ERR_ZIP_ENTRY_TOO_LARGE`](errors.html#err_zip_entry_too_large) if the member is too large to hold in a single\nbuffer; use [`zipEntry.contentIterator()`](#zipentrycontentiteratoroptions) (or [`zipFile.stream()`](#zipfilestreamname-options))\ninstead. Throws [`ERR_ZIP_ENTRY_NOT_FOUND`](errors.html#err_zip_entry_not_found) if the archive has no entry\nnamed `name`.","summary":"Returns a lazy, file-backed `ZipEntry` for `name`. Nothing is read from disk here and no content is buffered: the returned entry reads (and, for `zipEntry.content()`, decompresses) its member straight from the file on each access, and the `ZipFile` retains no member content. The entry is valid only while this `ZipFile` is open. Reading its content later may throw `ERR_ZIP_ENTRY_TOO_LARGE` if the member is too large to hold in a single buffer; use `zipEntry.contentIterator()` (or `zipFile.stream()`) instead. Throws `ERR_ZIP_ENTRY_NOT_FOUND` if the archive has no entry named `name`.","examples":[],"children":[]},{"kind":"method","id":"zipfilegetsyncname","name":"getSync","title":"`zipFile.getSync(name)`","scope":"module","overloadOf":null,"stability":null,"added":["v26.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"name","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":{"type":{"text":"ZipEntry","links":[{"name":"ZipEntry","href":"zlib.html#class-zlibzipentry","start":0,"end":8}]},"description":""}},"description":"The synchronous version of [`zipFile.get()`](#zipfilegetname). Like `get()`, it reads\nnothing up front and only builds the lazy handle, so it does not itself block\non I/O - but reads performed later through the returned entry (such as\n[`zipEntry.contentSync()`](#zipentrycontentsyncoptions)) do; see the note above on synchronous methods.","summary":"The synchronous version of `zipFile.get()`. Like `get()`, it reads nothing up front and only builds the lazy handle, so it does not itself block on I/O - but reads performed later through the returned entry (such as `zipEntry.contentSync()`) do; see the note above on synchronous methods.","examples":[],"children":[]},{"kind":"method","id":"zipfilehasname","name":"has","title":"`zipFile.has(name)`","scope":"module","overloadOf":null,"stability":null,"added":["v26.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"name","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":{"type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":""}},"description":"","summary":"","examples":[],"children":[]},{"kind":"method","id":"zipfilekeys","name":"keys","title":"`zipFile.keys()`","scope":"module","overloadOf":null,"stability":null,"added":["v26.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[],"returns":{"type":{"text":"Iterator","links":[{"name":"Iterator","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Iterator","start":0,"end":8}]},"description":"of entry names."}},"description":"","summary":"","examples":[],"children":[]},{"kind":"property","id":"zipfilesize","name":"size","title":"`zipFile.size`","scope":"module","overloadOf":null,"stability":null,"added":["v26.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"default":null,"description":"The number of entries in the archive.","summary":"The number of entries in the archive.","examples":[],"children":[]},{"kind":"method","id":"zipfilestreamname-options","name":"stream","title":"`zipFile.stream(name[, options])`","scope":"module","overloadOf":null,"stability":null,"added":["v26.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"name","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"options","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"","default":null,"optional":true,"rest":false,"properties":[{"name":"verify","type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":"Verify the entry's CRC-32 checksum.","default":"true","optional":true,"rest":false,"properties":[]},{"name":"maxSize","type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"description":"Reject content declaring more than this many\nuncompressed bytes.","default":"no limit","optional":true,"rest":false,"properties":[]}]}],"returns":{"type":{"text":"Promise","links":[{"name":"Promise","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise","start":0,"end":7}]},"description":"Fulfilled with a {stream.Readable} of the member's\ndecompressed content, without buffering the whole member in memory."}},"description":"Convenience wrapper that resolves to a `Readable` over\n[`zipEntry.contentIterator()`](#zipentrycontentiteratoroptions) of [`zipFile.get()`](#zipfilegetname)`(name)`; the\ncompressed bytes are read from disk as the stream is consumed. The returned\npromise rejects with [`ERR_ZIP_ENTRY_NOT_FOUND`](errors.html#err_zip_entry_not_found) if the archive has no entry\nnamed `name`.","summary":"Convenience wrapper that resolves to a `Readable` over `zipEntry.contentIterator()` of `zipFile.get()``(name)`; the compressed bytes are read from disk as the stream is consumed. The returned promise rejects with `ERR_ZIP_ENTRY_NOT_FOUND` if the archive has no entry named `name`.","examples":[],"children":[]},{"kind":"method","id":"zipfilevalues","name":"values","title":"`zipFile.values()`","scope":"module","overloadOf":null,"stability":null,"added":["v26.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[],"returns":{"type":{"text":"Iterator","links":[{"name":"Iterator","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Iterator","start":0,"end":8}]},"description":"of {Promise} objects, each fulfilled with a\n[`ZipEntry`](#class-zlibzipentry)."}},"description":"","summary":"","examples":[],"children":[]},{"kind":"method","id":"zipfilevaluessync","name":"valuesSync","title":"`zipFile.valuesSync()`","scope":"module","overloadOf":null,"stability":null,"added":["v26.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[],"returns":{"type":{"text":"Iterator","links":[{"name":"Iterator","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Iterator","start":0,"end":8}]},"description":"of resolved [`ZipEntry`](#class-zlibzipentry) values (not `Promise`s)."}},"description":"The synchronous version of [`zipFile.values()`](#zipfilevalues).","summary":"The synchronous version of `zipFile.values()`.","examples":[],"children":[]},{"kind":"property","id":"zipfilewritable","name":"writable","title":"`zipFile.writable`","scope":"module","overloadOf":null,"stability":null,"added":["v26.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"default":null,"description":"Whether this `ZipFile` was opened with `{ writable: true }`.","summary":"Whether this `ZipFile` was opened with `{ writable: true }`.","examples":[],"children":[]}]},{"kind":"class","id":"class-zlibzlibbase","name":"ZlibBase","title":"Class: `zlib.ZlibBase`","scope":"module","overloadOf":null,"stability":null,"added":["v0.5.8"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v11.7.0","v10.16.0"],"prUrl":"https://github.com/nodejs/node/pull/24939","commit":null,"description":"This class was renamed from `Zlib` to `ZlibBase`."}],"extends":null,"description":"Not exported by the `node:zlib` module. It is documented here because it is the\nbase class of the compressor/decompressor classes.\n\nThis class inherits from [`stream.Transform`](stream.html#class-streamtransform), allowing `node:zlib` objects to\nbe used in pipes and similar stream operations.","summary":"Not exported by the `node:zlib` module. It is documented here because it is the base class of the compressor/decompressor classes.","examples":[],"children":[{"kind":"property","id":"zlibbyteswritten","name":"bytesWritten","title":"`zlib.bytesWritten`","scope":"module","overloadOf":null,"stability":null,"added":["v10.0.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"default":null,"description":"The `zlib.bytesWritten` property specifies the number of bytes written to\nthe engine, before the bytes are processed (compressed or decompressed,\nas appropriate for the derived class).","summary":"The `zlib.bytesWritten` property specifies the number of bytes written to the engine, before the bytes are processed (compressed or decompressed, as appropriate for the derived class).","examples":[],"children":[]},{"kind":"method","id":"zlibclosecallback","name":"close","title":"`zlib.close([callback])`","scope":"module","overloadOf":null,"stability":null,"added":["v0.9.4"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"callback","type":{"text":"Function","links":[{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":0,"end":8}]},"description":"","default":null,"optional":true,"rest":false,"properties":[]}],"returns":null},"description":"Close the underlying handle.","summary":"Close the underlying handle.","examples":[],"children":[]},{"kind":"method","id":"zlibflushkind-callback","name":"flush","title":"`zlib.flush([kind, ]callback)`","scope":"module","overloadOf":null,"stability":null,"added":["v0.5.8"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"kind","type":null,"description":"","default":null,"optional":true,"rest":false,"properties":[]},{"name":"callback","type":null,"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":null},"description":"* `kind` **Default:** `zlib.constants.Z_FULL_FLUSH` for zlib-based streams,\n  `zlib.constants.BROTLI_OPERATION_FLUSH` for Brotli-based streams.\n* `callback` {Function}\n\nFlush pending data. Don't call this frivolously, premature flushes negatively\nimpact the effectiveness of the compression algorithm.\n\nCalling this only flushes data from the internal `zlib` state, and does not\nperform flushing of any kind on the streams level. Rather, it behaves like a\nnormal call to `.write()`, i.e. it will be queued up behind other pending\nwrites and will only produce output when data is being read from the stream.","summary":"Flush pending data. Don't call this frivolously, premature flushes negatively impact the effectiveness of the compression algorithm.","examples":[],"children":[]},{"kind":"method","id":"zlibparamslevel-strategy-callback","name":"params","title":"`zlib.params(level, strategy, callback)`","scope":"module","overloadOf":null,"stability":null,"added":["v0.11.4"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"level","type":{"text":"integer","links":[{"name":"integer","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":7}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"strategy","type":{"text":"integer","links":[{"name":"integer","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":7}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"callback","type":{"text":"Function","links":[{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":0,"end":8}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":null},"description":"This function is only available for zlib-based streams, i.e. not Brotli.\n\nDynamically update the compression level and compression strategy.\nOnly applicable to deflate algorithm.","summary":"This function is only available for zlib-based streams, i.e. not Brotli.","examples":[],"children":[]},{"kind":"method","id":"zlibreset","name":"reset","title":"`zlib.reset()`","scope":"module","overloadOf":null,"stability":null,"added":["v0.7.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[],"returns":null},"description":"Reset the compressor/decompressor to factory defaults. Only applicable to\nthe inflate and deflate algorithms.","summary":"Reset the compressor/decompressor to factory defaults. Only applicable to the inflate and deflate algorithms.","examples":[],"children":[]}]},{"kind":"section","id":"class-zstdoptions","name":"Class: ZstdOptions","title":"Class: `ZstdOptions`","scope":"module","overloadOf":null,"stability":{"index":"1","description":"Experimental"},"added":["v23.8.0","v22.15.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v26.7.0"],"prUrl":"https://github.com/nodejs/node/pull/64599","commit":null,"description":"The `dictionary` option can be a `TypedArray`, `DataView`, or `ArrayBuffer`."},{"versions":["v26.5.0"],"prUrl":"https://github.com/nodejs/node/pull/64023","commit":null,"description":"The `rejectGarbageAfterEnd` option was added."}],"description":"Each Zstd-based class takes an `options` object. All options are optional.\n\n* `flush` {integer} **Default:** `zlib.constants.ZSTD_e_continue`\n* `finishFlush` {integer} **Default:** `zlib.constants.ZSTD_e_end`\n* `chunkSize` {integer} **Default:** `16 * 1024`\n* `params` {Object} Key-value object containing indexed [Zstd parameters](#zstd-constants).\n* `maxOutputLength` {integer} Limits output size when using\n  [convenience methods](#convenience-methods). **Default:** [`buffer.kMaxLength`](buffer.html#bufferkmaxlength)\n* `info` {boolean} If `true`, returns an object with `buffer` and `engine`. **Default:** `false`\n* `dictionary` {Buffer | TypedArray | DataView | ArrayBuffer} Optional dictionary used\n  to improve compression efficiency when compressing or decompressing data that\n  shares common patterns with the dictionary.\n* `rejectGarbageAfterEnd` {boolean} If `true`, decompression fails when\n  input remains after the first complete compressed stream. **Default:** `false`\n\nFor example:\n\n```js\nconst stream = zlib.createZstdCompress({\n  chunkSize: 32 * 1024,\n  params: {\n    [zlib.constants.ZSTD_c_compressionLevel]: 10,\n    [zlib.constants.ZSTD_c_checksumFlag]: 1,\n  },\n});\n```","summary":"Each Zstd-based class takes an `options` object. All options are optional.","examples":[{"language":"js","displayName":null,"code":"const stream = zlib.createZstdCompress({\n  chunkSize: 32 * 1024,\n  params: {\n    [zlib.constants.ZSTD_c_compressionLevel]: 10,\n    [zlib.constants.ZSTD_c_checksumFlag]: 1,\n  },\n});"}],"children":[]},{"kind":"class","id":"class-zlibzstdcompress","name":"ZstdCompress","title":"Class: `zlib.ZstdCompress`","scope":"module","overloadOf":null,"stability":{"index":"1","description":"Experimental"},"added":["v23.8.0","v22.15.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"extends":null,"description":"Compress data using the Zstd algorithm.","summary":"Compress data using the Zstd algorithm.","examples":[],"children":[]},{"kind":"class","id":"class-zlibzstddecompress","name":"ZstdDecompress","title":"Class: `zlib.ZstdDecompress`","scope":"module","overloadOf":null,"stability":{"index":"1","description":"Experimental"},"added":["v23.8.0","v22.15.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"extends":null,"description":"Decompress data using the Zstd algorithm.","summary":"Decompress data using the Zstd algorithm.","examples":[],"children":[]},{"kind":"property","id":"zlibconstants","name":"constants","title":"`zlib.constants`","scope":"module","overloadOf":null,"stability":null,"added":["v7.0.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":null,"default":null,"description":"Provides an object enumerating Zlib-related constants.","summary":"Provides an object enumerating Zlib-related constants.","examples":[],"children":[]},{"kind":"method","id":"zlibcrc32data-value","name":"crc32","title":"`zlib.crc32(data[, value])`","scope":"module","overloadOf":null,"stability":null,"added":["v22.2.0","v20.15.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"data","type":{"text":"string | Buffer | TypedArray | DataView","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6},{"name":"Buffer","href":"buffer.html#class-buffer","start":9,"end":15},{"name":"TypedArray","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/TypedArray","start":18,"end":28},{"name":"DataView","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/DataView","start":31,"end":39}]},"description":"When `data` is a string,\nit will be encoded as UTF-8 before being used for computation.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"value","type":{"text":"integer","links":[{"name":"integer","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":7}]},"description":"An optional starting value. It must be a 32-bit unsigned\ninteger.","default":"0","optional":true,"rest":false,"properties":[]}],"returns":{"type":{"text":"integer","links":[{"name":"integer","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":7}]},"description":"A 32-bit unsigned integer containing the checksum."}},"description":"Computes a 32-bit [Cyclic Redundancy Check](https://en.wikipedia.org/wiki/Cyclic_redundancy_check) checksum of `data`. If\n`value` is specified, it is used as the starting value of the checksum,\notherwise, 0 is used as the starting value.\n\nThe CRC algorithm is designed to compute checksums and to detect error\nin data transmission. It's not suitable for cryptographic authentication.\n\nTo be consistent with other APIs, if the `data` is a string, it will\nbe encoded with UTF-8 before being used for computation. If users only\nuse Node.js to compute and match the checksums, this works well with\nother APIs that uses the UTF-8 encoding by default.\n\nSome third-party JavaScript libraries compute the checksum on a\nstring based on `str.charCodeAt()` so that it can be run in browsers.\nIf users want to match the checksum computed with this kind of library\nin the browser, it's better to use the same library in Node.js\nif it also runs in Node.js. If users have to use `zlib.crc32()` to\nmatch the checksum produced by such a third-party library:\n\n1. If the library accepts `Uint8Array` as input, use `TextEncoder`\n   in the browser to encode the string into a `Uint8Array` with UTF-8\n   encoding, and compute the checksum based on the UTF-8 encoded string\n   in the browser.\n2. If the library only takes a string and compute the data based on\n   `str.charCodeAt()`, on the Node.js side, convert the string into\n   a buffer using `Buffer.from(str, 'utf16le')`.\n\n```mjs\nimport zlib from 'node:zlib';\nimport { Buffer } from 'node:buffer';\n\nlet crc = zlib.crc32('hello');  // 907060870\ncrc = zlib.crc32('world', crc);  // 4192936109\n\ncrc = zlib.crc32(Buffer.from('hello', 'utf16le'));  // 1427272415\ncrc = zlib.crc32(Buffer.from('world', 'utf16le'), crc);  // 4150509955\n```\n\n```cjs\nconst zlib = require('node:zlib');\nconst { Buffer } = require('node:buffer');\n\nlet crc = zlib.crc32('hello');  // 907060870\ncrc = zlib.crc32('world', crc);  // 4192936109\n\ncrc = zlib.crc32(Buffer.from('hello', 'utf16le'));  // 1427272415\ncrc = zlib.crc32(Buffer.from('world', 'utf16le'), crc);  // 4150509955\n```","summary":"Computes a 32-bit Cyclic Redundancy Check checksum of `data`. If `value` is specified, it is used as the starting value of the checksum, otherwise, 0 is used as the starting value.","examples":[{"language":"mjs","displayName":null,"code":"import zlib from 'node:zlib';\nimport { Buffer } from 'node:buffer';\n\nlet crc = zlib.crc32('hello');  // 907060870\ncrc = zlib.crc32('world', crc);  // 4192936109\n\ncrc = zlib.crc32(Buffer.from('hello', 'utf16le'));  // 1427272415\ncrc = zlib.crc32(Buffer.from('world', 'utf16le'), crc);  // 4150509955"},{"language":"cjs","displayName":null,"code":"const zlib = require('node:zlib');\nconst { Buffer } = require('node:buffer');\n\nlet crc = zlib.crc32('hello');  // 907060870\ncrc = zlib.crc32('world', crc);  // 4192936109\n\ncrc = zlib.crc32(Buffer.from('hello', 'utf16le'));  // 1427272415\ncrc = zlib.crc32(Buffer.from('world', 'utf16le'), crc);  // 4150509955"}],"children":[]},{"kind":"method","id":"zlibcreatebrotlicompressoptions","name":"createBrotliCompress","title":"`zlib.createBrotliCompress([options])`","scope":"module","overloadOf":null,"stability":null,"added":["v11.7.0","v10.16.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"options","type":{"text":"brotli options","links":[{"name":"brotli options","href":"zlib.html#class-brotlioptions","start":0,"end":14}]},"description":"","default":null,"optional":true,"rest":false,"properties":[]}],"returns":null},"description":"Creates and returns a new [`BrotliCompress`](#class-zlibbrotlicompress) object.","summary":"Creates and returns a new `BrotliCompress` object.","examples":[],"children":[]},{"kind":"method","id":"zlibcreatebrotlidecompressoptions","name":"createBrotliDecompress","title":"`zlib.createBrotliDecompress([options])`","scope":"module","overloadOf":null,"stability":null,"added":["v11.7.0","v10.16.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"options","type":{"text":"brotli options","links":[{"name":"brotli options","href":"zlib.html#class-brotlioptions","start":0,"end":14}]},"description":"","default":null,"optional":true,"rest":false,"properties":[]}],"returns":null},"description":"Creates and returns a new [`BrotliDecompress`](#class-zlibbrotlidecompress) object.","summary":"Creates and returns a new `BrotliDecompress` object.","examples":[],"children":[]},{"kind":"method","id":"zlibcreatedeflateoptions","name":"createDeflate","title":"`zlib.createDeflate([options])`","scope":"module","overloadOf":null,"stability":null,"added":["v0.5.8"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"options","type":{"text":"zlib options","links":[{"name":"zlib options","href":"zlib.html#class-options","start":0,"end":12}]},"description":"","default":null,"optional":true,"rest":false,"properties":[]}],"returns":null},"description":"Creates and returns a new [`Deflate`](#class-zlibdeflate) object.","summary":"Creates and returns a new `Deflate` object.","examples":[],"children":[]},{"kind":"method","id":"zlibcreatedeflaterawoptions","name":"createDeflateRaw","title":"`zlib.createDeflateRaw([options])`","scope":"module","overloadOf":null,"stability":null,"added":["v0.5.8"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"options","type":{"text":"zlib options","links":[{"name":"zlib options","href":"zlib.html#class-options","start":0,"end":12}]},"description":"","default":null,"optional":true,"rest":false,"properties":[]}],"returns":null},"description":"Creates and returns a new [`DeflateRaw`](#class-zlibdeflateraw) object.\n\nAn 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 `windowBits = 9` to zlib actually results in a compressed stream\nthat effectively uses an 8-bit window only.","summary":"Creates and returns a new `DeflateRaw` object.","examples":[],"children":[]},{"kind":"method","id":"zlibcreategunzipoptions","name":"createGunzip","title":"`zlib.createGunzip([options])`","scope":"module","overloadOf":null,"stability":null,"added":["v0.5.8"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"options","type":{"text":"zlib options","links":[{"name":"zlib options","href":"zlib.html#class-options","start":0,"end":12}]},"description":"","default":null,"optional":true,"rest":false,"properties":[]}],"returns":null},"description":"Creates and returns a new [`Gunzip`](#class-zlibgunzip) object.","summary":"Creates and returns a new `Gunzip` object.","examples":[],"children":[]},{"kind":"method","id":"zlibcreategzipoptions","name":"createGzip","title":"`zlib.createGzip([options])`","scope":"module","overloadOf":null,"stability":null,"added":["v0.5.8"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"options","type":{"text":"zlib options","links":[{"name":"zlib options","href":"zlib.html#class-options","start":0,"end":12}]},"description":"","default":null,"optional":true,"rest":false,"properties":[]}],"returns":null},"description":"Creates and returns a new [`Gzip`](#class-zlibgzip) object.\nSee [example](#zlib).","summary":"Creates and returns a new `Gzip` object. See example.","examples":[],"children":[]},{"kind":"method","id":"zlibcreateinflateoptions","name":"createInflate","title":"`zlib.createInflate([options])`","scope":"module","overloadOf":null,"stability":null,"added":["v0.5.8"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"options","type":{"text":"zlib options","links":[{"name":"zlib options","href":"zlib.html#class-options","start":0,"end":12}]},"description":"","default":null,"optional":true,"rest":false,"properties":[]}],"returns":null},"description":"Creates and returns a new [`Inflate`](#class-zlibinflate) object.","summary":"Creates and returns a new `Inflate` object.","examples":[],"children":[]},{"kind":"method","id":"zlibcreateinflaterawoptions","name":"createInflateRaw","title":"`zlib.createInflateRaw([options])`","scope":"module","overloadOf":null,"stability":null,"added":["v0.5.8"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"options","type":{"text":"zlib options","links":[{"name":"zlib options","href":"zlib.html#class-options","start":0,"end":12}]},"description":"","default":null,"optional":true,"rest":false,"properties":[]}],"returns":null},"description":"Creates and returns a new [`InflateRaw`](#class-zlibinflateraw) object.","summary":"Creates and returns a new `InflateRaw` object.","examples":[],"children":[]},{"kind":"method","id":"zlibcreateunzipoptions","name":"createUnzip","title":"`zlib.createUnzip([options])`","scope":"module","overloadOf":null,"stability":null,"added":["v0.5.8"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"options","type":{"text":"zlib options","links":[{"name":"zlib options","href":"zlib.html#class-options","start":0,"end":12}]},"description":"","default":null,"optional":true,"rest":false,"properties":[]}],"returns":null},"description":"Creates and returns a new [`Unzip`](#class-zlibunzip) object.","summary":"Creates and returns a new `Unzip` object.","examples":[],"children":[]},{"kind":"method","id":"zlibcreateziparchiveentries-options","name":"createZipArchive","title":"`zlib.createZipArchive(entries[, options])`","scope":"module","overloadOf":null,"stability":{"index":"1.0","description":"Early development"},"added":["v26.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"entries","type":{"text":"Iterable | AsyncIterable","links":[{"name":"Iterable","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#the_iterable_protocol","start":0,"end":8},{"name":"AsyncIterable","href":"https://tc39.github.io/ecma262/#sec-asynciterable-interface","start":11,"end":24}]},"description":"of [`ZipEntry`](#class-zlibzipentry).","default":null,"optional":false,"rest":false,"properties":[]},{"name":"options","type":{"text":"string | Object","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6},{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":9,"end":15}]},"description":"An archive comment, as a shorthand for\n`{ comment: options }`.","default":null,"optional":true,"rest":false,"properties":[{"name":"comment","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"An archive comment.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"baseOffset","type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"description":"Shifts every local/central header offset the\narchive records by this many bytes, so the emitted stream is\nself-describing even when something else is written before it - for\nexample, appending the archive after `baseOffset` bytes already written to\nthe same file, rather than at its start.","default":"0","optional":true,"rest":false,"properties":[]}]}],"returns":{"type":{"text":"stream.Readable","links":[{"name":"stream.Readable","href":"stream.html#class-streamreadable","start":0,"end":15}]},"description":"A byte stream of the serialized archive."}},"description":"The ZIP archive API is experimental. Using any part of it (this function among\nthem) emits an experimental warning the first time; merely importing\n`node:zlib` does not.\n\nSerializes `entries` into a ZIP archive, switching to Zip64 structures\nautomatically once the entry count, or any offset or size, exceeds what the\nclassic 32-/16-bit ZIP fields can hold. The returned `Readable` is also an\n`AsyncIterable` of the same {Buffer} chunks it streams.\n\nEntries are written in iteration order and nothing deduplicates names: an\niterable that yields two entries with the same name produces an archive\ncontaining both, and most extraction tools keep the one that appears later.\n[`ZipBuffer`](#class-zlibzipbuffer) and [`ZipFile`](#class-zlibzipfile) `add()` methods replace entries by name\ninstead.\n\nThe entries are owned by the returned stream: each is consumed as the archive\nis produced and must not be reused afterwards. This matters for streaming\nentries (from [`zlib.ZipEntry.createStream()`](#static-method-zlibzipentrycreatestreamfilename-source-options)), which hold an underlying\nsource such as a file read stream. If the returned stream is destroyed before\nit is fully consumed - for example, the destination of a [`pipeline()`](stream.html#streampipelinesource-transforms-destination-callback)\nfails - it disposes the entry it was serializing and every entry still queued\nbehind it, destroying their sources so no descriptor leaks. Consume the stream\nto the end, or destroy it (directly, through a failed `pipeline()`, or with\n`await using`), to guarantee this cleanup; a stream that is neither consumed\nnor destroyed cannot release anything. A [`ZipEntry`](#class-zlibzipentry) that is never handed to\nan archive can be released directly with `Symbol.dispose` / `Symbol.asyncDispose`.\n\nThrows an [`ERR_ZIP_ARCHIVE_TOO_LARGE`](errors.html#err_zip_archive_too_large) error if the archive comment\nexceeds 65,535 bytes when encoded as UTF-8.\n\n```mjs\nimport { createWriteStream } from 'node:fs';\nimport { pipeline } from 'node:stream/promises';\nimport { Buffer } from 'node:buffer';\nimport { ZipEntry, createZipArchive } from 'node:zlib';\n\nconst entries = [\n  await ZipEntry.create('hello.txt', Buffer.from('Hello, world!')),\n  await ZipEntry.create('data/', Buffer.alloc(0)),\n];\nawait pipeline(\n  createZipArchive(entries, 'created by node:zlib'),\n  createWriteStream('archive.zip'),\n);\n```\n\n```cjs\nconst { createWriteStream } = require('node:fs');\nconst { pipeline } = require('node:stream/promises');\nconst { ZipEntry, createZipArchive } = require('node:zlib');\n\nasync function main() {\n  const entries = [\n    await ZipEntry.create('hello.txt', Buffer.from('Hello, world!')),\n    await ZipEntry.create('data/', Buffer.alloc(0)),\n  ];\n  await pipeline(\n    createZipArchive(entries, 'created by node:zlib'),\n    createWriteStream('archive.zip'),\n  );\n}\nmain();\n```\n\nPassing `options.baseOffset` produces an archive that is valid immediately\nwhen placed after other content in the same file, without relying on a\nreader's self-extracting-archive detection to compensate for the shift:\n\n```mjs\nimport { createWriteStream } from 'node:fs';\nimport { Buffer } from 'node:buffer';\nimport { ZipEntry, createZipArchive } from 'node:zlib';\n\nconst prefix = Buffer.from('#!/bin/sh\\nexit 0\\n');\nconst entries = [await ZipEntry.create('hello.txt', Buffer.from('Hello, world!'))];\nconst out = createWriteStream('self-extracting.zip');\nout.write(prefix);\ncreateZipArchive(entries, { baseOffset: prefix.byteLength }).pipe(out);\n```","summary":"The ZIP archive API is experimental. Using any part of it (this function among them) emits an experimental warning the first time; merely importing `node:zlib` does not.","examples":[{"language":"mjs","displayName":null,"code":"import { createWriteStream } from 'node:fs';\nimport { pipeline } from 'node:stream/promises';\nimport { Buffer } from 'node:buffer';\nimport { ZipEntry, createZipArchive } from 'node:zlib';\n\nconst entries = [\n  await ZipEntry.create('hello.txt', Buffer.from('Hello, world!')),\n  await ZipEntry.create('data/', Buffer.alloc(0)),\n];\nawait pipeline(\n  createZipArchive(entries, 'created by node:zlib'),\n  createWriteStream('archive.zip'),\n);"},{"language":"cjs","displayName":null,"code":"const { createWriteStream } = require('node:fs');\nconst { pipeline } = require('node:stream/promises');\nconst { ZipEntry, createZipArchive } = require('node:zlib');\n\nasync function main() {\n  const entries = [\n    await ZipEntry.create('hello.txt', Buffer.from('Hello, world!')),\n    await ZipEntry.create('data/', Buffer.alloc(0)),\n  ];\n  await pipeline(\n    createZipArchive(entries, 'created by node:zlib'),\n    createWriteStream('archive.zip'),\n  );\n}\nmain();"},{"language":"mjs","displayName":null,"code":"import { createWriteStream } from 'node:fs';\nimport { Buffer } from 'node:buffer';\nimport { ZipEntry, createZipArchive } from 'node:zlib';\n\nconst prefix = Buffer.from('#!/bin/sh\\nexit 0\\n');\nconst entries = [await ZipEntry.create('hello.txt', Buffer.from('Hello, world!'))];\nconst out = createWriteStream('self-extracting.zip');\nout.write(prefix);\ncreateZipArchive(entries, { baseOffset: prefix.byteLength }).pipe(out);"}],"children":[]},{"kind":"method","id":"zlibcreateziparchivesyncentries-options","name":"createZipArchiveSync","title":"`zlib.createZipArchiveSync(entries[, options])`","scope":"module","overloadOf":null,"stability":{"index":"1.0","description":"Early development"},"added":["v26.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"entries","type":{"text":"Iterable","links":[{"name":"Iterable","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#the_iterable_protocol","start":0,"end":8}]},"description":"of [`ZipEntry`](#class-zlibzipentry).","default":null,"optional":false,"rest":false,"properties":[]},{"name":"options","type":{"text":"string | Object","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6},{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":9,"end":15}]},"description":"See [`zlib.createZipArchive()`](#zlibcreateziparchiveentries-options).","default":null,"optional":true,"rest":false,"properties":[]}],"returns":{"type":{"text":"Iterator","links":[{"name":"Iterator","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Iterator","start":0,"end":8}]},"description":"of {Buffer} chunks making up the serialized archive."}},"description":"The ZIP archive API is experimental. Using any part of it (this function among\nthem) emits an experimental warning the first time; merely importing\n`node:zlib` does not.\n\nThe synchronous version of [`zlib.createZipArchive()`](#zlibcreateziparchiveentries-options). Blocks the\nNode.js event loop and further JavaScript execution until the whole\narchive (including any deflate passes) has been produced; use only where\nsynchronous execution is appropriate (for example, short-lived scripts or\nstartup code), not in code that must stay responsive. `entries` must be a\nplain (synchronous) `Iterable` - a streaming entry created with\n[`zlib.ZipEntry.createStream()`](#static-method-zlibzipentrycreatestreamfilename-source-options) throws when its turn to serialize comes\nup, since draining its asynchronous source has no synchronous equivalent.\n\nAs with [`zlib.createZipArchive()`](#zlibcreateziparchiveentries-options), the entries are owned by the returned\niterator and must not be reused. If iteration stops early - including the\nthrow on a streaming entry - the entry that stopped it and every entry still\nqueued behind it are disposed, releasing any sources they hold.","summary":"The ZIP archive API is experimental. Using any part of it (this function among them) emits an experimental warning the first time; merely importing `node:zlib` does not.","examples":[],"children":[]},{"kind":"method","id":"zlibzipfilesfiles-options","name":"zipFiles","title":"`zlib.zipFiles(files[, options])`","scope":"module","overloadOf":null,"stability":{"index":"1.0","description":"Early development"},"added":["v26.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"files","type":{"text":"Iterable","links":[{"name":"Iterable","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#the_iterable_protocol","start":0,"end":8}]},"description":"of `[sourcePath, entryName]` string pairs. Any iterable\nworks — an array, a `Map`, the result of `Object.entries()`, a generator.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"options","type":{"text":"string | Object","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6},{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":9,"end":15}]},"description":"","default":null,"optional":true,"rest":false,"properties":[{"name":"followSymlinks","type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":"Resolve a symbolic link and archive the file it\npoints to, rather than storing the link itself.","default":"true","optional":true,"rest":false,"properties":[]},{"name":"comment","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"An archive comment; a string `options` is shorthand for\n`{ comment: options }`.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"baseOffset","type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"description":"See [`zlib.createZipArchive()`](#zlibcreateziparchiveentries-options).","default":null,"optional":false,"rest":false,"properties":[]}]}],"returns":{"type":{"text":"stream.Readable","links":[{"name":"stream.Readable","href":"stream.html#class-streamreadable","start":0,"end":15}]},"description":"of {Buffer} chunks making up the serialized\narchive."}},"description":"The ZIP archive API is experimental. Using any part of it (this function among\nthem) emits an experimental warning the first time; merely importing\n`node:zlib` does not.\n\nBuilds an archive from files on disk. For each `[sourcePath, entryName]` pair\nit reads `sourcePath` and adds an entry named `entryName`, capturing the file's\nUnix mode and modification time. A directory becomes a directory entry; a\nregular file's contents are streamed in (as a [`zlib.ZipEntry.createStream()`](#static-method-zlibzipentrycreatestreamfilename-source-options)\nentry) without being buffered in memory. Directory contents are not walked\nrecursively — list each path you want included.\n\nWhen `followSymlinks` is `true` (the default) a symbolic link is resolved and\narchived as its target file; when it is `false` the link itself is stored as a\nsymbolic-link entry whose content is the target path (see\n[`zlib.ZipEntry.createSymlink()`](#static-method-zlibzipentrycreatesymlinkfilename-target-options)).\n\n```mjs\nimport { zipFiles } from 'node:zlib';\nimport { createWriteStream } from 'node:fs';\nimport { pipeline } from 'node:stream/promises';\n\nawait pipeline(\n  zipFiles([\n    ['/data/report.pdf', 'report.pdf'],\n    ['/data/notes.txt', 'docs/notes.txt'],\n  ]),\n  createWriteStream('archive.zip'),\n);\n```","summary":"The ZIP archive API is experimental. Using any part of it (this function among them) emits an experimental warning the first time; merely importing `node:zlib` does not.","examples":[{"language":"mjs","displayName":null,"code":"import { zipFiles } from 'node:zlib';\nimport { createWriteStream } from 'node:fs';\nimport { pipeline } from 'node:stream/promises';\n\nawait pipeline(\n  zipFiles([\n    ['/data/report.pdf', 'report.pdf'],\n    ['/data/notes.txt', 'docs/notes.txt'],\n  ]),\n  createWriteStream('archive.zip'),\n);"}],"children":[]},{"kind":"method","id":"zlibcreatezstdcompressoptions","name":"createZstdCompress","title":"`zlib.createZstdCompress([options])`","scope":"module","overloadOf":null,"stability":{"index":"1","description":"Experimental"},"added":["v23.8.0","v22.15.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"options","type":{"text":"zstd options","links":[{"name":"zstd options","href":"zlib.html#class-zstdoptions","start":0,"end":12}]},"description":"","default":null,"optional":true,"rest":false,"properties":[]}],"returns":null},"description":"Creates and returns a new [`ZstdCompress`](#class-zlibzstdcompress) object.","summary":"Creates and returns a new `ZstdCompress` object.","examples":[],"children":[]},{"kind":"method","id":"zlibcreatezstddecompressoptions","name":"createZstdDecompress","title":"`zlib.createZstdDecompress([options])`","scope":"module","overloadOf":null,"stability":{"index":"1","description":"Experimental"},"added":["v23.8.0","v22.15.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"options","type":{"text":"zstd options","links":[{"name":"zstd options","href":"zlib.html#class-zstdoptions","start":0,"end":12}]},"description":"","default":null,"optional":true,"rest":false,"properties":[]}],"returns":null},"description":"Creates and returns a new [`ZstdDecompress`](#class-zlibzstddecompress) object.","summary":"Creates and returns a new `ZstdDecompress` object.","examples":[],"children":[]},{"kind":"method","id":"zlibgetmaxzipcontentsize","name":"getMaxZipContentSize","title":"`zlib.getMaxZipContentSize()`","scope":"module","overloadOf":null,"stability":{"index":"1.0","description":"Early development"},"added":["v26.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[],"returns":{"type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"description":""}},"description":"The ZIP archive API is experimental. Using any part of it (this function among\nthem) emits an experimental warning the first time; merely importing\n`node:zlib` does not.\n\nThe current default ceiling, in bytes, applied by [`zipEntry.content()`](#zipentrycontentoptions)\nwhen no explicit `maxSize` is given. **Default:** `268435456` (256 MiB).","summary":"The ZIP archive API is experimental. Using any part of it (this function among them) emits an experimental warning the first time; merely importing `node:zlib` does not.","examples":[],"children":[]},{"kind":"method","id":"zlibsetmaxzipcontentsizesize","name":"setMaxZipContentSize","title":"`zlib.setMaxZipContentSize(size)`","scope":"module","overloadOf":null,"stability":{"index":"1.0","description":"Early development"},"added":["v26.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"size","type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":null},"description":"The ZIP archive API is experimental. Using any part of it (this function among\nthem) emits an experimental warning the first time; merely importing\n`node:zlib` does not.\n\nSets the default ceiling used by [`zipEntry.content()`](#zipentrycontentoptions) when no explicit\n`maxSize` option is given. This is a guard against zip bombs: an archive\nwhose central directory declares a member larger than this is rejected\nbefore allocating memory for it. Streaming reads\n([`zipEntry.contentIterator()`](#zipentrycontentiteratoroptions), [`zipFile.stream()`](#zipfilestreamname-options)) are bounded-memory\nby design and are not affected by this setting.","summary":"The ZIP archive API is experimental. Using any part of it (this function among them) emits an experimental warning the first time; merely importing `node:zlib` does not.","examples":[],"children":[]},{"kind":"section","id":"convenience-methods","name":"Convenience methods","title":"Convenience methods","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"All of these take a {Buffer}, {TypedArray}, {DataView}, {ArrayBuffer}, or string\nas the first argument, an optional second argument\nto supply options to the `zlib` classes and will call the supplied callback\nwith `callback(error, result)`.\n\nEvery method has a `*Sync` counterpart, which accept the same arguments, but\nwithout a callback.","summary":"All of these take a {Buffer}, {TypedArray}, {DataView}, {ArrayBuffer}, or string as the first argument, an optional second argument to supply options to the `zlib` classes and will call the supplied callback with `callback(error, result)`.","examples":[],"children":[{"kind":"method","id":"zlibbrotlicompressbuffer-options-callback","name":"brotliCompress","title":"`zlib.brotliCompress(buffer[, options], callback)`","scope":"module","overloadOf":null,"stability":null,"added":["v11.7.0","v10.16.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"buffer","type":{"text":"Buffer | TypedArray | DataView | ArrayBuffer | string","links":[{"name":"Buffer","href":"buffer.html#class-buffer","start":0,"end":6},{"name":"TypedArray","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/TypedArray","start":9,"end":19},{"name":"DataView","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/DataView","start":22,"end":30},{"name":"ArrayBuffer","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer","start":33,"end":44},{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":47,"end":53}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"options","type":{"text":"brotli options","links":[{"name":"brotli options","href":"zlib.html#class-brotlioptions","start":0,"end":14}]},"description":"","default":null,"optional":true,"rest":false,"properties":[]},{"name":"callback","type":{"text":"Function","links":[{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":0,"end":8}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":null},"description":"","summary":"","examples":[],"children":[]},{"kind":"method","id":"zlibbrotlicompresssyncbuffer-options","name":"brotliCompressSync","title":"`zlib.brotliCompressSync(buffer[, options])`","scope":"module","overloadOf":null,"stability":null,"added":["v11.7.0","v10.16.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"buffer","type":{"text":"Buffer | TypedArray | DataView | ArrayBuffer | string","links":[{"name":"Buffer","href":"buffer.html#class-buffer","start":0,"end":6},{"name":"TypedArray","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/TypedArray","start":9,"end":19},{"name":"DataView","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/DataView","start":22,"end":30},{"name":"ArrayBuffer","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer","start":33,"end":44},{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":47,"end":53}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"options","type":{"text":"brotli options","links":[{"name":"brotli options","href":"zlib.html#class-brotlioptions","start":0,"end":14}]},"description":"","default":null,"optional":true,"rest":false,"properties":[]}],"returns":null},"description":"Compress a chunk of data with [`BrotliCompress`](#class-zlibbrotlicompress).","summary":"Compress a chunk of data with `BrotliCompress`.","examples":[],"children":[]},{"kind":"method","id":"zlibbrotlidecompressbuffer-options-callback","name":"brotliDecompress","title":"`zlib.brotliDecompress(buffer[, options], callback)`","scope":"module","overloadOf":null,"stability":null,"added":["v11.7.0","v10.16.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"buffer","type":{"text":"Buffer | TypedArray | DataView | ArrayBuffer | string","links":[{"name":"Buffer","href":"buffer.html#class-buffer","start":0,"end":6},{"name":"TypedArray","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/TypedArray","start":9,"end":19},{"name":"DataView","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/DataView","start":22,"end":30},{"name":"ArrayBuffer","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer","start":33,"end":44},{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":47,"end":53}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"options","type":{"text":"brotli options","links":[{"name":"brotli options","href":"zlib.html#class-brotlioptions","start":0,"end":14}]},"description":"","default":null,"optional":true,"rest":false,"properties":[]},{"name":"callback","type":{"text":"Function","links":[{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":0,"end":8}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":null},"description":"","summary":"","examples":[],"children":[]},{"kind":"method","id":"zlibbrotlidecompresssyncbuffer-options","name":"brotliDecompressSync","title":"`zlib.brotliDecompressSync(buffer[, options])`","scope":"module","overloadOf":null,"stability":null,"added":["v11.7.0","v10.16.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"buffer","type":{"text":"Buffer | TypedArray | DataView | ArrayBuffer | string","links":[{"name":"Buffer","href":"buffer.html#class-buffer","start":0,"end":6},{"name":"TypedArray","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/TypedArray","start":9,"end":19},{"name":"DataView","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/DataView","start":22,"end":30},{"name":"ArrayBuffer","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer","start":33,"end":44},{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":47,"end":53}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"options","type":{"text":"brotli options","links":[{"name":"brotli options","href":"zlib.html#class-brotlioptions","start":0,"end":14}]},"description":"","default":null,"optional":true,"rest":false,"properties":[]}],"returns":null},"description":"Decompress a chunk of data with [`BrotliDecompress`](#class-zlibbrotlidecompress).","summary":"Decompress a chunk of data with `BrotliDecompress`.","examples":[],"children":[]},{"kind":"method","id":"zlibdeflatebuffer-options-callback","name":"deflate","title":"`zlib.deflate(buffer[, options], callback)`","scope":"module","overloadOf":null,"stability":null,"added":["v0.6.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v9.4.0"],"prUrl":"https://github.com/nodejs/node/pull/16042","commit":null,"description":"The `buffer` parameter can be an `ArrayBuffer`."},{"versions":["v8.0.0"],"prUrl":"https://github.com/nodejs/node/pull/12223","commit":null,"description":"The `buffer` parameter can be any `TypedArray` or `DataView`."},{"versions":["v8.0.0"],"prUrl":"https://github.com/nodejs/node/pull/12001","commit":null,"description":"The `buffer` parameter can be an `Uint8Array` now."}],"signature":{"parameters":[{"name":"buffer","type":{"text":"Buffer | TypedArray | DataView | ArrayBuffer | string","links":[{"name":"Buffer","href":"buffer.html#class-buffer","start":0,"end":6},{"name":"TypedArray","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/TypedArray","start":9,"end":19},{"name":"DataView","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/DataView","start":22,"end":30},{"name":"ArrayBuffer","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer","start":33,"end":44},{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":47,"end":53}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"options","type":{"text":"zlib options","links":[{"name":"zlib options","href":"zlib.html#class-options","start":0,"end":12}]},"description":"","default":null,"optional":true,"rest":false,"properties":[]},{"name":"callback","type":{"text":"Function","links":[{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":0,"end":8}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":null},"description":"","summary":"","examples":[],"children":[]},{"kind":"method","id":"zlibdeflatesyncbuffer-options","name":"deflateSync","title":"`zlib.deflateSync(buffer[, options])`","scope":"module","overloadOf":null,"stability":null,"added":["v0.11.12"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v9.4.0"],"prUrl":"https://github.com/nodejs/node/pull/16042","commit":null,"description":"The `buffer` parameter can be an `ArrayBuffer`."},{"versions":["v8.0.0"],"prUrl":"https://github.com/nodejs/node/pull/12223","commit":null,"description":"The `buffer` parameter can be any `TypedArray` or `DataView`."},{"versions":["v8.0.0"],"prUrl":"https://github.com/nodejs/node/pull/12001","commit":null,"description":"The `buffer` parameter can be an `Uint8Array` now."}],"signature":{"parameters":[{"name":"buffer","type":{"text":"Buffer | TypedArray | DataView | ArrayBuffer | string","links":[{"name":"Buffer","href":"buffer.html#class-buffer","start":0,"end":6},{"name":"TypedArray","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/TypedArray","start":9,"end":19},{"name":"DataView","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/DataView","start":22,"end":30},{"name":"ArrayBuffer","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer","start":33,"end":44},{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":47,"end":53}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"options","type":{"text":"zlib options","links":[{"name":"zlib options","href":"zlib.html#class-options","start":0,"end":12}]},"description":"","default":null,"optional":true,"rest":false,"properties":[]}],"returns":null},"description":"Compress a chunk of data with [`Deflate`](#class-zlibdeflate).","summary":"Compress a chunk of data with `Deflate`.","examples":[],"children":[]},{"kind":"method","id":"zlibdeflaterawbuffer-options-callback","name":"deflateRaw","title":"`zlib.deflateRaw(buffer[, options], callback)`","scope":"module","overloadOf":null,"stability":null,"added":["v0.6.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v8.0.0"],"prUrl":"https://github.com/nodejs/node/pull/12223","commit":null,"description":"The `buffer` parameter can be any `TypedArray` or `DataView`."},{"versions":["v8.0.0"],"prUrl":"https://github.com/nodejs/node/pull/12001","commit":null,"description":"The `buffer` parameter can be an `Uint8Array` now."}],"signature":{"parameters":[{"name":"buffer","type":{"text":"Buffer | TypedArray | DataView | ArrayBuffer | string","links":[{"name":"Buffer","href":"buffer.html#class-buffer","start":0,"end":6},{"name":"TypedArray","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/TypedArray","start":9,"end":19},{"name":"DataView","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/DataView","start":22,"end":30},{"name":"ArrayBuffer","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer","start":33,"end":44},{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":47,"end":53}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"options","type":{"text":"zlib options","links":[{"name":"zlib options","href":"zlib.html#class-options","start":0,"end":12}]},"description":"","default":null,"optional":true,"rest":false,"properties":[]},{"name":"callback","type":{"text":"Function","links":[{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":0,"end":8}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":null},"description":"","summary":"","examples":[],"children":[]},{"kind":"method","id":"zlibdeflaterawsyncbuffer-options","name":"deflateRawSync","title":"`zlib.deflateRawSync(buffer[, options])`","scope":"module","overloadOf":null,"stability":null,"added":["v0.11.12"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v9.4.0"],"prUrl":"https://github.com/nodejs/node/pull/16042","commit":null,"description":"The `buffer` parameter can be an `ArrayBuffer`."},{"versions":["v8.0.0"],"prUrl":"https://github.com/nodejs/node/pull/12223","commit":null,"description":"The `buffer` parameter can be any `TypedArray` or `DataView`."},{"versions":["v8.0.0"],"prUrl":"https://github.com/nodejs/node/pull/12001","commit":null,"description":"The `buffer` parameter can be an `Uint8Array` now."}],"signature":{"parameters":[{"name":"buffer","type":{"text":"Buffer | TypedArray | DataView | ArrayBuffer | string","links":[{"name":"Buffer","href":"buffer.html#class-buffer","start":0,"end":6},{"name":"TypedArray","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/TypedArray","start":9,"end":19},{"name":"DataView","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/DataView","start":22,"end":30},{"name":"ArrayBuffer","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer","start":33,"end":44},{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":47,"end":53}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"options","type":{"text":"zlib options","links":[{"name":"zlib options","href":"zlib.html#class-options","start":0,"end":12}]},"description":"","default":null,"optional":true,"rest":false,"properties":[]}],"returns":null},"description":"Compress a chunk of data with [`DeflateRaw`](#class-zlibdeflateraw).","summary":"Compress a chunk of data with `DeflateRaw`.","examples":[],"children":[]},{"kind":"method","id":"zlibgunzipbuffer-options-callback","name":"gunzip","title":"`zlib.gunzip(buffer[, options], callback)`","scope":"module","overloadOf":null,"stability":null,"added":["v0.6.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v9.4.0"],"prUrl":"https://github.com/nodejs/node/pull/16042","commit":null,"description":"The `buffer` parameter can be an `ArrayBuffer`."},{"versions":["v8.0.0"],"prUrl":"https://github.com/nodejs/node/pull/12223","commit":null,"description":"The `buffer` parameter can be any `TypedArray` or `DataView`."},{"versions":["v8.0.0"],"prUrl":"https://github.com/nodejs/node/pull/12001","commit":null,"description":"The `buffer` parameter can be an `Uint8Array` now."}],"signature":{"parameters":[{"name":"buffer","type":{"text":"Buffer | TypedArray | DataView | ArrayBuffer | string","links":[{"name":"Buffer","href":"buffer.html#class-buffer","start":0,"end":6},{"name":"TypedArray","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/TypedArray","start":9,"end":19},{"name":"DataView","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/DataView","start":22,"end":30},{"name":"ArrayBuffer","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer","start":33,"end":44},{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":47,"end":53}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"options","type":{"text":"zlib options","links":[{"name":"zlib options","href":"zlib.html#class-options","start":0,"end":12}]},"description":"","default":null,"optional":true,"rest":false,"properties":[]},{"name":"callback","type":{"text":"Function","links":[{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":0,"end":8}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":null},"description":"","summary":"","examples":[],"children":[]},{"kind":"method","id":"zlibgunzipsyncbuffer-options","name":"gunzipSync","title":"`zlib.gunzipSync(buffer[, options])`","scope":"module","overloadOf":null,"stability":null,"added":["v0.11.12"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v9.4.0"],"prUrl":"https://github.com/nodejs/node/pull/16042","commit":null,"description":"The `buffer` parameter can be an `ArrayBuffer`."},{"versions":["v8.0.0"],"prUrl":"https://github.com/nodejs/node/pull/12223","commit":null,"description":"The `buffer` parameter can be any `TypedArray` or `DataView`."},{"versions":["v8.0.0"],"prUrl":"https://github.com/nodejs/node/pull/12001","commit":null,"description":"The `buffer` parameter can be an `Uint8Array` now."}],"signature":{"parameters":[{"name":"buffer","type":{"text":"Buffer | TypedArray | DataView | ArrayBuffer | string","links":[{"name":"Buffer","href":"buffer.html#class-buffer","start":0,"end":6},{"name":"TypedArray","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/TypedArray","start":9,"end":19},{"name":"DataView","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/DataView","start":22,"end":30},{"name":"ArrayBuffer","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer","start":33,"end":44},{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":47,"end":53}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"options","type":{"text":"zlib options","links":[{"name":"zlib options","href":"zlib.html#class-options","start":0,"end":12}]},"description":"","default":null,"optional":true,"rest":false,"properties":[]}],"returns":null},"description":"Decompress a chunk of data with [`Gunzip`](#class-zlibgunzip).","summary":"Decompress a chunk of data with `Gunzip`.","examples":[],"children":[]},{"kind":"method","id":"zlibgzipbuffer-options-callback","name":"gzip","title":"`zlib.gzip(buffer[, options], callback)`","scope":"module","overloadOf":null,"stability":null,"added":["v0.6.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v9.4.0"],"prUrl":"https://github.com/nodejs/node/pull/16042","commit":null,"description":"The `buffer` parameter can be an `ArrayBuffer`."},{"versions":["v8.0.0"],"prUrl":"https://github.com/nodejs/node/pull/12223","commit":null,"description":"The `buffer` parameter can be any `TypedArray` or `DataView`."},{"versions":["v8.0.0"],"prUrl":"https://github.com/nodejs/node/pull/12001","commit":null,"description":"The `buffer` parameter can be an `Uint8Array` now."}],"signature":{"parameters":[{"name":"buffer","type":{"text":"Buffer | TypedArray | DataView | ArrayBuffer | string","links":[{"name":"Buffer","href":"buffer.html#class-buffer","start":0,"end":6},{"name":"TypedArray","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/TypedArray","start":9,"end":19},{"name":"DataView","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/DataView","start":22,"end":30},{"name":"ArrayBuffer","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer","start":33,"end":44},{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":47,"end":53}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"options","type":{"text":"zlib options","links":[{"name":"zlib options","href":"zlib.html#class-options","start":0,"end":12}]},"description":"","default":null,"optional":true,"rest":false,"properties":[]},{"name":"callback","type":{"text":"Function","links":[{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":0,"end":8}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":null},"description":"","summary":"","examples":[],"children":[]},{"kind":"method","id":"zlibgzipsyncbuffer-options","name":"gzipSync","title":"`zlib.gzipSync(buffer[, options])`","scope":"module","overloadOf":null,"stability":null,"added":["v0.11.12"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v9.4.0"],"prUrl":"https://github.com/nodejs/node/pull/16042","commit":null,"description":"The `buffer` parameter can be an `ArrayBuffer`."},{"versions":["v8.0.0"],"prUrl":"https://github.com/nodejs/node/pull/12223","commit":null,"description":"The `buffer` parameter can be any `TypedArray` or `DataView`."},{"versions":["v8.0.0"],"prUrl":"https://github.com/nodejs/node/pull/12001","commit":null,"description":"The `buffer` parameter can be an `Uint8Array` now."}],"signature":{"parameters":[{"name":"buffer","type":{"text":"Buffer | TypedArray | DataView | ArrayBuffer | string","links":[{"name":"Buffer","href":"buffer.html#class-buffer","start":0,"end":6},{"name":"TypedArray","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/TypedArray","start":9,"end":19},{"name":"DataView","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/DataView","start":22,"end":30},{"name":"ArrayBuffer","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer","start":33,"end":44},{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":47,"end":53}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"options","type":{"text":"zlib options","links":[{"name":"zlib options","href":"zlib.html#class-options","start":0,"end":12}]},"description":"","default":null,"optional":true,"rest":false,"properties":[]}],"returns":null},"description":"Compress a chunk of data with [`Gzip`](#class-zlibgzip).","summary":"Compress a chunk of data with `Gzip`.","examples":[],"children":[]},{"kind":"method","id":"zlibinflatebuffer-options-callback","name":"inflate","title":"`zlib.inflate(buffer[, options], callback)`","scope":"module","overloadOf":null,"stability":null,"added":["v0.6.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v9.4.0"],"prUrl":"https://github.com/nodejs/node/pull/16042","commit":null,"description":"The `buffer` parameter can be an `ArrayBuffer`."},{"versions":["v8.0.0"],"prUrl":"https://github.com/nodejs/node/pull/12223","commit":null,"description":"The `buffer` parameter can be any `TypedArray` or `DataView`."},{"versions":["v8.0.0"],"prUrl":"https://github.com/nodejs/node/pull/12001","commit":null,"description":"The `buffer` parameter can be an `Uint8Array` now."}],"signature":{"parameters":[{"name":"buffer","type":{"text":"Buffer | TypedArray | DataView | ArrayBuffer | string","links":[{"name":"Buffer","href":"buffer.html#class-buffer","start":0,"end":6},{"name":"TypedArray","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/TypedArray","start":9,"end":19},{"name":"DataView","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/DataView","start":22,"end":30},{"name":"ArrayBuffer","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer","start":33,"end":44},{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":47,"end":53}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"options","type":{"text":"zlib options","links":[{"name":"zlib options","href":"zlib.html#class-options","start":0,"end":12}]},"description":"","default":null,"optional":true,"rest":false,"properties":[]},{"name":"callback","type":{"text":"Function","links":[{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":0,"end":8}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":null},"description":"","summary":"","examples":[],"children":[]},{"kind":"method","id":"zlibinflatesyncbuffer-options","name":"inflateSync","title":"`zlib.inflateSync(buffer[, options])`","scope":"module","overloadOf":null,"stability":null,"added":["v0.11.12"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v9.4.0"],"prUrl":"https://github.com/nodejs/node/pull/16042","commit":null,"description":"The `buffer` parameter can be an `ArrayBuffer`."},{"versions":["v8.0.0"],"prUrl":"https://github.com/nodejs/node/pull/12223","commit":null,"description":"The `buffer` parameter can be any `TypedArray` or `DataView`."},{"versions":["v8.0.0"],"prUrl":"https://github.com/nodejs/node/pull/12001","commit":null,"description":"The `buffer` parameter can be an `Uint8Array` now."}],"signature":{"parameters":[{"name":"buffer","type":{"text":"Buffer | TypedArray | DataView | ArrayBuffer | string","links":[{"name":"Buffer","href":"buffer.html#class-buffer","start":0,"end":6},{"name":"TypedArray","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/TypedArray","start":9,"end":19},{"name":"DataView","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/DataView","start":22,"end":30},{"name":"ArrayBuffer","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer","start":33,"end":44},{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":47,"end":53}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"options","type":{"text":"zlib options","links":[{"name":"zlib options","href":"zlib.html#class-options","start":0,"end":12}]},"description":"","default":null,"optional":true,"rest":false,"properties":[]}],"returns":null},"description":"Decompress a chunk of data with [`Inflate`](#class-zlibinflate).","summary":"Decompress a chunk of data with `Inflate`.","examples":[],"children":[]},{"kind":"method","id":"zlibinflaterawbuffer-options-callback","name":"inflateRaw","title":"`zlib.inflateRaw(buffer[, options], callback)`","scope":"module","overloadOf":null,"stability":null,"added":["v0.6.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v9.4.0"],"prUrl":"https://github.com/nodejs/node/pull/16042","commit":null,"description":"The `buffer` parameter can be an `ArrayBuffer`."},{"versions":["v8.0.0"],"prUrl":"https://github.com/nodejs/node/pull/12223","commit":null,"description":"The `buffer` parameter can be any `TypedArray` or `DataView`."},{"versions":["v8.0.0"],"prUrl":"https://github.com/nodejs/node/pull/12001","commit":null,"description":"The `buffer` parameter can be an `Uint8Array` now."}],"signature":{"parameters":[{"name":"buffer","type":{"text":"Buffer | TypedArray | DataView | ArrayBuffer | string","links":[{"name":"Buffer","href":"buffer.html#class-buffer","start":0,"end":6},{"name":"TypedArray","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/TypedArray","start":9,"end":19},{"name":"DataView","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/DataView","start":22,"end":30},{"name":"ArrayBuffer","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer","start":33,"end":44},{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":47,"end":53}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"options","type":{"text":"zlib options","links":[{"name":"zlib options","href":"zlib.html#class-options","start":0,"end":12}]},"description":"","default":null,"optional":true,"rest":false,"properties":[]},{"name":"callback","type":{"text":"Function","links":[{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":0,"end":8}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":null},"description":"","summary":"","examples":[],"children":[]},{"kind":"method","id":"zlibinflaterawsyncbuffer-options","name":"inflateRawSync","title":"`zlib.inflateRawSync(buffer[, options])`","scope":"module","overloadOf":null,"stability":null,"added":["v0.11.12"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v9.4.0"],"prUrl":"https://github.com/nodejs/node/pull/16042","commit":null,"description":"The `buffer` parameter can be an `ArrayBuffer`."},{"versions":["v8.0.0"],"prUrl":"https://github.com/nodejs/node/pull/12223","commit":null,"description":"The `buffer` parameter can be any `TypedArray` or `DataView`."},{"versions":["v8.0.0"],"prUrl":"https://github.com/nodejs/node/pull/12001","commit":null,"description":"The `buffer` parameter can be an `Uint8Array` now."}],"signature":{"parameters":[{"name":"buffer","type":{"text":"Buffer | TypedArray | DataView | ArrayBuffer | string","links":[{"name":"Buffer","href":"buffer.html#class-buffer","start":0,"end":6},{"name":"TypedArray","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/TypedArray","start":9,"end":19},{"name":"DataView","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/DataView","start":22,"end":30},{"name":"ArrayBuffer","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer","start":33,"end":44},{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":47,"end":53}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"options","type":{"text":"zlib options","links":[{"name":"zlib options","href":"zlib.html#class-options","start":0,"end":12}]},"description":"","default":null,"optional":true,"rest":false,"properties":[]}],"returns":null},"description":"Decompress a chunk of data with [`InflateRaw`](#class-zlibinflateraw).","summary":"Decompress a chunk of data with `InflateRaw`.","examples":[],"children":[]},{"kind":"method","id":"zlibunzipbuffer-options-callback","name":"unzip","title":"`zlib.unzip(buffer[, options], callback)`","scope":"module","overloadOf":null,"stability":null,"added":["v0.6.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v9.4.0"],"prUrl":"https://github.com/nodejs/node/pull/16042","commit":null,"description":"The `buffer` parameter can be an `ArrayBuffer`."},{"versions":["v8.0.0"],"prUrl":"https://github.com/nodejs/node/pull/12223","commit":null,"description":"The `buffer` parameter can be any `TypedArray` or `DataView`."},{"versions":["v8.0.0"],"prUrl":"https://github.com/nodejs/node/pull/12001","commit":null,"description":"The `buffer` parameter can be an `Uint8Array` now."}],"signature":{"parameters":[{"name":"buffer","type":{"text":"Buffer | TypedArray | DataView | ArrayBuffer | string","links":[{"name":"Buffer","href":"buffer.html#class-buffer","start":0,"end":6},{"name":"TypedArray","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/TypedArray","start":9,"end":19},{"name":"DataView","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/DataView","start":22,"end":30},{"name":"ArrayBuffer","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer","start":33,"end":44},{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":47,"end":53}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"options","type":{"text":"zlib options","links":[{"name":"zlib options","href":"zlib.html#class-options","start":0,"end":12}]},"description":"","default":null,"optional":true,"rest":false,"properties":[]},{"name":"callback","type":{"text":"Function","links":[{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":0,"end":8}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":null},"description":"","summary":"","examples":[],"children":[]},{"kind":"method","id":"zlibunzipsyncbuffer-options","name":"unzipSync","title":"`zlib.unzipSync(buffer[, options])`","scope":"module","overloadOf":null,"stability":null,"added":["v0.11.12"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v9.4.0"],"prUrl":"https://github.com/nodejs/node/pull/16042","commit":null,"description":"The `buffer` parameter can be an `ArrayBuffer`."},{"versions":["v8.0.0"],"prUrl":"https://github.com/nodejs/node/pull/12223","commit":null,"description":"The `buffer` parameter can be any `TypedArray` or `DataView`."},{"versions":["v8.0.0"],"prUrl":"https://github.com/nodejs/node/pull/12001","commit":null,"description":"The `buffer` parameter can be an `Uint8Array` now."}],"signature":{"parameters":[{"name":"buffer","type":{"text":"Buffer | TypedArray | DataView | ArrayBuffer | string","links":[{"name":"Buffer","href":"buffer.html#class-buffer","start":0,"end":6},{"name":"TypedArray","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/TypedArray","start":9,"end":19},{"name":"DataView","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/DataView","start":22,"end":30},{"name":"ArrayBuffer","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer","start":33,"end":44},{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":47,"end":53}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"options","type":{"text":"zlib options","links":[{"name":"zlib options","href":"zlib.html#class-options","start":0,"end":12}]},"description":"","default":null,"optional":true,"rest":false,"properties":[]}],"returns":null},"description":"Decompress a chunk of data with [`Unzip`](#class-zlibunzip).","summary":"Decompress a chunk of data with `Unzip`.","examples":[],"children":[]},{"kind":"method","id":"zlibzstdcompressbuffer-options-callback","name":"zstdCompress","title":"`zlib.zstdCompress(buffer[, options], callback)`","scope":"module","overloadOf":null,"stability":{"index":"1","description":"Experimental"},"added":["v23.8.0","v22.15.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"buffer","type":{"text":"Buffer | TypedArray | DataView | ArrayBuffer | string","links":[{"name":"Buffer","href":"buffer.html#class-buffer","start":0,"end":6},{"name":"TypedArray","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/TypedArray","start":9,"end":19},{"name":"DataView","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/DataView","start":22,"end":30},{"name":"ArrayBuffer","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer","start":33,"end":44},{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":47,"end":53}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"options","type":{"text":"zstd options","links":[{"name":"zstd options","href":"zlib.html#class-zstdoptions","start":0,"end":12}]},"description":"","default":null,"optional":true,"rest":false,"properties":[]},{"name":"callback","type":{"text":"Function","links":[{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":0,"end":8}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":null},"description":"","summary":"","examples":[],"children":[]},{"kind":"method","id":"zlibzstdcompresssyncbuffer-options","name":"zstdCompressSync","title":"`zlib.zstdCompressSync(buffer[, options])`","scope":"module","overloadOf":null,"stability":{"index":"1","description":"Experimental"},"added":["v23.8.0","v22.15.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"buffer","type":{"text":"Buffer | TypedArray | DataView | ArrayBuffer | string","links":[{"name":"Buffer","href":"buffer.html#class-buffer","start":0,"end":6},{"name":"TypedArray","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/TypedArray","start":9,"end":19},{"name":"DataView","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/DataView","start":22,"end":30},{"name":"ArrayBuffer","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer","start":33,"end":44},{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":47,"end":53}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"options","type":{"text":"zstd options","links":[{"name":"zstd options","href":"zlib.html#class-zstdoptions","start":0,"end":12}]},"description":"","default":null,"optional":true,"rest":false,"properties":[]}],"returns":null},"description":"Compress a chunk of data with [`ZstdCompress`](#class-zlibzstdcompress).","summary":"Compress a chunk of data with `ZstdCompress`.","examples":[],"children":[]},{"kind":"method","id":"zlibzstddecompressbuffer-options-callback","name":"zstdDecompress","title":"`zlib.zstdDecompress(buffer[, options], callback)`","scope":"module","overloadOf":null,"stability":null,"added":["v23.8.0","v22.15.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"buffer","type":{"text":"Buffer | TypedArray | DataView | ArrayBuffer | string","links":[{"name":"Buffer","href":"buffer.html#class-buffer","start":0,"end":6},{"name":"TypedArray","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/TypedArray","start":9,"end":19},{"name":"DataView","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/DataView","start":22,"end":30},{"name":"ArrayBuffer","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer","start":33,"end":44},{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":47,"end":53}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"options","type":{"text":"zstd options","links":[{"name":"zstd options","href":"zlib.html#class-zstdoptions","start":0,"end":12}]},"description":"","default":null,"optional":true,"rest":false,"properties":[]},{"name":"callback","type":{"text":"Function","links":[{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":0,"end":8}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":null},"description":"","summary":"","examples":[],"children":[]},{"kind":"method","id":"zlibzstddecompresssyncbuffer-options","name":"zstdDecompressSync","title":"`zlib.zstdDecompressSync(buffer[, options])`","scope":"module","overloadOf":null,"stability":{"index":"1","description":"Experimental"},"added":["v23.8.0","v22.15.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"buffer","type":{"text":"Buffer | TypedArray | DataView | ArrayBuffer | string","links":[{"name":"Buffer","href":"buffer.html#class-buffer","start":0,"end":6},{"name":"TypedArray","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/TypedArray","start":9,"end":19},{"name":"DataView","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/DataView","start":22,"end":30},{"name":"ArrayBuffer","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer","start":33,"end":44},{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":47,"end":53}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"options","type":{"text":"zstd options","links":[{"name":"zstd options","href":"zlib.html#class-zstdoptions","start":0,"end":12}]},"description":"","default":null,"optional":true,"rest":false,"properties":[]}],"returns":null},"description":"Decompress a chunk of data with [`ZstdDecompress`](#class-zlibzstddecompress).","summary":"Decompress a chunk of data with `ZstdDecompress`.","examples":[],"children":[]}]},{"kind":"section","id":"iterable-compression","name":"Iterable Compression","title":"Iterable Compression","scope":"module","overloadOf":null,"stability":{"index":"1","description":"Experimental"},"added":["v25.9.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"The `node:zlib/iter` module provides compression and decompression transforms\nfor use with the [`node:stream/iter`](stream_iter.html) iterable streams API.\n\nThis module is available only when the `--experimental-stream-iter` CLI flag\nis enabled.\n\nEach algorithm has both an async variant (stateful async generator, for use\nwith [`pull()`](stream_iter.html#pullsource-transforms-options) and [`pipeTo()`](stream_iter.html#pipetosource-transforms-writer-options)) and a sync variant (stateful sync\ngenerator, for use with `pullSync()` and `pipeToSync()`).\n\nThe async transforms run compression on the libuv threadpool, overlapping\nI/O with JavaScript execution. The sync transforms run compression directly\non the main thread.\n\n> Note: The defaults for these transforms are tuned for streaming throughput,\n> and differ from the defaults in `node:zlib`. In particular, gzip/deflate\n> default to level 4 (not 6) and memLevel 9 (not 8), and Brotli defaults to\n> quality 6 (not 11). These choices match common HTTP server configurations\n> and provide significantly faster compression with only a small reduction in\n> compression ratio. All defaults can be overridden via options.\n\n```mjs\nimport { from, pull, bytes, text } from 'node:stream/iter';\nimport { compressGzip, decompressGzip } from 'node:zlib/iter';\n\n// Async round-trip\nconst compressed = await bytes(pull(from('hello'), compressGzip()));\nconst original = await text(pull(from(compressed), decompressGzip()));\nconsole.log(original); // 'hello'\n```\n\n```cjs\nconst { from, pull, bytes, text } = require('node:stream/iter');\nconst { compressGzip, decompressGzip } = require('node:zlib/iter');\n\nasync function run() {\n  const compressed = await bytes(pull(from('hello'), compressGzip()));\n  const original = await text(pull(from(compressed), decompressGzip()));\n  console.log(original); // 'hello'\n}\n\nrun().catch(console.error);\n```\n\n```mjs\nimport { fromSync, pullSync, textSync } from 'node:stream/iter';\nimport { compressGzipSync, decompressGzipSync } from 'node:zlib/iter';\n\n// Sync round-trip\nconst compressed = pullSync(fromSync('hello'), compressGzipSync());\nconst original = textSync(pullSync(compressed, decompressGzipSync()));\nconsole.log(original); // 'hello'\n```\n\n```cjs\nconst { fromSync, pullSync, textSync } = require('node:stream/iter');\nconst { compressGzipSync, decompressGzipSync } = require('node:zlib/iter');\n\nconst compressed = pullSync(fromSync('hello'), compressGzipSync());\nconst original = textSync(pullSync(compressed, decompressGzipSync()));\nconsole.log(original); // 'hello'\n```","summary":"The `node:zlib/iter` module provides compression and decompression transforms for use with the `node:stream/iter` iterable streams API.","examples":[{"language":"mjs","displayName":null,"code":"import { from, pull, bytes, text } from 'node:stream/iter';\nimport { compressGzip, decompressGzip } from 'node:zlib/iter';\n\n// Async round-trip\nconst compressed = await bytes(pull(from('hello'), compressGzip()));\nconst original = await text(pull(from(compressed), decompressGzip()));\nconsole.log(original); // 'hello'"},{"language":"cjs","displayName":null,"code":"const { from, pull, bytes, text } = require('node:stream/iter');\nconst { compressGzip, decompressGzip } = require('node:zlib/iter');\n\nasync function run() {\n  const compressed = await bytes(pull(from('hello'), compressGzip()));\n  const original = await text(pull(from(compressed), decompressGzip()));\n  console.log(original); // 'hello'\n}\n\nrun().catch(console.error);"},{"language":"mjs","displayName":null,"code":"import { fromSync, pullSync, textSync } from 'node:stream/iter';\nimport { compressGzipSync, decompressGzipSync } from 'node:zlib/iter';\n\n// Sync round-trip\nconst compressed = pullSync(fromSync('hello'), compressGzipSync());\nconst original = textSync(pullSync(compressed, decompressGzipSync()));\nconsole.log(original); // 'hello'"},{"language":"cjs","displayName":null,"code":"const { fromSync, pullSync, textSync } = require('node:stream/iter');\nconst { compressGzipSync, decompressGzipSync } = require('node:zlib/iter');\n\nconst compressed = pullSync(fromSync('hello'), compressGzipSync());\nconst original = textSync(pullSync(compressed, decompressGzipSync()));\nconsole.log(original); // 'hello'"}],"children":[{"kind":"method","id":"compressbrotlioptions","name":"compressBrotli","title":"`compressBrotli([options])`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"options","type":null,"description":"","default":null,"optional":true,"rest":false,"properties":[]}],"returns":null},"description":"","summary":"","examples":[],"children":[]},{"kind":"method","id":"compressbrotlisyncoptions","name":"compressBrotliSync","title":"`compressBrotliSync([options])`","scope":"module","overloadOf":null,"stability":null,"added":["v25.9.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"options","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"","default":null,"optional":true,"rest":false,"properties":[{"name":"chunkSize","type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"description":"Output buffer size.","default":"`65536` (64 KB)","optional":true,"rest":false,"properties":[]},{"name":"params","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"Key-value object where keys and values are\n`zlib.constants` entries. The most important compressor parameters are:","default":null,"optional":false,"rest":false,"properties":[{"name":"BROTLI_PARAM_MODE","type":null,"description":"`BROTLI_MODE_GENERIC` (default),\n`BROTLI_MODE_TEXT`, or `BROTLI_MODE_FONT`.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"BROTLI_PARAM_QUALITY","type":null,"description":"ranges from `BROTLI_MIN_QUALITY` to\n`BROTLI_MAX_QUALITY`.","default":"`6` (not `BROTLI_DEFAULT_QUALITY` which is 11). Quality 6 is appropriate for streaming; quality 11 is intended for offline/build-time compression","optional":true,"rest":false,"properties":[]},{"name":"BROTLI_PARAM_SIZE_HINT","type":null,"description":"expected input size.","default":"`0` (unknown)","optional":true,"rest":false,"properties":[]},{"name":"BROTLI_PARAM_LGWIN","type":null,"description":"window size (log2).","default":"`20` (1 MB). The Brotli library default is 22 (4 MB); the reduced default saves memory without significant compression impact for streaming workloads","optional":true,"rest":false,"properties":[]},{"name":"BROTLI_PARAM_LGBLOCK","type":null,"description":"input block size (log2).\nSee the [Brotli compressor options](#compressor-options) in the zlib documentation for the\nfull list.","default":null,"optional":false,"rest":false,"properties":[]}]},{"name":"dictionary","type":{"text":"Buffer | TypedArray | DataView","links":[{"name":"Buffer","href":"buffer.html#class-buffer","start":0,"end":6},{"name":"TypedArray","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/TypedArray","start":9,"end":19},{"name":"DataView","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/DataView","start":22,"end":30}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}]}],"returns":{"type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"A stateful transform."}},"description":"Create a Brotli compression transform. Output is compatible with\n`zlib.brotliDecompress()` and `decompressBrotli()`/`decompressBrotliSync()`.","summary":"Create a Brotli compression transform. Output is compatible with `zlib.brotliDecompress()` and `decompressBrotli()`/`decompressBrotliSync()`.","examples":[],"children":[]},{"kind":"method","id":"compressdeflateoptions","name":"compressDeflate","title":"`compressDeflate([options])`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"options","type":null,"description":"","default":null,"optional":true,"rest":false,"properties":[]}],"returns":null},"description":"","summary":"","examples":[],"children":[]},{"kind":"method","id":"compressdeflatesyncoptions","name":"compressDeflateSync","title":"`compressDeflateSync([options])`","scope":"module","overloadOf":null,"stability":null,"added":["v25.9.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"options","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"","default":null,"optional":true,"rest":false,"properties":[{"name":"chunkSize","type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"description":"Output buffer size.","default":"`65536` (64 KB)","optional":true,"rest":false,"properties":[]},{"name":"level","type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"description":"Compression level (`0`-`9`).","default":"4","optional":true,"rest":false,"properties":[]},{"name":"windowBits","type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"description":"","default":"`Z_DEFAULT_WINDOWBITS` (15)","optional":true,"rest":false,"properties":[]},{"name":"memLevel","type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"description":"","default":"9","optional":true,"rest":false,"properties":[]},{"name":"strategy","type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"description":"","default":"Z_DEFAULT_STRATEGY","optional":true,"rest":false,"properties":[]},{"name":"dictionary","type":{"text":"Buffer | TypedArray | DataView","links":[{"name":"Buffer","href":"buffer.html#class-buffer","start":0,"end":6},{"name":"TypedArray","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/TypedArray","start":9,"end":19},{"name":"DataView","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/DataView","start":22,"end":30}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}]}],"returns":{"type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"A stateful transform."}},"description":"Create a deflate compression transform. Output is compatible with\n`zlib.inflate()` and `decompressDeflate()`/`decompressDeflateSync()`.","summary":"Create a deflate compression transform. Output is compatible with `zlib.inflate()` and `decompressDeflate()`/`decompressDeflateSync()`.","examples":[],"children":[]},{"kind":"method","id":"compressgzipoptions","name":"compressGzip","title":"`compressGzip([options])`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"options","type":null,"description":"","default":null,"optional":true,"rest":false,"properties":[]}],"returns":null},"description":"","summary":"","examples":[],"children":[]},{"kind":"method","id":"compressgzipsyncoptions","name":"compressGzipSync","title":"`compressGzipSync([options])`","scope":"module","overloadOf":null,"stability":null,"added":["v25.9.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"options","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"","default":null,"optional":true,"rest":false,"properties":[{"name":"chunkSize","type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"description":"Output buffer size.","default":"`65536` (64 KB)","optional":true,"rest":false,"properties":[]},{"name":"level","type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"description":"Compression level (`0`-`9`).","default":"4","optional":true,"rest":false,"properties":[]},{"name":"windowBits","type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"description":"","default":"`Z_DEFAULT_WINDOWBITS` (15)","optional":true,"rest":false,"properties":[]},{"name":"memLevel","type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"description":"","default":"9","optional":true,"rest":false,"properties":[]},{"name":"strategy","type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"description":"","default":"Z_DEFAULT_STRATEGY","optional":true,"rest":false,"properties":[]},{"name":"dictionary","type":{"text":"Buffer | TypedArray | DataView","links":[{"name":"Buffer","href":"buffer.html#class-buffer","start":0,"end":6},{"name":"TypedArray","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/TypedArray","start":9,"end":19},{"name":"DataView","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/DataView","start":22,"end":30}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}]}],"returns":{"type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"A stateful transform."}},"description":"Create a gzip compression transform. Output is compatible with `zlib.gunzip()`\nand `decompressGzip()`/`decompressGzipSync()`.","summary":"Create a gzip compression transform. Output is compatible with `zlib.gunzip()` and `decompressGzip()`/`decompressGzipSync()`.","examples":[],"children":[]},{"kind":"method","id":"compresszstdoptions","name":"compressZstd","title":"`compressZstd([options])`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"options","type":null,"description":"","default":null,"optional":true,"rest":false,"properties":[]}],"returns":null},"description":"","summary":"","examples":[],"children":[]},{"kind":"method","id":"compresszstdsyncoptions","name":"compressZstdSync","title":"`compressZstdSync([options])`","scope":"module","overloadOf":null,"stability":null,"added":["v25.9.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"options","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"","default":null,"optional":true,"rest":false,"properties":[{"name":"chunkSize","type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"description":"Output buffer size.","default":"`65536` (64 KB)","optional":true,"rest":false,"properties":[]},{"name":"params","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"Key-value object where keys and values are\n`zlib.constants` entries. The most important compressor parameters are:","default":null,"optional":false,"rest":false,"properties":[{"name":"ZSTD_c_compressionLevel","type":null,"description":"","default":"`ZSTD_CLEVEL_DEFAULT` (3)","optional":true,"rest":false,"properties":[]},{"name":"ZSTD_c_checksumFlag","type":null,"description":"generate a checksum.","default":"0","optional":true,"rest":false,"properties":[]},{"name":"ZSTD_c_strategy","type":null,"description":"compression strategy. Values include\n`ZSTD_fast`, `ZSTD_dfast`, `ZSTD_greedy`, `ZSTD_lazy`,\n`ZSTD_lazy2`, `ZSTD_btlazy2`, `ZSTD_btopt`, `ZSTD_btultra`,\n`ZSTD_btultra2`.\nSee the [Zstd compressor options](#compressor-options-1) in the zlib documentation for the\nfull list.","default":null,"optional":false,"rest":false,"properties":[]}]},{"name":"pledgedSrcSize","type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"description":"Expected uncompressed size as a non-negative safe\ninteger (optional hint).","default":null,"optional":false,"rest":false,"properties":[]},{"name":"dictionary","type":{"text":"Buffer | TypedArray | DataView","links":[{"name":"Buffer","href":"buffer.html#class-buffer","start":0,"end":6},{"name":"TypedArray","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/TypedArray","start":9,"end":19},{"name":"DataView","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/DataView","start":22,"end":30}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}]}],"returns":{"type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"A stateful transform."}},"description":"Create a Zstandard compression transform. Output is compatible with\n`zlib.zstdDecompress()` and `decompressZstd()`/`decompressZstdSync()`.","summary":"Create a Zstandard compression transform. Output is compatible with `zlib.zstdDecompress()` and `decompressZstd()`/`decompressZstdSync()`.","examples":[],"children":[]},{"kind":"method","id":"decompressbrotlioptions","name":"decompressBrotli","title":"`decompressBrotli([options])`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"options","type":null,"description":"","default":null,"optional":true,"rest":false,"properties":[]}],"returns":null},"description":"","summary":"","examples":[],"children":[]},{"kind":"method","id":"decompressbrotlisyncoptions","name":"decompressBrotliSync","title":"`decompressBrotliSync([options])`","scope":"module","overloadOf":null,"stability":null,"added":["v25.9.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"options","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"","default":null,"optional":true,"rest":false,"properties":[{"name":"chunkSize","type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"description":"Output buffer size.","default":"`65536` (64 KB)","optional":true,"rest":false,"properties":[]},{"name":"params","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"Key-value object where keys and values are\n`zlib.constants` entries. Available decompressor parameters:","default":null,"optional":false,"rest":false,"properties":[{"name":"BROTLI_DECODER_PARAM_DISABLE_RING_BUFFER_REALLOCATION","type":null,"description":"boolean\nflag affecting internal memory allocation.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"BROTLI_DECODER_PARAM_LARGE_WINDOW","type":null,"description":"boolean flag enabling \"Large\nWindow Brotli\" mode (not compatible with [RFC 7932](https://www.rfc-editor.org/rfc/rfc7932.html)).\nSee the [Brotli decompressor options](#decompressor-options) in the zlib documentation for\ndetails.","default":null,"optional":false,"rest":false,"properties":[]}]},{"name":"dictionary","type":{"text":"Buffer | TypedArray | DataView","links":[{"name":"Buffer","href":"buffer.html#class-buffer","start":0,"end":6},{"name":"TypedArray","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/TypedArray","start":9,"end":19},{"name":"DataView","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/DataView","start":22,"end":30}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}]}],"returns":{"type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"A stateful transform."}},"description":"Create a Brotli decompression transform.","summary":"Create a Brotli decompression transform.","examples":[],"children":[]},{"kind":"method","id":"decompressdeflateoptions","name":"decompressDeflate","title":"`decompressDeflate([options])`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"options","type":null,"description":"","default":null,"optional":true,"rest":false,"properties":[]}],"returns":null},"description":"","summary":"","examples":[],"children":[]},{"kind":"method","id":"decompressdeflatesyncoptions","name":"decompressDeflateSync","title":"`decompressDeflateSync([options])`","scope":"module","overloadOf":null,"stability":null,"added":["v25.9.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"options","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"","default":null,"optional":true,"rest":false,"properties":[{"name":"chunkSize","type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"description":"Output buffer size.","default":"`65536` (64 KB)","optional":true,"rest":false,"properties":[]},{"name":"windowBits","type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"description":"","default":"`Z_DEFAULT_WINDOWBITS` (15)","optional":true,"rest":false,"properties":[]},{"name":"dictionary","type":{"text":"Buffer | TypedArray | DataView","links":[{"name":"Buffer","href":"buffer.html#class-buffer","start":0,"end":6},{"name":"TypedArray","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/TypedArray","start":9,"end":19},{"name":"DataView","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/DataView","start":22,"end":30}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}]}],"returns":{"type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"A stateful transform."}},"description":"Create a deflate decompression transform.","summary":"Create a deflate decompression transform.","examples":[],"children":[]},{"kind":"method","id":"decompressgzipoptions","name":"decompressGzip","title":"`decompressGzip([options])`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"options","type":null,"description":"","default":null,"optional":true,"rest":false,"properties":[]}],"returns":null},"description":"","summary":"","examples":[],"children":[]},{"kind":"method","id":"decompressgzipsyncoptions","name":"decompressGzipSync","title":"`decompressGzipSync([options])`","scope":"module","overloadOf":null,"stability":null,"added":["v25.9.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"options","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"","default":null,"optional":true,"rest":false,"properties":[{"name":"chunkSize","type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"description":"Output buffer size.","default":"`65536` (64 KB)","optional":true,"rest":false,"properties":[]},{"name":"windowBits","type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"description":"","default":"`Z_DEFAULT_WINDOWBITS` (15)","optional":true,"rest":false,"properties":[]},{"name":"dictionary","type":{"text":"Buffer | TypedArray | DataView","links":[{"name":"Buffer","href":"buffer.html#class-buffer","start":0,"end":6},{"name":"TypedArray","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/TypedArray","start":9,"end":19},{"name":"DataView","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/DataView","start":22,"end":30}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}]}],"returns":{"type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"A stateful transform."}},"description":"Create a gzip decompression transform.","summary":"Create a gzip decompression transform.","examples":[],"children":[]},{"kind":"method","id":"decompresszstdoptions","name":"decompressZstd","title":"`decompressZstd([options])`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"options","type":null,"description":"","default":null,"optional":true,"rest":false,"properties":[]}],"returns":null},"description":"","summary":"","examples":[],"children":[]},{"kind":"method","id":"decompresszstdsyncoptions","name":"decompressZstdSync","title":"`decompressZstdSync([options])`","scope":"module","overloadOf":null,"stability":null,"added":["v25.9.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"options","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"","default":null,"optional":true,"rest":false,"properties":[{"name":"chunkSize","type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"description":"Output buffer size.","default":"`65536` (64 KB)","optional":true,"rest":false,"properties":[]},{"name":"params","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"Key-value object where keys and values are\n`zlib.constants` entries. Available decompressor parameters:","default":null,"optional":false,"rest":false,"properties":[{"name":"ZSTD_d_windowLogMax","type":null,"description":"maximum window size (log2) the decompressor\nwill allocate. Limits memory usage against malicious input.\nSee the [Zstd decompressor options](#decompressor-options-1) in the zlib documentation for\ndetails.","default":null,"optional":false,"rest":false,"properties":[]}]},{"name":"dictionary","type":{"text":"Buffer | TypedArray | DataView","links":[{"name":"Buffer","href":"buffer.html#class-buffer","start":0,"end":6},{"name":"TypedArray","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/TypedArray","start":9,"end":19},{"name":"DataView","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/DataView","start":22,"end":30}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}]}],"returns":{"type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"A stateful transform."}},"description":"Create a Zstandard decompression transform.","summary":"Create a Zstandard decompression transform.","examples":[],"children":[]}]}]}