• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict';
2
3require('../common');
4const assert = require('assert');
5const zlib = require('zlib');
6
7
8// windowBits is a special case in zlib. On the compression side, 0 is invalid.
9// On the decompression side, it indicates that zlib should use the value from
10// the header of the compressed stream.
11{
12  const inflate = zlib.createInflate({ windowBits: 0 });
13  assert(inflate instanceof zlib.Inflate);
14}
15
16{
17  const gunzip = zlib.createGunzip({ windowBits: 0 });
18  assert(gunzip instanceof zlib.Gunzip);
19}
20
21{
22  const unzip = zlib.createUnzip({ windowBits: 0 });
23  assert(unzip instanceof zlib.Unzip);
24}
25
26{
27  assert.throws(() => zlib.createGzip({ windowBits: 0 }), {
28    code: 'ERR_OUT_OF_RANGE',
29    name: 'RangeError',
30    message: 'The value of "options.windowBits" is out of range. ' +
31             'It must be >= 9 and <= 15. Received 0'
32  });
33}
34