d9ddd70e8b168f88785449e16b5e6990fdcdaf237ecc9a38922f4f7a185a45b399839487574762c18ed3b4ae0dddb4a24045900fc6dc810287497c616199e1 25 KB

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