Node.js缓冲区+ lz4问题 - buffer.js:705抛出TypeError('值超出范围')

时间:2014-08-27 23:01:22

标签: node.js buffer lz4

我的node.js脚本中有以下行生成致命错误:

var compressedOutput = lz4.encode(new Buffer(logdata,"utf8"));

变量'logdata'包含我使用http请求参数创建的字符串。这是lz4的问题还是我创建缓冲区的方式?我怎么解决?错误信息如下:

    buffer.js:705
    throw TypeError('value is out of bounds');
          ^
TypeError: value is out of bounds
    at TypeError (<anonymous>)
    at checkInt (buffer.js:705:11)
    at Buffer.writeInt32LE (buffer.js:782:5)
    at Encoder._flush (/var/www/node_modules/lz4/lib/encoder_stream.js:210:7)
    at Encoder.<anonymous> (_stream_transform.js:130:12)
    at Encoder.g (events.js:180:16)
    at Encoder.emit (events.js:92:17)
    at finishMaybe (_stream_writable.js:359:12)
    at endWritable (_stream_writable.js:366:3)
    at Encoder.Writable.end (_stream_writable.js:344:5)
worker 3884 died

谢谢,非常感谢!

0 个答案:

没有答案