Sha256: 2a5021ea2111ee034ba0ecbaee45c5ff54a0defdec4d6b1917111aeba8ac40ac

Contents?: true

Size: 693 Bytes

Versions: 5

Compression:

Stored size: 693 Bytes

Contents

'use strict';
const common = require('../common');
const assert = require('assert');
const zlib = require('zlib');

const data = Buffer.concat([
  zlib.gzipSync('abc'),
  zlib.gzipSync('def')
]);

const resultBuffers = [];

const unzip = zlib.createUnzip()
  .on('error', (err) => {
    assert.ifError(err);
  })
  .on('data', (data) => resultBuffers.push(data))
  .on('finish', common.mustCall(() => {
    assert.deepStrictEqual(Buffer.concat(resultBuffers).toString(), 'abcdef',
                           'result should match original string');
  }));

for (let i = 0; i < data.length; i++) {
  // Write each single byte individually.
  unzip.write(Buffer.from([data[i]]));
}

unzip.end();

Version data entries

5 entries across 4 versions & 1 rubygems

Version Path
node-compiler-0.9.1 vendor/node/test/parallel/test-zlib-unzip-one-byte-chunks.js
node-compiler-0.9.0 vendor/node-v7.2.1/test/parallel/test-zlib-unzip-one-byte-chunks.js
node-compiler-0.8.0 vendor/node-v7.2.0/test/parallel/test-zlib-unzip-one-byte-chunks.js
node-compiler-0.7.0 vendor/node-v6.9.1/test/parallel/test-zlib-unzip-one-byte-chunks.js
node-compiler-0.7.0 vendor/node-v7.1.0/test/parallel/test-zlib-unzip-one-byte-chunks.js