regular / unbzip2-stream

streaming unbzip2 implementatio in pure javascript for node and browsers
Other
29 stars 23 forks source link

Bugfix: request buffer only when needed #8

Closed jeromew closed 8 years ago

jeromew commented 8 years ago

Currently there is a bug depending on how chunks are split because if the requested bits consume all the available bits, bytes has no value.

By moving the buffer request, the code requests a buffer only when it needs it, lowering the potential of a bug.

This does not fix all the Cannot read property '0' of undefined problems (I am still looking into it) but fixes one case I found when using { highWaterMark: 1} in long.js