blob: 46ea97fbf4dd83819413108365810288e2a3137a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
'use strict';
require('../common');
const zlib = require('zlib');
const assert = require('assert');
const shouldNotBeCalled = () => { throw new Error('unexpected event'); };
const message = 'Come on, Fhqwhgads.';
const zipper = new zlib.Gzip();
zipper.on('close', shouldNotBeCalled);
const buffer = new Buffer(message);
const zipped = zipper._processChunk(buffer, zlib.constants.Z_FINISH);
const unzipper = new zlib.Gunzip();
unzipper.on('close', shouldNotBeCalled);
const unzipped = unzipper._processChunk(zipped, zlib.constants.Z_FINISH);
assert.notEqual(zipped.toString(), message);
assert.strictEqual(unzipped.toString(), message);
|