mirror of
https://github.com/0x5eal/rbxts-pako.git
synced 2025-04-21 20:34:04 +01:00
raw
option support for wrapper (not works now)
This commit is contained in:
parent
ee4543fc0a
commit
b4c0a04872
2 changed files with 19 additions and 9 deletions
|
@ -25,16 +25,22 @@ var Deflate = function(options) {
|
||||||
strategy: c.Z_DEFAULT_STRATEGY
|
strategy: c.Z_DEFAULT_STRATEGY
|
||||||
}, options || {});
|
}, options || {});
|
||||||
|
|
||||||
|
var opt = this.options;
|
||||||
|
|
||||||
|
if (opt.raw && (opt.windowBits > 0)) {
|
||||||
|
opt.windowBits = -opt.windowBits;
|
||||||
|
}
|
||||||
|
|
||||||
this.strm = new zstream();
|
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(
|
var status = zlib_deflate.deflateInit2(
|
||||||
this.strm,
|
this.strm,
|
||||||
this.options.level,
|
opt.level,
|
||||||
this.options.method,
|
opt.method,
|
||||||
this.options.windowBits,
|
opt.windowBits,
|
||||||
this.options.memLevel,
|
opt.memLevel,
|
||||||
this.options.strategy
|
opt.strategy
|
||||||
);
|
);
|
||||||
|
|
||||||
if (status !== c.Z_OK) {
|
if (status !== c.Z_OK) {
|
||||||
|
|
|
@ -18,13 +18,17 @@ var sample_file = path.join(__dirname, 'fixtures/lorem_100k.txt');
|
||||||
var sample = new Uint8Array(fs.readFileSync(sample_file));
|
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);
|
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);
|
testDeflate(zlib.createDeflateRaw, pako.deflateRaw, sample, {}, done);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue