Sha256: 19efb3033290eb53c0c2a1cb6f487153cd6be7609b0bec97c7e89cccb3f35c00

Contents?: true

Size: 966 Bytes

Versions: 5

Compression:

Stored size: 966 Bytes

Contents

'use strict';
// test unzipping a file that was created with a non-node gzip lib,
// piped in as fast as possible.

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

common.refreshTmpDir();

const gunzip = zlib.createGunzip();

const fs = require('fs');

const fixture = path.resolve(common.fixturesDir, 'person.jpg.gz');
const unzippedFixture = path.resolve(common.fixturesDir, 'person.jpg');
const outputFile = path.resolve(common.tmpDir, 'person.jpg');
const expect = fs.readFileSync(unzippedFixture);
const inp = fs.createReadStream(fixture);
const out = fs.createWriteStream(outputFile);

inp.pipe(gunzip).pipe(out);
out.on('close', function() {
  const actual = fs.readFileSync(outputFile);
  assert.equal(actual.length, expect.length, 'length should match');
  for (var i = 0, l = actual.length; i < l; i++) {
    assert.equal(actual[i], expect[i], 'byte[' + i + ']');
  }
});

Version data entries

5 entries across 4 versions & 1 rubygems

Version Path
node-compiler-0.9.1 vendor/node/test/parallel/test-zlib-from-gzip.js
node-compiler-0.9.0 vendor/node-v7.2.1/test/parallel/test-zlib-from-gzip.js
node-compiler-0.8.0 vendor/node-v7.2.0/test/parallel/test-zlib-from-gzip.js
node-compiler-0.7.0 vendor/node-v6.9.1/test/parallel/test-zlib-from-gzip.js
node-compiler-0.7.0 vendor/node-v7.1.0/test/parallel/test-zlib-from-gzip.js