@@ -41,17 +41,33 @@ for (var bk = 0; bk < bkeys.length; bk++) {
41
41
}
42
42
}
43
43
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
+
44
60
// translation table for return codes.
45
61
const codes = {
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
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
55
71
} ;
56
72
57
73
const ckeys = Object . keys ( codes ) ;
0 commit comments