remove trailing whitespaces in lib/copystream.js

This commit is contained in:
Philipp Borgers 2013-01-24 01:09:17 +01:00
parent d8255c6f85
commit ace259fd0c

View File

@ -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');
}