raw option support for wrapper (not works now)

This commit is contained in:
Vitaly Puzrin 2014-02-15 00:33:33 +04:00
parent ee4543fc0a
commit b4c0a04872
2 changed files with 19 additions and 9 deletions

View file

@ -25,16 +25,22 @@ var Deflate = function(options) {
strategy: c.Z_DEFAULT_STRATEGY
}, options || {});
var opt = this.options;
if (opt.raw && (opt.windowBits > 0)) {
opt.windowBits = -opt.windowBits;
}
this.strm = new zstream();
this.strm.next_out = utils.arrayCreate(this.options.chunkSize);
this.strm.next_out = utils.arrayCreate(opt.chunkSize);
var status = zlib_deflate.deflateInit2(
this.strm,
this.options.level,
this.options.method,
this.options.windowBits,
this.options.memLevel,
this.options.strategy
opt.level,
opt.method,
opt.windowBits,
opt.memLevel,
opt.strategy
);
if (status !== c.Z_OK) {

View file

@ -18,13 +18,17 @@ var sample_file = path.join(__dirname, 'fixtures/lorem_100k.txt');
var sample = new Uint8Array(fs.readFileSync(sample_file));
describe.skip('Deflate defaults', function () {
describe('Deflate defaults', function () {
it('deflate', function(done) {
it.skip('deflate', function(done) {
testDeflate(zlib.createDeflate, pako.deflate, sample, {}, done);
});
it('deflate raw', function(done) {
it.skip('deflate raw', function(done) {
testDeflate(zlib.createDeflateRaw, pako.deflateRaw, sample, {}, done);
});
it.skip('deflate raw (level 0)', function(done) {
testDeflate(zlib.createDeflateRaw, pako.deflateRaw, sample, {}, done);
});