dcf5e3ed3f62c9699fdce08ba8cf1ed8aa18adf8a30013f1c11e059713941591c2f520ac8693e3a52f4397882ec35fc2e28fa7b26cf3f8050190e1e0785b22 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670
  1. /**
  2. * The `node:zlib` module provides compression functionality implemented using
  3. * Gzip, Deflate/Inflate, and Brotli.
  4. *
  5. * To access it:
  6. *
  7. * ```js
  8. * import zlib from 'node:zlib';
  9. * ```
  10. *
  11. * Compression and decompression are built around the Node.js
  12. * [Streams API](https://nodejs.org/docs/latest-v22.x/api/stream.html).
  13. *
  14. * Compressing or decompressing a stream (such as a file) can be accomplished by
  15. * piping the source stream through a `zlib` `Transform` stream into a destination
  16. * stream:
  17. *
  18. * ```js
  19. * import { createGzip } from 'node:zlib';
  20. * import { pipeline } from 'node:stream';
  21. * import {
  22. * createReadStream,
  23. * createWriteStream,
  24. * } from 'node:fs';
  25. *
  26. * const gzip = createGzip();
  27. * const source = createReadStream('input.txt');
  28. * const destination = createWriteStream('input.txt.gz');
  29. *
  30. * pipeline(source, gzip, destination, (err) => {
  31. * if (err) {
  32. * console.error('An error occurred:', err);
  33. * process.exitCode = 1;
  34. * }
  35. * });
  36. *
  37. * // Or, Promisified
  38. *
  39. * import { promisify } from 'node:util';
  40. * const pipe = promisify(pipeline);
  41. *
  42. * async function do_gzip(input, output) {
  43. * const gzip = createGzip();
  44. * const source = createReadStream(input);
  45. * const destination = createWriteStream(output);
  46. * await pipe(source, gzip, destination);
  47. * }
  48. *
  49. * do_gzip('input.txt', 'input.txt.gz')
  50. * .catch((err) => {
  51. * console.error('An error occurred:', err);
  52. * process.exitCode = 1;
  53. * });
  54. * ```
  55. *
  56. * It is also possible to compress or decompress data in a single step:
  57. *
  58. * ```js
  59. * import { deflate, unzip } from 'node:zlib';
  60. *
  61. * const input = '.................................';
  62. * deflate(input, (err, buffer) => {
  63. * if (err) {
  64. * console.error('An error occurred:', err);
  65. * process.exitCode = 1;
  66. * }
  67. * console.log(buffer.toString('base64'));
  68. * });
  69. *
  70. * const buffer = Buffer.from('eJzT0yMAAGTvBe8=', 'base64');
  71. * unzip(buffer, (err, buffer) => {
  72. * if (err) {
  73. * console.error('An error occurred:', err);
  74. * process.exitCode = 1;
  75. * }
  76. * console.log(buffer.toString());
  77. * });
  78. *
  79. * // Or, Promisified
  80. *
  81. * import { promisify } from 'node:util';
  82. * const do_unzip = promisify(unzip);
  83. *
  84. * do_unzip(buffer)
  85. * .then((buf) => console.log(buf.toString()))
  86. * .catch((err) => {
  87. * console.error('An error occurred:', err);
  88. * process.exitCode = 1;
  89. * });
  90. * ```
  91. * @since v0.5.8
  92. * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/zlib.js)
  93. */
  94. declare module "zlib" {
  95. import * as stream from "node:stream";
  96. interface ZlibOptions {
  97. /**
  98. * @default constants.Z_NO_FLUSH
  99. */
  100. flush?: number | undefined;
  101. /**
  102. * @default constants.Z_FINISH
  103. */
  104. finishFlush?: number | undefined;
  105. /**
  106. * @default 16*1024
  107. */
  108. chunkSize?: number | undefined;
  109. windowBits?: number | undefined;
  110. level?: number | undefined; // compression only
  111. memLevel?: number | undefined; // compression only
  112. strategy?: number | undefined; // compression only
  113. dictionary?: NodeJS.ArrayBufferView | ArrayBuffer | undefined; // deflate/inflate only, empty dictionary by default
  114. /**
  115. * If `true`, returns an object with `buffer` and `engine`.
  116. */
  117. info?: boolean | undefined;
  118. /**
  119. * Limits output size when using convenience methods.
  120. * @default buffer.kMaxLength
  121. */
  122. maxOutputLength?: number | undefined;
  123. }
  124. interface BrotliOptions {
  125. /**
  126. * @default constants.BROTLI_OPERATION_PROCESS
  127. */
  128. flush?: number | undefined;
  129. /**
  130. * @default constants.BROTLI_OPERATION_FINISH
  131. */
  132. finishFlush?: number | undefined;
  133. /**
  134. * @default 16*1024
  135. */
  136. chunkSize?: number | undefined;
  137. params?:
  138. | {
  139. /**
  140. * Each key is a `constants.BROTLI_*` constant.
  141. */
  142. [key: number]: boolean | number;
  143. }
  144. | undefined;
  145. /**
  146. * Limits output size when using [convenience methods](https://nodejs.org/docs/latest-v22.x/api/zlib.html#convenience-methods).
  147. * @default buffer.kMaxLength
  148. */
  149. maxOutputLength?: number | undefined;
  150. }
  151. interface ZstdOptions {
  152. /**
  153. * @default constants.ZSTD_e_continue
  154. */
  155. flush?: number | undefined;
  156. /**
  157. * @default constants.ZSTD_e_end
  158. */
  159. finishFlush?: number | undefined;
  160. /**
  161. * @default 16 * 1024
  162. */
  163. chunkSize?: number | undefined;
  164. /**
  165. * Key-value object containing indexed
  166. * [Zstd parameters](https://nodejs.org/docs/latest-v22.x/api/zlib.html#zstd-constants).
  167. */
  168. params?: { [key: number]: number | boolean } | undefined;
  169. /**
  170. * Limits output size when using
  171. * [convenience methods](https://nodejs.org/docs/latest-v22.x/api/zlib.html#convenience-methods).
  172. * @default buffer.kMaxLength
  173. */
  174. maxOutputLength?: number | undefined;
  175. }
  176. interface Zlib {
  177. /** @deprecated Use bytesWritten instead. */
  178. readonly bytesRead: number;
  179. readonly bytesWritten: number;
  180. shell?: boolean | string | undefined;
  181. close(callback?: () => void): void;
  182. flush(kind?: number, callback?: () => void): void;
  183. flush(callback?: () => void): void;
  184. }
  185. interface ZlibParams {
  186. params(level: number, strategy: number, callback: () => void): void;
  187. }
  188. interface ZlibReset {
  189. reset(): void;
  190. }
  191. interface BrotliCompress extends stream.Transform, Zlib {}
  192. interface BrotliDecompress extends stream.Transform, Zlib {}
  193. interface Gzip extends stream.Transform, Zlib {}
  194. interface Gunzip extends stream.Transform, Zlib {}
  195. interface Deflate extends stream.Transform, Zlib, ZlibReset, ZlibParams {}
  196. interface Inflate extends stream.Transform, Zlib, ZlibReset {}
  197. interface DeflateRaw extends stream.Transform, Zlib, ZlibReset, ZlibParams {}
  198. interface InflateRaw extends stream.Transform, Zlib, ZlibReset {}
  199. interface Unzip extends stream.Transform, Zlib {}
  200. /**
  201. * @since v22.15.0
  202. * @experimental
  203. */
  204. interface ZstdCompress extends stream.Transform, Zlib {}
  205. /**
  206. * @since v22.15.0
  207. * @experimental
  208. */
  209. interface ZstdDecompress extends stream.Transform, Zlib {}
  210. /**
  211. * Computes a 32-bit [Cyclic Redundancy Check](https://en.wikipedia.org/wiki/Cyclic_redundancy_check) checksum of `data`.
  212. * If `value` is specified, it is used as the starting value of the checksum, otherwise, 0 is used as the starting value.
  213. * @param data When `data` is a string, it will be encoded as UTF-8 before being used for computation.
  214. * @param value An optional starting value. It must be a 32-bit unsigned integer. @default 0
  215. * @returns A 32-bit unsigned integer containing the checksum.
  216. * @since v22.2.0
  217. */
  218. function crc32(data: string | Buffer | NodeJS.ArrayBufferView, value?: number): number;
  219. /**
  220. * Creates and returns a new `BrotliCompress` object.
  221. * @since v11.7.0, v10.16.0
  222. */
  223. function createBrotliCompress(options?: BrotliOptions): BrotliCompress;
  224. /**
  225. * Creates and returns a new `BrotliDecompress` object.
  226. * @since v11.7.0, v10.16.0
  227. */
  228. function createBrotliDecompress(options?: BrotliOptions): BrotliDecompress;
  229. /**
  230. * Creates and returns a new `Gzip` object.
  231. * See `example`.
  232. * @since v0.5.8
  233. */
  234. function createGzip(options?: ZlibOptions): Gzip;
  235. /**
  236. * Creates and returns a new `Gunzip` object.
  237. * @since v0.5.8
  238. */
  239. function createGunzip(options?: ZlibOptions): Gunzip;
  240. /**
  241. * Creates and returns a new `Deflate` object.
  242. * @since v0.5.8
  243. */
  244. function createDeflate(options?: ZlibOptions): Deflate;
  245. /**
  246. * Creates and returns a new `Inflate` object.
  247. * @since v0.5.8
  248. */
  249. function createInflate(options?: ZlibOptions): Inflate;
  250. /**
  251. * Creates and returns a new `DeflateRaw` object.
  252. *
  253. * An upgrade of zlib from 1.2.8 to 1.2.11 changed behavior when `windowBits` is set to 8 for raw deflate streams. zlib would automatically set `windowBits` to 9 if was initially set to 8. Newer
  254. * versions of zlib will throw an exception,
  255. * so Node.js restored the original behavior of upgrading a value of 8 to 9,
  256. * since passing `windowBits = 9` to zlib actually results in a compressed stream
  257. * that effectively uses an 8-bit window only.
  258. * @since v0.5.8
  259. */
  260. function createDeflateRaw(options?: ZlibOptions): DeflateRaw;
  261. /**
  262. * Creates and returns a new `InflateRaw` object.
  263. * @since v0.5.8
  264. */
  265. function createInflateRaw(options?: ZlibOptions): InflateRaw;
  266. /**
  267. * Creates and returns a new `Unzip` object.
  268. * @since v0.5.8
  269. */
  270. function createUnzip(options?: ZlibOptions): Unzip;
  271. /**
  272. * Creates and returns a new `ZstdCompress` object.
  273. * @since v22.15.0
  274. */
  275. function createZstdCompress(options?: ZstdOptions): ZstdCompress;
  276. /**
  277. * Creates and returns a new `ZstdDecompress` object.
  278. * @since v22.15.0
  279. */
  280. function createZstdDecompress(options?: ZstdOptions): ZstdDecompress;
  281. type InputType = string | ArrayBuffer | NodeJS.ArrayBufferView;
  282. type CompressCallback = (error: Error | null, result: Buffer) => void;
  283. /**
  284. * @since v11.7.0, v10.16.0
  285. */
  286. function brotliCompress(buf: InputType, options: BrotliOptions, callback: CompressCallback): void;
  287. function brotliCompress(buf: InputType, callback: CompressCallback): void;
  288. namespace brotliCompress {
  289. function __promisify__(buffer: InputType, options?: BrotliOptions): Promise<Buffer>;
  290. }
  291. /**
  292. * Compress a chunk of data with `BrotliCompress`.
  293. * @since v11.7.0, v10.16.0
  294. */
  295. function brotliCompressSync(buf: InputType, options?: BrotliOptions): Buffer;
  296. /**
  297. * @since v11.7.0, v10.16.0
  298. */
  299. function brotliDecompress(buf: InputType, options: BrotliOptions, callback: CompressCallback): void;
  300. function brotliDecompress(buf: InputType, callback: CompressCallback): void;
  301. namespace brotliDecompress {
  302. function __promisify__(buffer: InputType, options?: BrotliOptions): Promise<Buffer>;
  303. }
  304. /**
  305. * Decompress a chunk of data with `BrotliDecompress`.
  306. * @since v11.7.0, v10.16.0
  307. */
  308. function brotliDecompressSync(buf: InputType, options?: BrotliOptions): Buffer;
  309. /**
  310. * @since v0.6.0
  311. */
  312. function deflate(buf: InputType, callback: CompressCallback): void;
  313. function deflate(buf: InputType, options: ZlibOptions, callback: CompressCallback): void;
  314. namespace deflate {
  315. function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<Buffer>;
  316. }
  317. /**
  318. * Compress a chunk of data with `Deflate`.
  319. * @since v0.11.12
  320. */
  321. function deflateSync(buf: InputType, options?: ZlibOptions): Buffer;
  322. /**
  323. * @since v0.6.0
  324. */
  325. function deflateRaw(buf: InputType, callback: CompressCallback): void;
  326. function deflateRaw(buf: InputType, options: ZlibOptions, callback: CompressCallback): void;
  327. namespace deflateRaw {
  328. function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<Buffer>;
  329. }
  330. /**
  331. * Compress a chunk of data with `DeflateRaw`.
  332. * @since v0.11.12
  333. */
  334. function deflateRawSync(buf: InputType, options?: ZlibOptions): Buffer;
  335. /**
  336. * @since v0.6.0
  337. */
  338. function gzip(buf: InputType, callback: CompressCallback): void;
  339. function gzip(buf: InputType, options: ZlibOptions, callback: CompressCallback): void;
  340. namespace gzip {
  341. function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<Buffer>;
  342. }
  343. /**
  344. * Compress a chunk of data with `Gzip`.
  345. * @since v0.11.12
  346. */
  347. function gzipSync(buf: InputType, options?: ZlibOptions): Buffer;
  348. /**
  349. * @since v0.6.0
  350. */
  351. function gunzip(buf: InputType, callback: CompressCallback): void;
  352. function gunzip(buf: InputType, options: ZlibOptions, callback: CompressCallback): void;
  353. namespace gunzip {
  354. function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<Buffer>;
  355. }
  356. /**
  357. * Decompress a chunk of data with `Gunzip`.
  358. * @since v0.11.12
  359. */
  360. function gunzipSync(buf: InputType, options?: ZlibOptions): Buffer;
  361. /**
  362. * @since v0.6.0
  363. */
  364. function inflate(buf: InputType, callback: CompressCallback): void;
  365. function inflate(buf: InputType, options: ZlibOptions, callback: CompressCallback): void;
  366. namespace inflate {
  367. function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<Buffer>;
  368. }
  369. /**
  370. * Decompress a chunk of data with `Inflate`.
  371. * @since v0.11.12
  372. */
  373. function inflateSync(buf: InputType, options?: ZlibOptions): Buffer;
  374. /**
  375. * @since v0.6.0
  376. */
  377. function inflateRaw(buf: InputType, callback: CompressCallback): void;
  378. function inflateRaw(buf: InputType, options: ZlibOptions, callback: CompressCallback): void;
  379. namespace inflateRaw {
  380. function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<Buffer>;
  381. }
  382. /**
  383. * Decompress a chunk of data with `InflateRaw`.
  384. * @since v0.11.12
  385. */
  386. function inflateRawSync(buf: InputType, options?: ZlibOptions): Buffer;
  387. /**
  388. * @since v0.6.0
  389. */
  390. function unzip(buf: InputType, callback: CompressCallback): void;
  391. function unzip(buf: InputType, options: ZlibOptions, callback: CompressCallback): void;
  392. namespace unzip {
  393. function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<Buffer>;
  394. }
  395. /**
  396. * Decompress a chunk of data with `Unzip`.
  397. * @since v0.11.12
  398. */
  399. function unzipSync(buf: InputType, options?: ZlibOptions): Buffer;
  400. /**
  401. * @since v22.15.0
  402. * @experimental
  403. */
  404. function zstdCompress(buf: InputType, callback: CompressCallback): void;
  405. function zstdCompress(buf: InputType, options: ZstdOptions, callback: CompressCallback): void;
  406. namespace zstdCompress {
  407. function __promisify__(buffer: InputType, options?: ZstdOptions): Promise<Buffer>;
  408. }
  409. /**
  410. * Compress a chunk of data with `ZstdCompress`.
  411. * @since v22.15.0
  412. * @experimental
  413. */
  414. function zstdCompressSync(buf: InputType, options?: ZstdOptions): Buffer;
  415. /**
  416. * @since v22.15.0
  417. * @experimental
  418. */
  419. function zstdDecompress(buf: InputType, callback: CompressCallback): void;
  420. function zstdDecompress(buf: InputType, options: ZstdOptions, callback: CompressCallback): void;
  421. namespace zstdDecompress {
  422. function __promisify__(buffer: InputType, options?: ZstdOptions): Promise<Buffer>;
  423. }
  424. /**
  425. * Decompress a chunk of data with `ZstdDecompress`.
  426. * @since v22.15.0
  427. * @experimental
  428. */
  429. function zstdDecompressSync(buf: InputType, options?: ZstdOptions): Buffer;
  430. namespace constants {
  431. const BROTLI_DECODE: number;
  432. const BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES: number;
  433. const BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP: number;
  434. const BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MODES: number;
  435. const BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_1: number;
  436. const BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_2: number;
  437. const BROTLI_DECODER_ERROR_ALLOC_TREE_GROUPS: number;
  438. const BROTLI_DECODER_ERROR_DICTIONARY_NOT_SET: number;
  439. const BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_1: number;
  440. const BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_2: number;
  441. const BROTLI_DECODER_ERROR_FORMAT_CL_SPACE: number;
  442. const BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT: number;
  443. const BROTLI_DECODER_ERROR_FORMAT_DICTIONARY: number;
  444. const BROTLI_DECODER_ERROR_FORMAT_DISTANCE: number;
  445. const BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_META_NIBBLE: number;
  446. const BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_NIBBLE: number;
  447. const BROTLI_DECODER_ERROR_FORMAT_HUFFMAN_SPACE: number;
  448. const BROTLI_DECODER_ERROR_FORMAT_PADDING_1: number;
  449. const BROTLI_DECODER_ERROR_FORMAT_PADDING_2: number;
  450. const BROTLI_DECODER_ERROR_FORMAT_RESERVED: number;
  451. const BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_ALPHABET: number;
  452. const BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_SAME: number;
  453. const BROTLI_DECODER_ERROR_FORMAT_TRANSFORM: number;
  454. const BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS: number;
  455. const BROTLI_DECODER_ERROR_INVALID_ARGUMENTS: number;
  456. const BROTLI_DECODER_ERROR_UNREACHABLE: number;
  457. const BROTLI_DECODER_NEEDS_MORE_INPUT: number;
  458. const BROTLI_DECODER_NEEDS_MORE_OUTPUT: number;
  459. const BROTLI_DECODER_NO_ERROR: number;
  460. const BROTLI_DECODER_PARAM_DISABLE_RING_BUFFER_REALLOCATION: number;
  461. const BROTLI_DECODER_PARAM_LARGE_WINDOW: number;
  462. const BROTLI_DECODER_RESULT_ERROR: number;
  463. const BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT: number;
  464. const BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT: number;
  465. const BROTLI_DECODER_RESULT_SUCCESS: number;
  466. const BROTLI_DECODER_SUCCESS: number;
  467. const BROTLI_DEFAULT_MODE: number;
  468. const BROTLI_DEFAULT_QUALITY: number;
  469. const BROTLI_DEFAULT_WINDOW: number;
  470. const BROTLI_ENCODE: number;
  471. const BROTLI_LARGE_MAX_WINDOW_BITS: number;
  472. const BROTLI_MAX_INPUT_BLOCK_BITS: number;
  473. const BROTLI_MAX_QUALITY: number;
  474. const BROTLI_MAX_WINDOW_BITS: number;
  475. const BROTLI_MIN_INPUT_BLOCK_BITS: number;
  476. const BROTLI_MIN_QUALITY: number;
  477. const BROTLI_MIN_WINDOW_BITS: number;
  478. const BROTLI_MODE_FONT: number;
  479. const BROTLI_MODE_GENERIC: number;
  480. const BROTLI_MODE_TEXT: number;
  481. const BROTLI_OPERATION_EMIT_METADATA: number;
  482. const BROTLI_OPERATION_FINISH: number;
  483. const BROTLI_OPERATION_FLUSH: number;
  484. const BROTLI_OPERATION_PROCESS: number;
  485. const BROTLI_PARAM_DISABLE_LITERAL_CONTEXT_MODELING: number;
  486. const BROTLI_PARAM_LARGE_WINDOW: number;
  487. const BROTLI_PARAM_LGBLOCK: number;
  488. const BROTLI_PARAM_LGWIN: number;
  489. const BROTLI_PARAM_MODE: number;
  490. const BROTLI_PARAM_NDIRECT: number;
  491. const BROTLI_PARAM_NPOSTFIX: number;
  492. const BROTLI_PARAM_QUALITY: number;
  493. const BROTLI_PARAM_SIZE_HINT: number;
  494. const DEFLATE: number;
  495. const DEFLATERAW: number;
  496. const GUNZIP: number;
  497. const GZIP: number;
  498. const INFLATE: number;
  499. const INFLATERAW: number;
  500. const UNZIP: number;
  501. const ZLIB_VERNUM: number;
  502. const ZSTD_CLEVEL_DEFAULT: number;
  503. const ZSTD_COMPRESS: number;
  504. const ZSTD_DECOMPRESS: number;
  505. const ZSTD_btlazy2: number;
  506. const ZSTD_btopt: number;
  507. const ZSTD_btultra: number;
  508. const ZSTD_btultra2: number;
  509. const ZSTD_c_chainLog: number;
  510. const ZSTD_c_checksumFlag: number;
  511. const ZSTD_c_compressionLevel: number;
  512. const ZSTD_c_contentSizeFlag: number;
  513. const ZSTD_c_dictIDFlag: number;
  514. const ZSTD_c_enableLongDistanceMatching: number;
  515. const ZSTD_c_hashLog: number;
  516. const ZSTD_c_jobSize: number;
  517. const ZSTD_c_ldmBucketSizeLog: number;
  518. const ZSTD_c_ldmHashLog: number;
  519. const ZSTD_c_ldmHashRateLog: number;
  520. const ZSTD_c_ldmMinMatch: number;
  521. const ZSTD_c_minMatch: number;
  522. const ZSTD_c_nbWorkers: number;
  523. const ZSTD_c_overlapLog: number;
  524. const ZSTD_c_searchLog: number;
  525. const ZSTD_c_strategy: number;
  526. const ZSTD_c_targetLength: number;
  527. const ZSTD_c_windowLog: number;
  528. const ZSTD_d_windowLogMax: number;
  529. const ZSTD_dfast: number;
  530. const ZSTD_e_continue: number;
  531. const ZSTD_e_end: number;
  532. const ZSTD_e_flush: number;
  533. const ZSTD_error_GENERIC: number;
  534. const ZSTD_error_checksum_wrong: number;
  535. const ZSTD_error_corruption_detected: number;
  536. const ZSTD_error_dictionaryCreation_failed: number;
  537. const ZSTD_error_dictionary_corrupted: number;
  538. const ZSTD_error_dictionary_wrong: number;
  539. const ZSTD_error_dstBuffer_null: number;
  540. const ZSTD_error_dstSize_tooSmall: number;
  541. const ZSTD_error_frameParameter_unsupported: number;
  542. const ZSTD_error_frameParameter_windowTooLarge: number;
  543. const ZSTD_error_init_missing: number;
  544. const ZSTD_error_literals_headerWrong: number;
  545. const ZSTD_error_maxSymbolValue_tooLarge: number;
  546. const ZSTD_error_maxSymbolValue_tooSmall: number;
  547. const ZSTD_error_memory_allocation: number;
  548. const ZSTD_error_noForwardProgress_destFull: number;
  549. const ZSTD_error_noForwardProgress_inputEmpty: number;
  550. const ZSTD_error_no_error: number;
  551. const ZSTD_error_parameter_combination_unsupported: number;
  552. const ZSTD_error_parameter_outOfBound: number;
  553. const ZSTD_error_parameter_unsupported: number;
  554. const ZSTD_error_prefix_unknown: number;
  555. const ZSTD_error_srcSize_wrong: number;
  556. const ZSTD_error_stabilityCondition_notRespected: number;
  557. const ZSTD_error_stage_wrong: number;
  558. const ZSTD_error_tableLog_tooLarge: number;
  559. const ZSTD_error_version_unsupported: number;
  560. const ZSTD_error_workSpace_tooSmall: number;
  561. const ZSTD_fast: number;
  562. const ZSTD_greedy: number;
  563. const ZSTD_lazy: number;
  564. const ZSTD_lazy2: number;
  565. const Z_BEST_COMPRESSION: number;
  566. const Z_BEST_SPEED: number;
  567. const Z_BLOCK: number;
  568. const Z_BUF_ERROR: number;
  569. const Z_DATA_ERROR: number;
  570. const Z_DEFAULT_CHUNK: number;
  571. const Z_DEFAULT_COMPRESSION: number;
  572. const Z_DEFAULT_LEVEL: number;
  573. const Z_DEFAULT_MEMLEVEL: number;
  574. const Z_DEFAULT_STRATEGY: number;
  575. const Z_DEFAULT_WINDOWBITS: number;
  576. const Z_ERRNO: number;
  577. const Z_FILTERED: number;
  578. const Z_FINISH: number;
  579. const Z_FIXED: number;
  580. const Z_FULL_FLUSH: number;
  581. const Z_HUFFMAN_ONLY: number;
  582. const Z_MAX_CHUNK: number;
  583. const Z_MAX_LEVEL: number;
  584. const Z_MAX_MEMLEVEL: number;
  585. const Z_MAX_WINDOWBITS: number;
  586. const Z_MEM_ERROR: number;
  587. const Z_MIN_CHUNK: number;
  588. const Z_MIN_LEVEL: number;
  589. const Z_MIN_MEMLEVEL: number;
  590. const Z_MIN_WINDOWBITS: number;
  591. const Z_NEED_DICT: number;
  592. const Z_NO_COMPRESSION: number;
  593. const Z_NO_FLUSH: number;
  594. const Z_OK: number;
  595. const Z_PARTIAL_FLUSH: number;
  596. const Z_RLE: number;
  597. const Z_STREAM_END: number;
  598. const Z_STREAM_ERROR: number;
  599. const Z_SYNC_FLUSH: number;
  600. const Z_VERSION_ERROR: number;
  601. }
  602. // Allowed flush values.
  603. /** @deprecated Use `constants.Z_NO_FLUSH` */
  604. const Z_NO_FLUSH: number;
  605. /** @deprecated Use `constants.Z_PARTIAL_FLUSH` */
  606. const Z_PARTIAL_FLUSH: number;
  607. /** @deprecated Use `constants.Z_SYNC_FLUSH` */
  608. const Z_SYNC_FLUSH: number;
  609. /** @deprecated Use `constants.Z_FULL_FLUSH` */
  610. const Z_FULL_FLUSH: number;
  611. /** @deprecated Use `constants.Z_FINISH` */
  612. const Z_FINISH: number;
  613. /** @deprecated Use `constants.Z_BLOCK` */
  614. const Z_BLOCK: number;
  615. /** @deprecated Use `constants.Z_TREES` */
  616. const Z_TREES: number;
  617. // Return codes for the compression/decompression functions.
  618. // Negative values are errors, positive values are used for special but normal events.
  619. /** @deprecated Use `constants.Z_OK` */
  620. const Z_OK: number;
  621. /** @deprecated Use `constants.Z_STREAM_END` */
  622. const Z_STREAM_END: number;
  623. /** @deprecated Use `constants.Z_NEED_DICT` */
  624. const Z_NEED_DICT: number;
  625. /** @deprecated Use `constants.Z_ERRNO` */
  626. const Z_ERRNO: number;
  627. /** @deprecated Use `constants.Z_STREAM_ERROR` */
  628. const Z_STREAM_ERROR: number;
  629. /** @deprecated Use `constants.Z_DATA_ERROR` */
  630. const Z_DATA_ERROR: number;
  631. /** @deprecated Use `constants.Z_MEM_ERROR` */
  632. const Z_MEM_ERROR: number;
  633. /** @deprecated Use `constants.Z_BUF_ERROR` */
  634. const Z_BUF_ERROR: number;
  635. /** @deprecated Use `constants.Z_VERSION_ERROR` */
  636. const Z_VERSION_ERROR: number;
  637. // Compression levels.
  638. /** @deprecated Use `constants.Z_NO_COMPRESSION` */
  639. const Z_NO_COMPRESSION: number;
  640. /** @deprecated Use `constants.Z_BEST_SPEED` */
  641. const Z_BEST_SPEED: number;
  642. /** @deprecated Use `constants.Z_BEST_COMPRESSION` */
  643. const Z_BEST_COMPRESSION: number;
  644. /** @deprecated Use `constants.Z_DEFAULT_COMPRESSION` */
  645. const Z_DEFAULT_COMPRESSION: number;
  646. // Compression strategy.
  647. /** @deprecated Use `constants.Z_FILTERED` */
  648. const Z_FILTERED: number;
  649. /** @deprecated Use `constants.Z_HUFFMAN_ONLY` */
  650. const Z_HUFFMAN_ONLY: number;
  651. /** @deprecated Use `constants.Z_RLE` */
  652. const Z_RLE: number;
  653. /** @deprecated Use `constants.Z_FIXED` */
  654. const Z_FIXED: number;
  655. /** @deprecated Use `constants.Z_DEFAULT_STRATEGY` */
  656. const Z_DEFAULT_STRATEGY: number;
  657. /** @deprecated */
  658. const Z_BINARY: number;
  659. /** @deprecated */
  660. const Z_TEXT: number;
  661. /** @deprecated */
  662. const Z_ASCII: number;
  663. /** @deprecated */
  664. const Z_UNKNOWN: number;
  665. /** @deprecated */
  666. const Z_DEFLATED: number;
  667. }
  668. declare module "node:zlib" {
  669. export * from "zlib";
  670. }