Permalink
Browse files

Make `JSON.stringify` on buffer return string of the given buffer.

  • Loading branch information...
1 parent d1423b0 commit 7a693df73daafbab9047026067d1c8ff0093b55d @Gozala committed Jul 6, 2011
Showing with 3 additions and 0 deletions.
  1. +3 −0 buffer.js
View
@@ -46,6 +46,9 @@ var Buffer = Extendable.extend({
transcoder.charset = String(encoding || this.encoding).toUpperCase();
return transcoder.convertFromByteArray(bytes, this.length);
},
+ toJSON: function toJSON() {
+ return this.toString()
+ },
write: function write(string, offset, encoding) {
offset = Math.max(offset || 0, 0);
let value = this.valueOf();

0 comments on commit 7a693df

Please sign in to comment.