You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
zlib constants were previously being added to binding in node_zlib.cc.
This moves the zlib constants to node_constants.cc for consistency with
the recent constants refactoring:
#6534
Adds require('zlib').constants to expose the constants
Docs-only deprecates the constants hung directly off require('zlib')
Removes a couple constants from the docs that apparently no longer
exist in the code
PR-URL: #7203
Reviewed-By: Rod Vagg <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Ben Noordhuis <[email protected]>
All of the constants defined in `zlib.h` are also defined on `require('zlib')`.
225
-
In the normal course of operations, it will not be necessary to use these
226
-
constants. They are documented so that their presence is not surprising. This
227
-
section is taken almost directly from the [zlib documentation][]. See
228
-
<http://zlib.net/manual.html#Constants> for more details.
226
+
All of the constants defined in `zlib.h` are also defined on
227
+
`require('zlib').constants`. In the normal course of operations, it will not be
228
+
necessary to use these constants. They are documented so that their presence is
229
+
not surprising. This section is taken almost directly from the
230
+
[zlib documentation][]. See <http://zlib.net/manual.html#Constants> for more
231
+
details.
232
+
233
+
*Note*: Previously, the constants were available directly from
234
+
`require('zlib')`, for instance `zlib.Z_NO_FLUSH`. Accessing the constants
235
+
directly from the module is currently still possible but should be considered
236
+
deprecated.
229
237
230
238
Allowed flush values.
231
239
232
-
*`zlib.Z_NO_FLUSH`
233
-
*`zlib.Z_PARTIAL_FLUSH`
234
-
*`zlib.Z_SYNC_FLUSH`
235
-
*`zlib.Z_FULL_FLUSH`
236
-
*`zlib.Z_FINISH`
237
-
*`zlib.Z_BLOCK`
238
-
*`zlib.Z_TREES`
240
+
*`zlib.constants.Z_NO_FLUSH`
241
+
*`zlib.constants.Z_PARTIAL_FLUSH`
242
+
*`zlib.constants.Z_SYNC_FLUSH`
243
+
*`zlib.constants.Z_FULL_FLUSH`
244
+
*`zlib.constants.Z_FINISH`
245
+
*`zlib.constants.Z_BLOCK`
246
+
*`zlib.constants.Z_TREES`
239
247
240
248
Return codes for the compression/decompression functions. Negative
241
249
values are errors, positive values are used for special but normal
242
250
events.
243
251
244
-
*`zlib.Z_OK`
245
-
*`zlib.Z_STREAM_END`
246
-
*`zlib.Z_NEED_DICT`
247
-
*`zlib.Z_ERRNO`
248
-
*`zlib.Z_STREAM_ERROR`
249
-
*`zlib.Z_DATA_ERROR`
250
-
*`zlib.Z_MEM_ERROR`
251
-
*`zlib.Z_BUF_ERROR`
252
-
*`zlib.Z_VERSION_ERROR`
252
+
*`zlib.constants.Z_OK`
253
+
*`zlib.constants.Z_STREAM_END`
254
+
*`zlib.constants.Z_NEED_DICT`
255
+
*`zlib.constants.Z_ERRNO`
256
+
*`zlib.constants.Z_STREAM_ERROR`
257
+
*`zlib.constants.Z_DATA_ERROR`
258
+
*`zlib.constants.Z_MEM_ERROR`
259
+
*`zlib.constants.Z_BUF_ERROR`
260
+
*`zlib.constants.Z_VERSION_ERROR`
253
261
254
262
Compression levels.
255
263
256
-
*`zlib.Z_NO_COMPRESSION`
257
-
*`zlib.Z_BEST_SPEED`
258
-
*`zlib.Z_BEST_COMPRESSION`
259
-
*`zlib.Z_DEFAULT_COMPRESSION`
264
+
*`zlib.constants.Z_NO_COMPRESSION`
265
+
*`zlib.constants.Z_BEST_SPEED`
266
+
*`zlib.constants.Z_BEST_COMPRESSION`
267
+
*`zlib.constants.Z_DEFAULT_COMPRESSION`
260
268
261
269
Compression strategy.
262
270
263
-
*`zlib.Z_FILTERED`
264
-
*`zlib.Z_HUFFMAN_ONLY`
265
-
*`zlib.Z_RLE`
266
-
*`zlib.Z_FIXED`
267
-
*`zlib.Z_DEFAULT_STRATEGY`
268
-
269
-
Possible values of the data_type field.
270
-
271
-
*`zlib.Z_BINARY`
272
-
*`zlib.Z_TEXT`
273
-
*`zlib.Z_ASCII`
274
-
*`zlib.Z_UNKNOWN`
275
-
276
-
The deflate compression method (the only one supported in this version).
277
-
278
-
*`zlib.Z_DEFLATED`
279
-
280
-
For initializing zalloc, zfree, opaque.
281
-
282
-
*`zlib.Z_NULL`
271
+
*`zlib.constants.Z_FILTERED`
272
+
*`zlib.constants.Z_HUFFMAN_ONLY`
273
+
*`zlib.constants.Z_RLE`
274
+
*`zlib.constants.Z_FIXED`
275
+
*`zlib.constants.Z_DEFAULT_STRATEGY`
283
276
284
277
## Class Options
285
278
<!-- YAML
@@ -293,8 +286,8 @@ Each class takes an `options` object. All options are optional.
293
286
Note that some options are only relevant when compressing, and are
0 commit comments