mirror of
https://github.com/nodejs/node.git
synced 2025-05-13 10:54:13 +00:00

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: https://github.com/nodejs/node/pull/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: https://github.com/nodejs/node/pull/7203 Reviewed-By: Rod Vagg <rod@vagg.org> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
34 lines
670 B
JavaScript
34 lines
670 B
JavaScript
'use strict';
|
|
require('../common');
|
|
var assert = require('assert');
|
|
var zlib = require('zlib');
|
|
|
|
var gzip = zlib.createGzip();
|
|
var gunz = zlib.createUnzip();
|
|
|
|
gzip.pipe(gunz);
|
|
|
|
var output = '';
|
|
var input = 'A line of data\n';
|
|
gunz.setEncoding('utf8');
|
|
gunz.on('data', function(c) {
|
|
output += c;
|
|
});
|
|
|
|
process.on('exit', function() {
|
|
assert.equal(output, input);
|
|
|
|
// Make sure that the flush flag was set back to normal
|
|
assert.equal(gzip._flushFlag, zlib.constants.Z_NO_FLUSH);
|
|
|
|
console.log('ok');
|
|
});
|
|
|
|
// make sure that flush/write doesn't trigger an assert failure
|
|
gzip.flush(); write();
|
|
function write() {
|
|
gzip.write(input);
|
|
gzip.end();
|
|
gunz.read(0);
|
|
}
|