From 8e6b0147b94b9716f4b37bee2b4da076f8fcb290 Mon Sep 17 00:00:00 2001 From: Braydon Fuller Date: Fri, 26 Jun 2015 16:38:42 -0400 Subject: [PATCH] Fixed issue with incompatible buffer.toJSON for node 0.10 and 0.12 --- lib/encoding/bufferreader.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/encoding/bufferreader.js b/lib/encoding/bufferreader.js index 19c6f81..34f8580 100644 --- a/lib/encoding/bufferreader.js +++ b/lib/encoding/bufferreader.js @@ -91,8 +91,9 @@ BufferReader.prototype.readUInt64BEBN = function() { }; BufferReader.prototype.readUInt64LEBN = function() { - var data = this.buf.slice(this.pos, this.pos + 8).toJSON().data; - var bn = new BN(data, 10, 'le'); + var buf = this.buf.slice(this.pos, this.pos + 8); + var array = Array.prototype.slice.call(buf, 0); + var bn = new BN(array, 10, 'le'); this.pos = this.pos + 8; return bn; };