diff --git a/lib/copystream.js b/lib/copystream.js index 70275fc7..35f276d4 100644 --- a/lib/copystream.js +++ b/lib/copystream.js @@ -33,17 +33,17 @@ CopyFromStream.prototype._handleChunk = function (string, encoding) { dataChunk = new Buffer(string, encoding); } if (this._buffer.length) { - //Buffer.concat is better, but it's missing + //Buffer.concat is better, but it's missing //in node v0.6.x - tmpBuffer = new Buffer(this._buffer.length + dataChunk.length); - this._buffer.copy(tmpBuffer); + tmpBuffer = new Buffer(this._buffer.length + dataChunk.length); + this._buffer.copy(tmpBuffer); dataChunk.copy(tmpBuffer, this._buffer.length); this._buffer = tmpBuffer; } else { this._buffer = dataChunk; } } - + return this._sendIfConnectionReady(); }; CopyFromStream.prototype._sendIfConnectionReady = function () { @@ -51,7 +51,7 @@ CopyFromStream.prototype._sendIfConnectionReady = function () { if (this._connection) { dataSent = this._connection.sendCopyFromChunk(this._buffer); this._buffer = new Buffer(0); - if (this._dataBuffered) { + if (this._dataBuffered) { this.emit('drain'); } this._dataBuffered = false; @@ -84,7 +84,7 @@ CopyFromStream.prototype.end = function (string, encondig) { }; CopyFromStream.prototype.error = function (error) { if (this._error || this._closed) { - return false; + return false; } this._error = true; this.emit('error', error); @@ -171,7 +171,7 @@ CopyToStream.prototype.resume = function () { this._outputDataChunk(); if (this._error) { return this.emit('error', this._error); - } + } if (this._finished) { return this.emit('end'); }