pierrec / node-lz4

LZ4 fast compression algorithm for NodeJS
MIT License
438 stars 98 forks source link

Error encoding "Hello World" in browser version #13

Closed tpodom closed 10 years ago

tpodom commented 10 years ago
<script type="text/javascript" src="../build/lz4.js"></script>
<script type="text/javascript">
  var Buffer = require('buffer').Buffer
  var LZ4 = require('lz4')
  console.log(LZ4.encode("Hello World"))
</script>

Running that is resulting the following error (sorry copy / paste doesn't seem very good for the stack trace): Uncaught Error: specified a negative value for writing an unsigned value lz4.js:2126 assert lz4.js:2126 verifuint lz4.js:2107 writeUInt32 lz4.js:1724 Buffer.writeUInt32LE lz4.js:1739 Encoder._flush lz4.js:840 (anonymous function) lz4.js:3975 g lz4.js:2509 EventEmitter.emit lz4.js:2414 finishMaybe lz4.js:4425 endWritable lz4.js:4432 Writable.end lz4.js:4410 LZ4_compress lz4.js:621 (anonymous function) uncompress.html:10

pierrec commented 10 years ago

Thank you! Fixed as of 0.3.7.

tpodom commented 10 years ago

I'm still having problems with this on Chrome on Mac OS X. I'm submitting a PR that reproduces this problem using karma to run the tests in the browser.

tpodom commented 10 years ago

Yeah appears to work now, thanks!