zhipeng-jia / snappyjs

JavaScript implementation of Google's Snappy compression library
MIT License
151 stars 30 forks source link

fix uint8array compression bug #2

Closed ngavalas closed 7 years ago

ngavalas commented 7 years ago

There is a bug in the pull request in https://github.com/zhipeng-jia/snappyjs/pull/1 that makes Uint8Array compression completely fail in the browser. Trying to compress Uint8Array falls through to the Buffer case and Buffer is only defined in node, so it throws. This fixes the bug and lets Uint8Array compression succeed and return the correct type.

ngavalas commented 7 years ago

cc @KlausTrainer

zhipeng-jia commented 7 years ago

@ngavalas Test fails are due to old Node.js versions fail to compile some dependencies used in test code. I will fix this later.

KlausTrainer commented 7 years ago

Duh! Thanks for the heads-up and submitting the fix, @ngavalas!

ngavalas commented 7 years ago

Yeah, I saw the same test failures locally on OS X and didn't think it was related to this commit. I think this is safe to merge now, but it's up to you.