pierrec / node-lz4

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

Invalid stream checksum #19

Closed avz closed 10 years ago

avz commented 10 years ago

Hi, I have a problem in this simple example

var lz4 = require('lz4');

var data = new Buffer(200);
data.fill(0);

lz4.decode(lz4.encode(data));

As result

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: Invalid stream checksum: -24E4B2DD @26
    at Decoder.emit_Error (/home/arepo/node_modules/lz4/lib/decoder_stream.js:64:22)
    at Decoder.read_EOS (/home/arepo/node_modules/lz4/lib/decoder_stream.js:268:9)
    at Decoder._main (/home/arepo/node_modules/lz4/lib/decoder_stream.js:318:25)
    at Decoder._transform (/home/arepo/node_modules/lz4/lib/decoder_stream.js:60:7)
    at Decoder.Transform._read (_stream_transform.js:179:10)
    at Decoder.Transform._write (_stream_transform.js:167:12)
    at doWrite (_stream_writable.js:225:10)
    at writeOrBuffer (_stream_writable.js:215:5)
    at Decoder.Writable.write (_stream_writable.js:182:11)
    at Decoder.Writable.end (_stream_writable.js:340:10)

My software

% uname -a
Linux work 3.16.1-1-ARCH #1 SMP PREEMPT Thu Aug 14 07:40:19 CEST 2014 x86_64 GNU/Linux

% node --version
v0.10.31

% npm list lz4
/home/arepo
└── lz4@0.3.12
pierrec commented 10 years ago

Thanks for reporting this.

Changed the way Buffer.readInt32LE() is handled as nodejs and browserify implementations differ somehow.

See v0.3.13.

Let me know if this works for you.