diff --git a/lib/bcoin/writer.js b/lib/bcoin/writer.js index a59ce125..92e06e7b 100644 --- a/lib/bcoin/writer.js +++ b/lib/bcoin/writer.js @@ -22,7 +22,7 @@ function BufferWriter(options) { this.written = 0; } -BufferWriter.prototype.render = function render() { +BufferWriter.prototype.render = function render(keep) { var data = new Buffer(this.written); var off = 0; var i, item; @@ -49,6 +49,9 @@ BufferWriter.prototype.render = function render() { } } + if (keep !== true) + this.destroy(); + return data; };