@@ -41,33 +41,17 @@ for (var bk = 0; bk < bkeys.length; bk++) {
4141 }
4242}
4343
44- const constants = process . binding ( 'constants' ) . zlib ;
45- const {
46- // Zlib flush levels
47- Z_NO_FLUSH , Z_BLOCK , Z_PARTIAL_FLUSH , Z_SYNC_FLUSH , Z_FULL_FLUSH , Z_FINISH ,
48- // Zlib option values
49- Z_MIN_CHUNK , Z_MIN_WINDOWBITS , Z_MAX_WINDOWBITS , Z_MIN_LEVEL , Z_MAX_LEVEL ,
50- Z_MIN_MEMLEVEL , Z_MAX_MEMLEVEL , Z_DEFAULT_CHUNK , Z_DEFAULT_COMPRESSION ,
51- Z_DEFAULT_STRATEGY , Z_DEFAULT_WINDOWBITS , Z_DEFAULT_MEMLEVEL , Z_FIXED ,
52- // Node's compression stream modes (node_zlib_mode)
53- DEFLATE , DEFLATERAW , INFLATE , INFLATERAW , GZIP , GUNZIP , UNZIP ,
54- BROTLI_DECODE , BROTLI_ENCODE ,
55- // Brotli operations (~flush levels)
56- BROTLI_OPERATION_PROCESS , BROTLI_OPERATION_FLUSH ,
57- BROTLI_OPERATION_FINISH
58- } = constants ;
59-
6044// translation table for return codes.
6145const codes = {
62- Z_OK : constants . Z_OK ,
63- Z_STREAM_END : constants . Z_STREAM_END ,
64- Z_NEED_DICT : constants . Z_NEED_DICT ,
65- Z_ERRNO : constants . Z_ERRNO ,
66- Z_STREAM_ERROR : constants . Z_STREAM_ERROR ,
67- Z_DATA_ERROR : constants . Z_DATA_ERROR ,
68- Z_MEM_ERROR : constants . Z_MEM_ERROR ,
69- Z_BUF_ERROR : constants . Z_BUF_ERROR ,
70- Z_VERSION_ERROR : constants . Z_VERSION_ERROR
46+ Z_OK : binding . Z_OK ,
47+ Z_STREAM_END : binding . Z_STREAM_END ,
48+ Z_NEED_DICT : binding . Z_NEED_DICT ,
49+ Z_ERRNO : binding . Z_ERRNO ,
50+ Z_STREAM_ERROR : binding . Z_STREAM_ERROR ,
51+ Z_DATA_ERROR : binding . Z_DATA_ERROR ,
52+ Z_MEM_ERROR : binding . Z_MEM_ERROR ,
53+ Z_BUF_ERROR : binding . Z_BUF_ERROR ,
54+ Z_VERSION_ERROR : binding . Z_VERSION_ERROR
7155} ;
7256
7357const ckeys = Object . keys ( codes ) ;
@@ -80,6 +64,10 @@ Object.defineProperty(exports, 'codes', {
8064 enumerable : true , value : Object . freeze ( codes ) , writable : false
8165} ) ;
8266
67+ Object . defineProperty ( exports , 'constants' , {
68+ configurable : false , enumerable : true , value : binding
69+ } ) ;
70+
8371exports . Deflate = Deflate ;
8472exports . Inflate = Inflate ;
8573exports . Gzip = Gzip ;
0 commit comments