mirror of
https://github.com/nodejs/node.git
synced 2024-11-30 07:27:22 +01:00
197a465280
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>
29 lines
682 B
JavaScript
29 lines
682 B
JavaScript
'use strict';
|
|
require('../common');
|
|
const assert = require('assert');
|
|
const zlib = require('zlib');
|
|
|
|
assert.doesNotThrow(() => {
|
|
zlib.createGzip({ flush: zlib.constants.Z_SYNC_FLUSH });
|
|
});
|
|
|
|
assert.throws(() => {
|
|
zlib.createGzip({ flush: 'foobar' });
|
|
}, /Invalid flush flag: foobar/);
|
|
|
|
assert.throws(() => {
|
|
zlib.createGzip({ flush: 10000 });
|
|
}, /Invalid flush flag: 10000/);
|
|
|
|
assert.doesNotThrow(() => {
|
|
zlib.createGzip({ finishFlush: zlib.constants.Z_SYNC_FLUSH });
|
|
});
|
|
|
|
assert.throws(() => {
|
|
zlib.createGzip({ finishFlush: 'foobar' });
|
|
}, /Invalid flush flag: foobar/);
|
|
|
|
assert.throws(() => {
|
|
zlib.createGzip({ finishFlush: 10000 });
|
|
}, /Invalid flush flag: 10000/);
|