Sha256: d8dd0e053ca03119135b3a94e101df136b12a012f4facca9fee7495459d58ae0

Contents?: true

Size: 955 Bytes

Versions: 73

Compression:

Stored size: 955 Bytes

Contents

var common = require('../common.js');
var assert = require('assert');
var zlib = require('zlib');
var path = require('path');
var fs = require('fs');

var file = fs.readFileSync(path.resolve(common.fixturesDir, 'person.jpg')),
    chunkSize = 24 * 1024,
    opts = { level: 9, strategy: zlib.Z_DEFAULT_STRATEGY },
    deflater = zlib.createDeflate(opts);

var chunk1 = file.slice(0, chunkSize),
    chunk2 = file.slice(chunkSize),
    blkhdr = new Buffer([0x00, 0x48, 0x82, 0xb7, 0x7d]),
    expected = Buffer.concat([blkhdr, chunk2]),
    actual;

deflater.write(chunk1, function() {
  deflater.params(0, zlib.Z_DEFAULT_STRATEGY, function() {
    while (deflater.read());
    deflater.end(chunk2, function() {
      var bufs = [], buf;
      while (buf = deflater.read())
        bufs.push(buf);
      actual = Buffer.concat(bufs);
    });
  });
  while (deflater.read());
});

process.once('exit', function() {
  assert.deepEqual(actual, expected);
});

Version data entries

73 entries across 73 versions & 5 rubygems

Version Path
lanes-0.8.0 node_modules/browserify-zlib/test/ignored/test-zlib-params.js
minimum_viable_product-0.0.11 test/dummy/node_modules/browserify-zlib/test/ignored/test-zlib-params.js
brwy_rails-0.0.6 test/dummy/node_modules/browserify-zlib/test/ignored/test-zlib-params.js
brwy_rails-0.0.5 test/dummy/node_modules/browserify-zlib/test/ignored/test-zlib-params.js
brwy_rails-0.0.4 test/dummy/node_modules/browserify-zlib/test/ignored/test-zlib-params.js
brwy_rails-0.0.3 test/dummy/node_modules/browserify-zlib/test/ignored/test-zlib-params.js
brwy_rails-0.0.2 test/dummy/node_modules/browserify-zlib/test/ignored/test-zlib-params.js
brwy_rails-0.0.1 test/dummy/node_modules/browserify-zlib/test/ignored/test-zlib-params.js
gulp_assets-1.0.0.pre.5 template/node_modules/node-libs-browser/node_modules/browserify-zlib/test/ignored/test-zlib-params.js
gulp_assets-1.0.0.pre.4 template/node_modules/node-libs-browser/node_modules/browserify-zlib/test/ignored/test-zlib-params.js
gulp_assets-1.0.0.pre.3 template/node_modules/node-libs-browser/node_modules/browserify-zlib/test/ignored/test-zlib-params.js
smock-0.1.268 node_modules/webpack/node_modules/node-libs-browser/node_modules/browserify-zlib/test/ignored/test-zlib-params.js
smock-0.1.267 node_modules/webpack/node_modules/node-libs-browser/node_modules/browserify-zlib/test/ignored/test-zlib-params.js
smock-0.1.266 node_modules/webpack/node_modules/node-libs-browser/node_modules/browserify-zlib/test/ignored/test-zlib-params.js
smock-0.1.265 node_modules/webpack/node_modules/node-libs-browser/node_modules/browserify-zlib/test/ignored/test-zlib-params.js
smock-0.1.264 node_modules/webpack/node_modules/node-libs-browser/node_modules/browserify-zlib/test/ignored/test-zlib-params.js
smock-0.1.263 node_modules/webpack/node_modules/node-libs-browser/node_modules/browserify-zlib/test/ignored/test-zlib-params.js
smock-0.1.262 node_modules/webpack/node_modules/node-libs-browser/node_modules/browserify-zlib/test/ignored/test-zlib-params.js
smock-0.1.261 node_modules/webpack/node_modules/node-libs-browser/node_modules/browserify-zlib/test/ignored/test-zlib-params.js
smock-0.1.260 node_modules/webpack/node_modules/node-libs-browser/node_modules/browserify-zlib/test/ignored/test-zlib-params.js