in lib/protocol/plain_buffer_stream.js [186:207]
writeBytes: function (value) {
var bytes = null;
if (value instanceof Buffer) {
bytes = value;
} else if (typeof (value) === 'string') {
bytes = new Buffer(value);
}
if (this.pos + bytes.length > this.capacity) {
throw Error('The buffer is full.');
}
if (value instanceof Buffer) {
value.copy(this.buffer, this.pos);
} else if (typeof (value) === 'string') {
this.buffer.write(value, this.pos);
} else {
throw new Error('expect Buffer or string,but it was:' + typeof (value));
}
this.pos += bytes.length;
}