nodeca/pako

`inflator.onData` does not work

AlttiRi opened this issue · 1 comments

When I define onData callback, it never fires.

const inflator = new pako.Inflate();
inflator.onData(chunk => console.error(chunk));

The lib just adds it as the first item of chunks.

And in this case the inflator.result contains unnecessary additional 0 as the first item of the array.


Without onData (OK):
ok

With onData (not OK):
bad

Oh, wait. It doesn't expect a callback. That's a method to overwrite with default behavior. Well, okay, I can work with it.

pako/lib/inflate.js

Lines 310 to 312 in 0398fad

Inflate.prototype.onData = function (chunk) {
this.chunks.push(chunk);
};