From d846347693ef8e9146e0a32ba8993fae126c4bbf Mon Sep 17 00:00:00 2001 From: Feross Aboukhadijeh Date: Mon, 18 Nov 2013 04:38:04 -0800 Subject: [PATCH] fix toJSON() method --- index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 7e7414e..103a7a3 100644 --- a/index.js +++ b/index.js @@ -268,7 +268,10 @@ function BufferToString (encoding, start, end) { } function BufferToJSON () { - return Array.prototype.slice.call(this, 0) + return { + type: 'Buffer', + data: Array.prototype.slice.call(this, 0) + } } // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length) -- 2.34.1